This commit is contained in:
sardelka9515
2022-08-21 19:30:27 +08:00
parent 2d2da624e4
commit 739577bbf1
3 changed files with 10 additions and 5 deletions

View File

@ -144,8 +144,10 @@ namespace RageCoop.Server
Logger?.Info("Installing update"); Logger?.Info("Installing update");
Directory.CreateDirectory("Update"); Directory.CreateDirectory("Update");
new FastZip().ExtractZip("Update.zip", "Update", FastZip.Overwrite.Always, null, null, null, true); new FastZip().ExtractZip("Update.zip", "Update", FastZip.Overwrite.Always, null, null, null, true);
MainNetServer.Shutdown("Server updating");
Logger.Info("Server shutting down!");
Logger.Flush();
Process.Start(Path.Combine("Update", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "RageCoop.Server.exe": "RageCoop.Server"), "update \"" + AppDomain.CurrentDomain.BaseDirectory + "\""); Process.Start(Path.Combine("Update", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "RageCoop.Server.exe": "RageCoop.Server"), "update \"" + AppDomain.CurrentDomain.BaseDirectory + "\"");
Stop();
Environment.Exit(0); Environment.Exit(0);
} }
catch(Exception ex) catch(Exception ex)

View File

@ -21,18 +21,21 @@ namespace RageCoop.Server
int i =0; int i =0;
while (i < 10) while (i < 10)
{ {
i++;
try try
{ {
Console.WriteLine("Applying update to "+target);
CoreUtils.CopyFilesRecursively(new(AppDomain.CurrentDomain.BaseDirectory), new(target)); CoreUtils.CopyFilesRecursively(new(AppDomain.CurrentDomain.BaseDirectory), new(target));
Process.Start(Path.Combine(target, "RageCoop.Server")); Process.Start(Path.Combine(target, "RageCoop.Server"));
Environment.Exit(0); Environment.Exit(0);
} }
catch catch(Exception ex)
{ {
Console.WriteLine(ex.ToString());
Thread.Sleep(3000); Thread.Sleep(3000);
} }
} }
return; Environment.Exit(i);
} }
AppDomain.CurrentDomain.UnhandledException+=UnhandledException; AppDomain.CurrentDomain.UnhandledException+=UnhandledException;
mainLogger = new Logger() mainLogger = new Logger()

View File

@ -15,7 +15,7 @@ using System.Resources;
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Version information // Version information
[assembly: AssemblyVersion("1.5.1.62")] [assembly: AssemblyVersion("0.5.1.69")]
[assembly: AssemblyFileVersion("1.5.1.62")] [assembly: AssemblyFileVersion("0.5.1.69")]
[assembly: NeutralResourcesLanguageAttribute( "en-US" )] [assembly: NeutralResourcesLanguageAttribute( "en-US" )]