使v2rayUpgrade.exe支持更新自身

pull/573/head
YFdyh000 2020-03-21 07:55:25 +08:00
parent 948b9c26d9
commit 20ab51e339
1 changed files with 6 additions and 0 deletions

View File

@ -62,6 +62,8 @@ namespace v2rayUpgrade
}
}
string thisAppOldFile = Application.ExecutablePath + ".tmp";
File.Delete(thisAppOldFile);
string startKey = "v2rayN/";
using (ZipArchive archive = ZipFile.OpenRead(fileName))
@ -77,6 +79,10 @@ namespace v2rayUpgrade
{
fullName = fullName.Substring(startKey.Length, fullName.Length - startKey.Length);
}
if (Application.ExecutablePath.ToLower() == GetPath(fullName).ToLower())
{
File.Move(Application.ExecutablePath, thisAppOldFile);
}
string entryOuputPath = GetPath(fullName);