mirror of
https://github.com/2dust/v2rayN.git
synced 2025-09-03 00:36:20 +00:00
Update UpdateService.cs
This commit is contained in:
parent
6d5bd414a5
commit
fde71068e1
1 changed files with 38 additions and 1 deletions
|
@ -66,6 +66,43 @@ namespace ServiceLib.Services
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var toPath = Utils.GetBinPath("", type.ToString());
|
||||||
|
if (!Directory.Exists(toPath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(toPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileName.Contains(".tar.gz"))
|
||||||
|
{
|
||||||
|
FileManager.DecompressTarFile(fileName, toPath);
|
||||||
|
var dir = new DirectoryInfo(toPath);
|
||||||
|
if (dir.Exists)
|
||||||
|
{
|
||||||
|
foreach (var subDir in dir.GetDirectories())
|
||||||
|
{
|
||||||
|
FileManager.CopyDirectory(subDir.FullName, toPath, false, true);
|
||||||
|
subDir.Delete(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (fileName.Contains(".gz"))
|
||||||
|
{
|
||||||
|
FileManager.DecompressFile(fileName, toPath, type.ToString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FileManager.ZipExtractToFile(fileName, toPath, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Utils.IsNonWindows())
|
||||||
|
{
|
||||||
|
var coreFile = Path.Combine(toPath, type.ToString().ToLower());
|
||||||
|
if (File.Exists(coreFile))
|
||||||
|
{
|
||||||
|
Utils.SetLinuxChmod(coreFile).Wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_updateFunc?.Invoke(true, fileName);
|
_updateFunc?.Invoke(true, fileName);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -586,4 +623,4 @@ namespace ServiceLib.Services
|
||||||
|
|
||||||
#endregion Geo private
|
#endregion Geo private
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue