@echo off
setlocal enabledelayedexpansion
title 汉化补丁-风雨凌芸
echo  正在汉化，请稍后。
if not exist "L.YUN.txt" ( 
	if exist 还原补丁 (
		del /s /q 还原补丁>nul
	)
	echo -删除此文件会导致重新备份还原补丁。如果你确保当前游戏为原版（未汉化）且想重新备份还原补丁请删除此文件。>L.YUN.txt
	echo.>>L.YUN.txt
	echo -BY 风雨凌芸>>L.YUN.txt
	echo -http://www/lyun.me>>L.YUN.txt
	echo.>>L.YUN.txt
	echo -↘↓↙下面的是自动生成的汉化补丁内容文件，请勿修改或删除！>>L.YUN.txt
	for /f "tokens=*" %%i in ('dir "汉化补丁/data" /a-d/s/b') do (
		set "s=%%i"
		set "s=!s:%~dp0=!"
		set "s=!s:汉化补丁\=!"
		echo !s!>>L.YUN.txt
	)
	for /f "eol=- tokens=*" %%i in (L.YUN.txt) do (
		echo f|xcopy "..\%%i" "还原补丁\%%i" /y /Q>nul 2>nul
	)
	xcopy "..\bin\fmod_event.dll" "还原补丁\bin\" /y /Q>nul
)
set aa=3：
if not exist "还原补丁\bin\fmod_event.dll" (
	del L.YUN.txt>nul
	for /l %%a in (%aa%,,-1,0) do (
		cls
		echo  汉化失败，请检查补丁目录后再试。
		echo  请按照使用说明.pdf中写的将“Don't Starve汉化补丁”放到指定目录。
		echo  %%a秒后自动关闭。
		ping 127.0.0.1 -n 2 >nul
	)
	exit
)
xcopy 汉化补丁\bin /s ..\bin /y /Q>nul
xcopy 汉化补丁\data /s ..\data /y /Q>nul
del ..\汉化.lnk>nul 2>nul
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(""..\还原.lnk""):b.TargetPath=""%~dp0\还原.bat"":b.WorkingDirectory=""%~dp0\"":b.IconLocation=""%~dp0\汉化补丁\logo.ico"":b.Save:close") >nul 2>nul
for /l %%a in (%aa%,,-1,0) do (
	cls
	echo  汉化完成！
	echo  %%a秒后自动关闭。
	ping 127.0.0.1 -n 2 >nul
)
exit