Move logger

This commit is contained in:
Sardelka 2022-07-13 11:08:04 +08:00
parent cdeef7279c
commit 72aff78718
2 changed files with 18 additions and 5 deletions

View File

@ -76,13 +76,11 @@ namespace RageCoop.Client
#if !NON_INTERACTIVE
CoopMenu.DisconnectedMenuSetting();
#endif
Main.Logger.Info($">> Disconnected << reason: {reason}");
Main.QueueAction(() =>
GTA.UI.Notification.Show("~r~Disconnected: " + reason));
Main.Resources.Unload();
Main.Logger.Info($">> Disconnected << reason: {reason}");
Main.Resources.Unload();
break;
}

View File

@ -238,6 +238,21 @@ namespace RageCoop.Client
File.WriteAllLines("ScriptHookVDotNet.ini",lineList.ToArray());
}
Keys key = (Keys)Enum.Parse(typeof(Keys), reloadKey, true);
// Move log file so it doesn't get deleted
Main.Logger.Dispose();
var path = Main.Logger.LogPath+".last.log";
try
{
if (File.Exists(path)) { File.Delete(path); }
File.Move(Main.Logger.LogPath, path);
}
catch(Exception ex)
{
GTA.UI.Notification.Show(ex.Message);
}
PostMessage(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle, WM_KEYDOWN, (int)key, 0);
}