mirror of
https://github.com/netchx/netch.git
synced 2026-03-14 17:43:18 +08:00
Feat: -forceUpdate Parameter
This commit is contained in:
@@ -5,6 +5,12 @@
|
||||
public const string EOF = "\r\n";
|
||||
public const string UserACL = "data\\user.acl";
|
||||
public const string BuiltinACL = "bin\\default.acl";
|
||||
public const string ParameterShow = "-show";
|
||||
|
||||
public static class Parameter
|
||||
{
|
||||
public const string Show = "-show";
|
||||
public const string ForceUpdate = "-forceUpdate";
|
||||
public const string Console = "-console";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,5 +10,7 @@ namespace Netch
|
||||
private static readonly Lazy<bool> LazySupportFakeDns = new(() => new TUNTAPController().TestFakeDNS());
|
||||
|
||||
public static bool SupportFakeDns => LazySupportFakeDns.Value;
|
||||
|
||||
public static bool AlwaysShowNewVersionFound { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1383,7 +1383,8 @@ namespace Netch.Forms
|
||||
if (File.Exists(file))
|
||||
File.Delete(file);
|
||||
|
||||
Stop();
|
||||
if (IsWaiting())
|
||||
await StopAsyncCore();
|
||||
|
||||
Dispose();
|
||||
Environment.Exit(Environment.ExitCode);
|
||||
@@ -1419,6 +1420,8 @@ namespace Netch.Forms
|
||||
{
|
||||
UpdateChecker.NewVersionFound += OnUpdateCheckerOnNewVersionFound;
|
||||
UpdateChecker.Check(Global.Settings.CheckBetaUpdate).Wait();
|
||||
if (Flags.AlwaysShowNewVersionFound)
|
||||
OnUpdateCheckerOnNewVersionFound(null!, null!);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -24,10 +24,12 @@ namespace Netch
|
||||
#if DEBUG
|
||||
AttachConsole();
|
||||
#else
|
||||
if (args.Contains("-console"))
|
||||
if (args.Contains(Constants.Parameter.Console))
|
||||
AttachConsole();
|
||||
#endif
|
||||
|
||||
if (args.Contains(Constants.Parameter.ForceUpdate))
|
||||
Flags.AlwaysShowNewVersionFound = true;
|
||||
|
||||
// 设置当前目录
|
||||
Directory.SetCurrentDirectory(Global.NetchDir);
|
||||
@@ -48,7 +50,7 @@ namespace Netch
|
||||
|
||||
if (!SingleInstance.IsFirstInstance)
|
||||
{
|
||||
SingleInstance.PassArgumentsToFirstInstance(args.Append(Constants.ParameterShow));
|
||||
SingleInstance.PassArgumentsToFirstInstance(args.Append(Constants.Parameter.Show));
|
||||
Environment.Exit(0);
|
||||
return;
|
||||
}
|
||||
@@ -103,7 +105,7 @@ namespace Netch
|
||||
|
||||
private static void SingleInstance_ArgumentsReceived(IEnumerable<string> args)
|
||||
{
|
||||
if (args.Contains(Constants.ParameterShow))
|
||||
if (args.Contains(Constants.Parameter.Show))
|
||||
{
|
||||
Global.MainForm.ShowMainFormToolStripButton_Click(null!, null!);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user