From 8b86b374fccf043075e882951015edc63cb143e5 Mon Sep 17 00:00:00 2001 From: Damien Haynes Date: Sat, 24 Aug 2024 09:32:55 +1000 Subject: [PATCH] chore: log version of application (#167) Co-authored-by: Damien Haynes --- Properties/AssemblyInfo.cs | 4 ++-- TraktRater.cs | 27 ++++++++++++++++++--------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 161e8c1..bc0fa7b 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.3.14.0")] -[assembly: AssemblyFileVersion("2.3.14.0")] +[assembly: AssemblyVersion("2.3.15.0")] +[assembly: AssemblyFileVersion("2.3.15.0")] diff --git a/TraktRater.cs b/TraktRater.cs index 41657cd..719cbb7 100644 --- a/TraktRater.cs +++ b/TraktRater.cs @@ -31,6 +31,7 @@ public partial class TraktRater : Form static bool mImportRunning = false; static bool mImportCancelled = false; static string mPinCode = string.Empty; + static string mVersion = string.Empty; #endregion #region Constants @@ -43,8 +44,7 @@ public partial class TraktRater : Form #region Constructor public TraktRater() - { - FileLog.LogFileName = DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".log"; + { InitializeComponent(); } #endregion @@ -53,7 +53,12 @@ public TraktRater() protected override void OnLoad(EventArgs e) { base.OnLoad(e); - Text = "TraktRater v" + Assembly.GetEntryAssembly().GetName().Version; + + mVersion = "TraktRater v" + Assembly.GetEntryAssembly().GetName().Version; + Text = mVersion; + + InitialiseLog(); + AppSettings.Load(); ClearProgress(); @@ -712,8 +717,7 @@ private void StartImport() if (!CheckAccountDetails() || mImportRunning) return; - // update file log with new name - FileLog.LogFileName = DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".log"; + InitialiseLog(); mSites.Clear(); @@ -806,8 +810,7 @@ private void StartMaintenance(MaintenanceSettings settings) if (!CheckAccountDetails() || mMaintenanceRunning) return; - // update file log with new name - FileLog.LogFileName = DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".log"; + InitialiseLog(); var maintThread = new Thread(o => { @@ -910,8 +913,7 @@ private void StartExport(ExportItems items) if (!CheckAccountDetails() || mExportRunning) return; - // update file log with new name - FileLog.LogFileName = DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".log"; + InitialiseLog(); var mainThread = new Thread(o => { @@ -1049,6 +1051,13 @@ private void CancelExport() #region Private Methods + private void InitialiseLog() + { + // update file log with new name + FileLog.LogFileName = DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".log"; + FileLog.Info(mVersion); + } + private bool Login() { // exchange pin-code for access token or refresh existing token