Skip to content

Commit

Permalink
Added more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ixel1 committed Jan 25, 2022
1 parent b5185b6 commit 47f287a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions OmsiTimeSyncPlugin/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ private string getOmsiVersion()

string md5Hash = sb.ToString().ToUpper();

Log.Save("DEBUG", "OMSI 2's MD5 hash identified as " + md5Hash, AppConfig.loggingLevel);

switch (md5Hash)
{
// Without 4GB patch
Expand Down Expand Up @@ -823,9 +825,13 @@ private void frmMain_Shown(object sender, EventArgs e)

refreshButtonAlwaysOnTop();

Log.Save("INFO", "UI shown", AppConfig.loggingLevel);

// If OmsiTimeSync.cfg doesn't exist
if (!File.Exists("OmsiTimeSync.cfg"))
{
Log.Save("INFO", "OmsiTimeSync.cfg file does not exist, showing first time message...", AppConfig.loggingLevel);

// Show initial message box dialog (yes/no)
if (MessageBox.Show(
"Thanks for downloading OMSI Time Sync.\n" +
Expand All @@ -839,19 +845,26 @@ private void frmMain_Shown(object sender, EventArgs e)
"Do you acknowledge the above notice and agree?",
"OMSI Time Sync", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
Log.Save("INFO", "First time message was declined, terminating plugin...", AppConfig.loggingLevel);

// If 'no' is chosen then close the app
this.Close();
Application.Exit();

// Don't execute further code
return;
}

Log.Save("INFO", "First time message was accepted, continuing...", AppConfig.loggingLevel);
}

Log.Save("INFO", "Initialising Mem()...", AppConfig.loggingLevel);

// For accessing and writing to OMSI's memory later on
m = new Mem();

// Add supported OMSI memory addresses
Log.Save("INFO", "Adding OMSI 2's recognised memory addresses...", AppConfig.loggingLevel);

// v2.3.004
// Date/Time
Expand All @@ -875,9 +888,13 @@ private void frmMain_Shown(object sender, EventArgs e)
Omsi.addMemoryAddress("2.2.032", new OmsiAddress("ptr1_to_map_path", 0x00461584)); // int (memory address pointer leading to map path)
Omsi.addMemoryAddress("2.2.032", new OmsiAddress("ptr2_to_map_path", 0x154)); // int (memory address offset leading to map path)

Log.Save("INFO", "Setting up autosave timer...", AppConfig.loggingLevel);

// Setup the autosave timer
tmrAutoSave = new System.Threading.Timer(new System.Threading.TimerCallback(tmrAutoSave_Tick), null, 60000, 60000);

Log.Save("INFO", "Setting up background timer...", AppConfig.loggingLevel);

// Setup the background timer which does various stuff
tmrBackground = new System.Threading.Timer(new System.Threading.TimerCallback(tmrBackground_Tick), null, 1000, 1000);
}
Expand Down

0 comments on commit 47f287a

Please sign in to comment.