mirror of
https://github.com/netchx/netch.git
synced 2026-03-18 18:13:21 +08:00
refactor: updater argument parse to fix path with space
This commit is contained in:
@@ -73,7 +73,7 @@ namespace Netch.Forms
|
||||
{
|
||||
FileName = Path.Combine(Global.NetchDir, "NetchUpdater.exe"),
|
||||
Arguments =
|
||||
$"{Global.Settings.UDPSocketPort} {fileFullPath} {Global.NetchDir}"
|
||||
$"{Global.Settings.UDPSocketPort}|{fileFullPath}|{Global.NetchDir}"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,11 @@ namespace NetchUpdater
|
||||
UpdaterFriendlyName = Path.GetFileName(UpdaterFullName);
|
||||
}
|
||||
|
||||
public static void Main(string[] args)
|
||||
public static void Main(string[] args1)
|
||||
{
|
||||
var result = false;
|
||||
|
||||
var args = args1.Aggregate((s, s1) => $"{s} {s1}").Split('|').Select(s => s.Trim()).ToArray();
|
||||
try
|
||||
{
|
||||
#region Check Arguments
|
||||
@@ -86,7 +87,7 @@ namespace NetchUpdater
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = newUpdaterPath,
|
||||
Arguments = $"{port} {updatePath} {targetPath}",
|
||||
Arguments = $"{port}|{updatePath}|{targetPath}",
|
||||
WorkingDirectory = tempPath,
|
||||
UseShellExecute = false
|
||||
});
|
||||
@@ -98,9 +99,9 @@ namespace NetchUpdater
|
||||
|
||||
#endregion
|
||||
|
||||
/*while (!Debugger.IsAttached)
|
||||
/*Console.WriteLine("Waiting Attach");
|
||||
while (!Debugger.IsAttached)
|
||||
{
|
||||
Console.WriteLine("Waiting Attach");
|
||||
Thread.Sleep(1000);
|
||||
}*/
|
||||
|
||||
@@ -221,7 +222,7 @@ namespace NetchUpdater
|
||||
File.WriteAllBytes("7za.exe", Resources._7za);
|
||||
|
||||
var argument = new StringBuilder();
|
||||
argument.Append($" x {archiveFileName} -o{destDirName} ");
|
||||
argument.Append($" x \"{archiveFileName}\" -o\"{destDirName}\" ");
|
||||
if (overwrite)
|
||||
argument.Append(" -y ");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user