mirror of https://github.com/2dust/v2rayN
Update v2rayUpgrade
parent
9c7446f820
commit
c061a24948
|
@ -66,7 +66,7 @@ namespace v2rayUpgrade
|
||||||
{
|
{
|
||||||
string thisAppOldFile = $"{GetExePath()}.tmp";
|
string thisAppOldFile = $"{GetExePath()}.tmp";
|
||||||
File.Delete(thisAppOldFile);
|
File.Delete(thisAppOldFile);
|
||||||
string startKey = "v2rayN/";
|
string splitKey = "/";
|
||||||
|
|
||||||
using ZipArchive archive = ZipFile.OpenRead(fileName);
|
using ZipArchive archive = ZipFile.OpenRead(fileName);
|
||||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||||
|
@ -77,11 +77,11 @@ namespace v2rayUpgrade
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
string fullName = entry.FullName;
|
|
||||||
if (fullName.StartsWith(startKey))
|
var lst = entry.FullName.Split(splitKey);
|
||||||
{
|
if (lst.Length == 1) continue;
|
||||||
fullName = fullName[startKey.Length..];
|
string fullName = string.Join(splitKey, lst[1..lst.Length]);
|
||||||
}
|
|
||||||
if (string.Equals(GetExePath(), GetPath(fullName), StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(GetExePath(), GetPath(fullName), StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
File.Move(GetExePath(), thisAppOldFile);
|
File.Move(GetExePath(), thisAppOldFile);
|
||||||
|
@ -90,6 +90,8 @@ namespace v2rayUpgrade
|
||||||
string entryOutputPath = GetPath(fullName);
|
string entryOutputPath = GetPath(fullName);
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(entryOutputPath)!);
|
Directory.CreateDirectory(Path.GetDirectoryName(entryOutputPath)!);
|
||||||
entry.ExtractToFile(entryOutputPath, true);
|
entry.ExtractToFile(entryOutputPath, true);
|
||||||
|
|
||||||
|
Console.WriteLine(entryOutputPath);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -104,11 +106,12 @@ namespace v2rayUpgrade
|
||||||
}
|
}
|
||||||
if (sb.Length > 0)
|
if (sb.Length > 0)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Upgrade Failed,Hold ctrl + c to copy to clipboard.\n" +
|
Console.WriteLine("Upgrade Failed.\n" +
|
||||||
"(升级失败,按住ctrl+c可以复制到剪贴板)." + sb.ToString());
|
"(升级失败)." + sb.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Start v2rayN, please wait...(正在重启,请等待)");
|
||||||
Process.Start("v2rayN");
|
Process.Start("v2rayN");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue