mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-23 03:16:53 +00:00
Optimization and upgrade tools
This commit is contained in:
parent
c27651b7b7
commit
4c3c1e0b5f
1 changed files with 21 additions and 9 deletions
|
@ -79,15 +79,7 @@ internal class UpgradeApp
|
|||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
entry.ExtractToFile(entryOutputPath, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
entry.ExtractToFile(entryOutputPath, true);
|
||||
}
|
||||
TryExtractToFile(entry, entryOutputPath);
|
||||
|
||||
Console.WriteLine(entryOutputPath);
|
||||
}
|
||||
|
@ -113,4 +105,24 @@ internal class UpgradeApp
|
|||
|
||||
Utils.StartV2RayN();
|
||||
}
|
||||
|
||||
private static bool TryExtractToFile(ZipArchiveEntry entry, string outputPath)
|
||||
{
|
||||
var retryCount = 5;
|
||||
var delayMs = 1000;
|
||||
|
||||
for (var i = 1; i <= retryCount; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
entry.ExtractToFile(outputPath, true);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
Thread.Sleep(delayMs * i);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue