rename Log to log

pull/32/head
Miepee 5 years ago
parent ea2fbebd8c
commit 8582dec8dd

@ -44,13 +44,13 @@ namespace AM2RLauncher
// Try to pull first. // Try to pull first.
try try
{ {
Log.Info("Attempting to pull repository " + currentMirror + "..."); log.Info("Attempting to pull repository " + currentMirror + "...");
await Task.Run(() => Profile.PullPatchData(TransferProgressHandlerMethod)); await Task.Run(() => Profile.PullPatchData(TransferProgressHandlerMethod));
// Thank you druid, for this case that should never happen // Thank you druid, for this case that should never happen
if (!File.Exists(CrossPlatformOperations.CURRENTPATH + "/PatchData/profile.xml")) if (!File.Exists(CrossPlatformOperations.CURRENTPATH + "/PatchData/profile.xml"))
{ {
Log.Error("Druid PatchData corruption occurred!"); log.Error("Druid PatchData corruption occurred!");
await Application.Instance.InvokeAsync(() => await Application.Instance.InvokeAsync(() =>
{ {
MessageBox.Show(Language.Text.CorruptPatchData, Language.Text.ErrorWindowTitle, MessageBoxType.Error); MessageBox.Show(Language.Text.CorruptPatchData, Language.Text.ErrorWindowTitle, MessageBoxType.Error);
@ -61,7 +61,7 @@ namespace AM2RLauncher
} }
catch (UserCancelledException ex) catch (UserCancelledException ex)
{ {
Log.Info(ex.Message); log.Info(ex.Message);
MessageBox.Show(Language.Text.CorruptPatchData, Language.Text.ErrorWindowTitle, MessageBoxType.Error); MessageBox.Show(Language.Text.CorruptPatchData, Language.Text.ErrorWindowTitle, MessageBoxType.Error);
HelperMethods.DeleteDirectory(CrossPlatformOperations.CURRENTPATH + "/PatchData"); HelperMethods.DeleteDirectory(CrossPlatformOperations.CURRENTPATH + "/PatchData");
} }
@ -73,19 +73,19 @@ namespace AM2RLauncher
{ {
if (!(bool)autoUpdateAM2RCheck.Checked) if (!(bool)autoUpdateAM2RCheck.Checked)
{ {
Log.Error("Internet connection failed while attempting to pull repository" + currentMirror + "!"); log.Error("Internet connection failed while attempting to pull repository" + currentMirror + "!");
MessageBox.Show(Language.Text.InternetConnectionDrop, Language.Text.WarningWindowTitle, MessageBoxType.Warning); MessageBox.Show(Language.Text.InternetConnectionDrop, Language.Text.WarningWindowTitle, MessageBoxType.Warning);
} }
} }
else else
{ {
Log.Error(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace); log.Error(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace);
MessageBox.Show(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace, Language.Text.ErrorWindowTitle, MessageBoxType.Error); MessageBox.Show(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace, Language.Text.ErrorWindowTitle, MessageBoxType.Error);
} }
} }
catch (Exception ex) // This is if somehow any other exception might get thrown as well. catch (Exception ex) // This is if somehow any other exception might get thrown as well.
{ {
Log.Error(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace); log.Error(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace);
MessageBox.Show(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace, Language.Text.ErrorWindowTitle, MessageBoxType.Error); MessageBox.Show(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace, Language.Text.ErrorWindowTitle, MessageBoxType.Error);
} }
finally finally
@ -103,7 +103,7 @@ namespace AM2RLauncher
if (currentXML.Version != profileList[0].Version) if (currentXML.Version != profileList[0].Version)
{ {
Log.Info("New game version (" + profileList[0].Version + ") detected! Beginning archival of version " + currentXML.Version + "..."); log.Info("New game version (" + profileList[0].Version + ") detected! Beginning archival of version " + currentXML.Version + "...");
string profileArchivePath = CrossPlatformOperations.CURRENTPATH + "/Profiles/Community Updates (" + currentXML.Version + ")"; string profileArchivePath = CrossPlatformOperations.CURRENTPATH + "/Profiles/Community Updates (" + currentXML.Version + ")";
@ -126,12 +126,12 @@ namespace AM2RLauncher
{ {
Directory.CreateDirectory(modArchivePath); Directory.CreateDirectory(modArchivePath);
File.WriteAllText(modArchivePath + "/profile.xml", Serializer.Serialize<ProfileXML>(currentXML)); File.WriteAllText(modArchivePath + "/profile.xml", Serializer.Serialize<ProfileXML>(currentXML));
Log.Info("Finished archival."); log.Info("Finished archival.");
} }
else else
{ {
HelperMethods.DeleteDirectory(profileArchivePath); HelperMethods.DeleteDirectory(profileArchivePath);
Log.Info("Cancelling archival! User-defined archive in Mods already exists."); log.Info("Cancelling archival! User-defined archive in Mods already exists.");
} }
@ -139,7 +139,7 @@ namespace AM2RLauncher
else // If our desired rename already exists, it's probably a user archive... so we just delete the folder and move on with installation of the new version. else // If our desired rename already exists, it's probably a user archive... so we just delete the folder and move on with installation of the new version.
{ {
HelperMethods.DeleteDirectory(CrossPlatformOperations.CURRENTPATH + "/Profiles/Community Updates (Latest)"); HelperMethods.DeleteDirectory(CrossPlatformOperations.CURRENTPATH + "/Profiles/Community Updates (Latest)");
Log.Info("Cancelling archival! User-defined archive in Profiles already exists."); log.Info("Cancelling archival! User-defined archive in Profiles already exists.");
} }
profileDropDown.SelectedIndex = 0; profileDropDown.SelectedIndex = 0;
@ -165,7 +165,7 @@ namespace AM2RLauncher
#region Download #region Download
case UpdateState.Download: case UpdateState.Download:
Log.Info("Attempting to clone repository " + currentMirror + "..."); log.Info("Attempting to clone repository " + currentMirror + "...");
bool successful = true; bool successful = true;
// Update playButton states // Update playButton states
@ -187,7 +187,7 @@ namespace AM2RLauncher
{ {
if (Directory.Exists(CrossPlatformOperations.CURRENTPATH + "/PatchData")) if (Directory.Exists(CrossPlatformOperations.CURRENTPATH + "/PatchData"))
{ {
Log.Info("PatchData directory already exists, cleaning up..."); log.Info("PatchData directory already exists, cleaning up...");
HelperMethods.DeleteDirectory(CrossPlatformOperations.CURRENTPATH + "/PatchData"); HelperMethods.DeleteDirectory(CrossPlatformOperations.CURRENTPATH + "/PatchData");
} }
@ -204,12 +204,12 @@ namespace AM2RLauncher
if (ex.Message.ToLower().Contains("failed to send request") || ex.Message.ToLower().Contains("connection with the server was terminated") || if (ex.Message.ToLower().Contains("failed to send request") || ex.Message.ToLower().Contains("connection with the server was terminated") ||
ex.Message.ToLower().Contains("failed to resolve address")) ex.Message.ToLower().Contains("failed to resolve address"))
{ {
Log.Error("Internet connection dropped while attempting to clone repository" + currentMirror + "!"); log.Error("Internet connection dropped while attempting to clone repository" + currentMirror + "!");
MessageBox.Show(Language.Text.InternetConnectionDrop, Language.Text.WarningWindowTitle, MessageBoxType.Warning); MessageBox.Show(Language.Text.InternetConnectionDrop, Language.Text.WarningWindowTitle, MessageBoxType.Warning);
} }
else else
{ {
Log.Error("LibGit2SharpException: " + ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace); log.Error("LibGit2SharpException: " + ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace);
MessageBox.Show(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace, Language.Text.ErrorWindowTitle, MessageBoxType.Error); MessageBox.Show(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace, Language.Text.ErrorWindowTitle, MessageBoxType.Error);
if (Directory.Exists(CrossPlatformOperations.CURRENTPATH + "/PatchData")) if (Directory.Exists(CrossPlatformOperations.CURRENTPATH + "/PatchData"))
HelperMethods.DeleteDirectory(CrossPlatformOperations.CURRENTPATH + "/PatchData"); HelperMethods.DeleteDirectory(CrossPlatformOperations.CURRENTPATH + "/PatchData");
@ -218,7 +218,7 @@ namespace AM2RLauncher
} }
catch (Exception ex) // This is if somehow any other exception might get thrown as well. catch (Exception ex) // This is if somehow any other exception might get thrown as well.
{ {
Log.Error(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace); log.Error(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace);
MessageBox.Show(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace, Language.Text.ErrorWindowTitle, MessageBoxType.Error); MessageBox.Show(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace, Language.Text.ErrorWindowTitle, MessageBoxType.Error);
if (Directory.Exists(CrossPlatformOperations.CURRENTPATH + " / PatchData")) if (Directory.Exists(CrossPlatformOperations.CURRENTPATH + " / PatchData"))
@ -226,7 +226,7 @@ namespace AM2RLauncher
successful = false; successful = false;
} }
Log.Info("Repository clone attempt finished " + (successful ? "successfully." : "unsuccessfully.")); log.Info("Repository clone attempt finished " + (successful ? "successfully." : "unsuccessfully."));
currentGitObject = 0; currentGitObject = 0;
@ -256,7 +256,7 @@ namespace AM2RLauncher
return; return;
else else
{ {
Log.Info("User cancelled download!"); log.Info("User cancelled download!");
isGitProcessGettingCancelled = true; isGitProcessGettingCancelled = true;
} }
// We don't need to delete any folders here, the cancelled gitClone will do that automatically for us :) // We don't need to delete any folders here, the cancelled gitClone will do that automatically for us :)
@ -270,7 +270,7 @@ namespace AM2RLauncher
#region Select11 #region Select11
case UpdateState.Select11: case UpdateState.Select11:
Log.Info("Requesting user input for AM2R_11.zip..."); log.Info("Requesting user input for AM2R_11.zip...");
OpenFileDialog fileFinder = new OpenFileDialog OpenFileDialog fileFinder = new OpenFileDialog
{ {
@ -283,7 +283,7 @@ namespace AM2RLauncher
if (fileFinder.ShowDialog(this) != DialogResult.Ok) if (fileFinder.ShowDialog(this) != DialogResult.Ok)
{ {
Log.Info("User cancelled the selection."); log.Info("User cancelled the selection.");
return; return;
} }
@ -292,14 +292,14 @@ namespace AM2RLauncher
if (Directory.Exists(fileFinder.FileName)) if (Directory.Exists(fileFinder.FileName))
{ {
// This can happen on linux, and maybe windows as well // This can happen on linux, and maybe windows as well
Log.Error("User selected a Directory. Cancelling import."); log.Error("User selected a Directory. Cancelling import.");
return; return;
} }
IsZipAM2R11ReturnCodes errorCode = Profile.CheckIfZipIsAM2R11(fileFinder.FileName); IsZipAM2R11ReturnCodes errorCode = Profile.CheckIfZipIsAM2R11(fileFinder.FileName);
if (errorCode != IsZipAM2R11ReturnCodes.Successful) if (errorCode != IsZipAM2R11ReturnCodes.Successful)
{ {
Log.Error("User tried to input invalid AM2R_11.zip file (" + errorCode + "). Cancelling import."); log.Error("User tried to input invalid AM2R_11.zip file (" + errorCode + "). Cancelling import.");
MessageBox.Show(Language.Text.ZipIsNotAM2R11 + "\n\nError Code: " + errorCode, Language.Text.ErrorWindowTitle, MessageBoxType.Error); MessageBox.Show(Language.Text.ZipIsNotAM2R11 + "\n\nError Code: " + errorCode, Language.Text.ErrorWindowTitle, MessageBoxType.Error);
return; return;
} }
@ -307,7 +307,7 @@ namespace AM2RLauncher
// If either a directory was selected or the file somehow went missing, cancel // If either a directory was selected or the file somehow went missing, cancel
if (!File.Exists(fileFinder.FileName)) if (!File.Exists(fileFinder.FileName))
{ {
Log.Error("Selected AM2R_11.zip file not found! Cancelling import."); log.Error("Selected AM2R_11.zip file not found! Cancelling import.");
break; break;
} }
@ -315,11 +315,11 @@ namespace AM2RLauncher
if (!File.Exists(CrossPlatformOperations.CURRENTPATH + "/AM2R_11.zip")) if (!File.Exists(CrossPlatformOperations.CURRENTPATH + "/AM2R_11.zip"))
File.Copy(fileFinder.FileName, CrossPlatformOperations.CURRENTPATH + "/AM2R_11.zip"); File.Copy(fileFinder.FileName, CrossPlatformOperations.CURRENTPATH + "/AM2R_11.zip");
Log.Info("AM2R_11.zip successfully imported."); log.Info("AM2R_11.zip successfully imported.");
} }
else else
{ {
Log.Error("User did not supply valid input. Cancelling import."); log.Error("User did not supply valid input. Cancelling import.");
} }
UpdateStateMachine(); UpdateStateMachine();
@ -346,7 +346,7 @@ namespace AM2RLauncher
SetPlayButtonState(UpdateState.Install); SetPlayButtonState(UpdateState.Install);
UpdateStateMachine(); UpdateStateMachine();
Log.Error("Xdelta not found. Aborting installing a profile..."); log.Error("Xdelta not found. Aborting installing a profile...");
break; break;
} }
var progressIndicator = new Progress<int>(UpdateProgressBar); var progressIndicator = new Progress<int>(UpdateProgressBar);
@ -358,7 +358,7 @@ namespace AM2RLauncher
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace); log.Error(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace);
MessageBox.Show(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace, Language.Text.ErrorWindowTitle, MessageBoxType.Error); MessageBox.Show(ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace, Language.Text.ErrorWindowTitle, MessageBoxType.Error);
} }
progressBar.Visible = false; progressBar.Visible = false;
@ -457,7 +457,7 @@ namespace AM2RLauncher
MessageBox.Show(Language.Text.JavaNotFound, Language.Text.WarningWindowTitle, MessageBoxButtons.OK); MessageBox.Show(Language.Text.JavaNotFound, Language.Text.WarningWindowTitle, MessageBoxButtons.OK);
SetApkButtonState(ApkButtonState.Create); SetApkButtonState(ApkButtonState.Create);
UpdateStateMachine(); UpdateStateMachine();
Log.Error("Java not found! Aborting Android APK creation."); log.Error("Java not found! Aborting Android APK creation.");
return; return;
} }
// Check if xdelta is installed on linux // Check if xdelta is installed on linux
@ -466,7 +466,7 @@ namespace AM2RLauncher
MessageBox.Show(Language.Text.XdeltaNotFound, Language.Text.WarningWindowTitle, MessageBoxButtons.OK); MessageBox.Show(Language.Text.XdeltaNotFound, Language.Text.WarningWindowTitle, MessageBoxButtons.OK);
SetApkButtonState(ApkButtonState.Create); SetApkButtonState(ApkButtonState.Create);
UpdateStateMachine(); UpdateStateMachine();
Log.Error("Xdelta not found. Aborting Android APK creation..."); log.Error("Xdelta not found. Aborting Android APK creation...");
return; return;
} }
@ -535,7 +535,7 @@ namespace AM2RLauncher
/// </summary> /// </summary>
private void AddModButtonClicked(object sender, EventArgs e) private void AddModButtonClicked(object sender, EventArgs e)
{ {
Log.Info("User requested to add mod. Requesting user input for new mod .zip..."); log.Info("User requested to add mod. Requesting user input for new mod .zip...");
ProfileXML addedProfile; ProfileXML addedProfile;
@ -550,18 +550,18 @@ namespace AM2RLauncher
if (fileFinder.ShowDialog(this) != DialogResult.Ok) if (fileFinder.ShowDialog(this) != DialogResult.Ok)
{ {
Log.Info("User cancelled the Mod selection."); log.Info("User cancelled the Mod selection.");
return; return;
} }
if (!String.IsNullOrWhiteSpace(fileFinder.FileName)) // This is default if (!String.IsNullOrWhiteSpace(fileFinder.FileName)) // This is default
{ {
Log.Info("User selected \"" + fileFinder.FileName + "\""); log.Info("User selected \"" + fileFinder.FileName + "\"");
// If either a directory was selected or the file somehow went missing, cancel // If either a directory was selected or the file somehow went missing, cancel
if (!File.Exists(fileFinder.FileName)) if (!File.Exists(fileFinder.FileName))
{ {
Log.Error("Selected mod .zip file not found! Cancelling import."); log.Error("Selected mod .zip file not found! Cancelling import.");
return; return;
} }
@ -576,19 +576,19 @@ namespace AM2RLauncher
if (Directory.Exists(modsDir + "/" + extractedName)) if (Directory.Exists(modsDir + "/" + extractedName))
{ {
ProfileXML profile2 = Serializer.Deserialize<ProfileXML>(File.ReadAllText(modsDir + "/" + extractedName + "/profile.xml")); ProfileXML profile2 = Serializer.Deserialize<ProfileXML>(File.ReadAllText(modsDir + "/" + extractedName + "/profile.xml"));
Log.Error("Mod is already imported as " + extractedName + "! Cancelling mod import."); log.Error("Mod is already imported as " + extractedName + "! Cancelling mod import.");
MessageBox.Show(Language.Text.ModIsAlreadyInstalledMessage.Replace("$NAME", profile2.Name), Language.Text.WarningWindowTitle, MessageBoxType.Warning); MessageBox.Show(Language.Text.ModIsAlreadyInstalledMessage.Replace("$NAME", profile2.Name), Language.Text.WarningWindowTitle, MessageBoxType.Warning);
return; return;
} }
// Directory doesn't exist -> extract! // Directory doesn't exist -> extract!
ZipFile.ExtractToDirectory(fileFinder.FileName, modsDir + "/" + extractedName); ZipFile.ExtractToDirectory(fileFinder.FileName, modsDir + "/" + extractedName);
Log.Info("Imported and extracted mod .zip as " + extractedName); log.Info("Imported and extracted mod .zip as " + extractedName);
// Let's check if profile.xml exists in there! If it doesn't throw an error and cleanup // Let's check if profile.xml exists in there! If it doesn't throw an error and cleanup
if (!File.Exists(modsDir + "/" + extractedName + "/profile.xml")) if (!File.Exists(modsDir + "/" + extractedName + "/profile.xml"))
{ {
Log.Error(fileFinder.FileName + " does not contain profile.xml! Cancelling mod import."); log.Error(fileFinder.FileName + " does not contain profile.xml! Cancelling mod import.");
MessageBox.Show(Language.Text.ModIsInvalidMessage.Replace("$NAME", extractedName), Language.Text.ErrorWindowTitle, MessageBoxType.Error); MessageBox.Show(Language.Text.ModIsInvalidMessage.Replace("$NAME", extractedName), Language.Text.ErrorWindowTitle, MessageBoxType.Error);
Directory.Delete(modsDir + "/" + extractedName, true); Directory.Delete(modsDir + "/" + extractedName, true);
@ -601,7 +601,7 @@ namespace AM2RLauncher
// Check if the OS versions match // Check if the OS versions match
if (OS.Name != profile.OperatingSystem) if (OS.Name != profile.OperatingSystem)
{ {
Log.Error("Mod is for " + profile.OperatingSystem + " while current OS is " + OS.Name + ". Cancelling mod import."); log.Error("Mod is for " + profile.OperatingSystem + " while current OS is " + OS.Name + ". Cancelling mod import.");
MessageBox.Show(Language.Text.ModIsForWrongOS.Replace("$NAME", profile.Name).Replace("$OS", profile.OperatingSystem).Replace("$CURRENTOS", OS.Name), MessageBox.Show(Language.Text.ModIsForWrongOS.Replace("$NAME", profile.Name).Replace("$OS", profile.OperatingSystem).Replace("$CURRENTOS", OS.Name),
Language.Text.ErrorWindowTitle, MessageBoxType.Error); Language.Text.ErrorWindowTitle, MessageBoxType.Error);
@ -612,20 +612,20 @@ namespace AM2RLauncher
// Check by *name*, if the mod was installed already // Check by *name*, if the mod was installed already
if (profileList.FirstOrDefault(p => p.Name == profile.Name) != null || Directory.Exists(CrossPlatformOperations.CURRENTPATH + "/Profiles/" + profile.Name)) if (profileList.FirstOrDefault(p => p.Name == profile.Name) != null || Directory.Exists(CrossPlatformOperations.CURRENTPATH + "/Profiles/" + profile.Name))
{ {
Log.Error(profile.Name + " is already installed."); log.Error(profile.Name + " is already installed.");
MessageBox.Show(Language.Text.ModIsAlreadyInstalledMessage.Replace("$NAME", profile.Name), Language.Text.WarningWindowTitle, MessageBoxType.Warning); MessageBox.Show(Language.Text.ModIsAlreadyInstalledMessage.Replace("$NAME", profile.Name), Language.Text.WarningWindowTitle, MessageBoxType.Warning);
HelperMethods.DeleteDirectory(modsDir + "/" + extractedName); HelperMethods.DeleteDirectory(modsDir + "/" + extractedName);
return; return;
} }
addedProfile = profile; addedProfile = profile;
Log.Info(profile.Name + " successfully installed."); log.Info(profile.Name + " successfully installed.");
MessageBox.Show(Language.Text.ModSuccessfullyInstalledMessage.Replace("$NAME", profile.Name), Language.Text.SuccessWindowTitle); MessageBox.Show(Language.Text.ModSuccessfullyInstalledMessage.Replace("$NAME", profile.Name), Language.Text.SuccessWindowTitle);
} }
else else
{ {
Log.Error("User did not supply valid input. Cancelling import."); log.Error("User did not supply valid input. Cancelling import.");
LoadProfiles(); LoadProfiles();
return; return;
} }
@ -643,7 +643,7 @@ namespace AM2RLauncher
{ {
if (!IsProfileIndexValid()) if (!IsProfileIndexValid())
return; return;
Log.Info("User opened the profile directory for profile " + profileList[settingsProfileDropDown.SelectedIndex].Name + log.Info("User opened the profile directory for profile " + profileList[settingsProfileDropDown.SelectedIndex].Name +
", which is " + profileList[settingsProfileDropDown.SelectedIndex].SaveLocation); ", which is " + profileList[settingsProfileDropDown.SelectedIndex].SaveLocation);
CrossPlatformOperations.OpenFolder(CrossPlatformOperations.CURRENTPATH + "/Profiles/" + profileList[settingsProfileDropDown.SelectedIndex].Name); CrossPlatformOperations.OpenFolder(CrossPlatformOperations.CURRENTPATH + "/Profiles/" + profileList[settingsProfileDropDown.SelectedIndex].Name);
} }
@ -655,7 +655,7 @@ namespace AM2RLauncher
{ {
if (IsProfileIndexValid()) if (IsProfileIndexValid())
{ {
Log.Info("User opened the save directory for profile " + profileList[settingsProfileDropDown.SelectedIndex].Name + ", which is " + profileList[settingsProfileDropDown.SelectedIndex].SaveLocation); log.Info("User opened the save directory for profile " + profileList[settingsProfileDropDown.SelectedIndex].Name + ", which is " + profileList[settingsProfileDropDown.SelectedIndex].SaveLocation);
CrossPlatformOperations.OpenFolder(profileList[settingsProfileDropDown.SelectedIndex].SaveLocation); CrossPlatformOperations.OpenFolder(profileList[settingsProfileDropDown.SelectedIndex].SaveLocation);
} }
} }
@ -667,7 +667,7 @@ namespace AM2RLauncher
{ {
if (settingsProfileDropDown.SelectedIndex == -1 && settingsProfileDropDown.Items.Count == 0) return; if (settingsProfileDropDown.SelectedIndex == -1 && settingsProfileDropDown.Items.Count == 0) return;
Log.Info("SettingsProfileDropDown.SelectedIndex has been changed to " + settingsProfileDropDown.SelectedIndex + "."); log.Info("SettingsProfileDropDown.SelectedIndex has been changed to " + settingsProfileDropDown.SelectedIndex + ".");
if (settingsProfileDropDown.SelectedIndex <= 0 || settingsProfileDropDown.Items.Count == 0) if (settingsProfileDropDown.SelectedIndex <= 0 || settingsProfileDropDown.Items.Count == 0)
{ {
deleteModButton.Enabled = false; deleteModButton.Enabled = false;
@ -749,7 +749,7 @@ namespace AM2RLauncher
/// <summary>Gets called when <see cref="showButton"/> gets clicked and shows the <see cref="MainForm"/> and brings it to the front again.</summary> /// <summary>Gets called when <see cref="showButton"/> gets clicked and shows the <see cref="MainForm"/> and brings it to the front again.</summary>
private void ShowButtonClick(object sender, EventArgs e) private void ShowButtonClick(object sender, EventArgs e)
{ {
Log.Info("User has opened the launcher from system tray."); log.Info("User has opened the launcher from system tray.");
this.Show(); this.Show();
this.BringToFront(); this.BringToFront();
@ -758,14 +758,14 @@ namespace AM2RLauncher
/// <summary>Gets called when <see cref="hqMusicPCCheck"/> gets clicked and writes its new value to the config.</summary> /// <summary>Gets called when <see cref="hqMusicPCCheck"/> gets clicked and writes its new value to the config.</summary>
private void HqMusicPCCheckChanged(object sender, EventArgs e) private void HqMusicPCCheckChanged(object sender, EventArgs e)
{ {
Log.Info("PC HQ Music option has been changed to " + hqMusicPCCheck.Checked); log.Info("PC HQ Music option has been changed to " + hqMusicPCCheck.Checked);
CrossPlatformOperations.WriteToConfig("MusicHQPC", hqMusicPCCheck.Checked); CrossPlatformOperations.WriteToConfig("MusicHQPC", hqMusicPCCheck.Checked);
} }
/// <summary>Gets called when <see cref="hqMusicAndroidCheck"/> gets clicked and writes its new value to the config.</summary> /// <summary>Gets called when <see cref="hqMusicAndroidCheck"/> gets clicked and writes its new value to the config.</summary>
private void HqMusicAndroidCheckChanged(object sender, EventArgs e) private void HqMusicAndroidCheckChanged(object sender, EventArgs e)
{ {
Log.Info("Android HQ Music option has been changed to " + hqMusicAndroidCheck.Checked); log.Info("Android HQ Music option has been changed to " + hqMusicAndroidCheck.Checked);
CrossPlatformOperations.WriteToConfig("MusicHQAndroid", hqMusicAndroidCheck.Checked); CrossPlatformOperations.WriteToConfig("MusicHQAndroid", hqMusicAndroidCheck.Checked);
} }
@ -775,7 +775,7 @@ namespace AM2RLauncher
if (profileDropDown.SelectedIndex == -1 && profileDropDown.Items.Count == 0) return; if (profileDropDown.SelectedIndex == -1 && profileDropDown.Items.Count == 0) return;
profileIndex = profileDropDown.SelectedIndex; profileIndex = profileDropDown.SelectedIndex;
Log.Info("profileDropDown.SelectedIndex has been changed to " + profileIndex + "."); log.Info("profileDropDown.SelectedIndex has been changed to " + profileIndex + ".");
profileAuthorLabel.Text = Language.Text.Author + " " + profileList[profileDropDown.SelectedIndex].Author; profileAuthorLabel.Text = Language.Text.Author + " " + profileList[profileDropDown.SelectedIndex].Author;
profileVersionLabel.Text = Language.Text.VersionLabel + " " + profileList[profileDropDown.SelectedIndex].Version; profileVersionLabel.Text = Language.Text.VersionLabel + " " + profileList[profileDropDown.SelectedIndex].Version;
@ -794,21 +794,21 @@ namespace AM2RLauncher
/// <summary>Gets called when user selects a different item from <see cref="languageDropDown"/> and writes that to the config.</summary> /// <summary>Gets called when user selects a different item from <see cref="languageDropDown"/> and writes that to the config.</summary>
private void LanguageDropDownSelectedIndexChanged(object sender, EventArgs e) private void LanguageDropDownSelectedIndexChanged(object sender, EventArgs e)
{ {
Log.Info("languageDropDown.SelectedIndex has been changed to " + languageDropDown.SelectedIndex + "."); log.Info("languageDropDown.SelectedIndex has been changed to " + languageDropDown.SelectedIndex + ".");
CrossPlatformOperations.WriteToConfig("Language", languageDropDown.SelectedIndex == 0 ? "Default" : languageDropDown.Items[languageDropDown.SelectedIndex].Text); CrossPlatformOperations.WriteToConfig("Language", languageDropDown.SelectedIndex == 0 ? "Default" : languageDropDown.Items[languageDropDown.SelectedIndex].Text);
} }
/// <summary>Gets called when <see cref="autoUpdateAM2RCheck"/> gets clicked and writes its new value to the config.</summary> /// <summary>Gets called when <see cref="autoUpdateAM2RCheck"/> gets clicked and writes its new value to the config.</summary>
private void AutoUpdateAM2RCheckChanged(object sender, EventArgs e) private void AutoUpdateAM2RCheckChanged(object sender, EventArgs e)
{ {
Log.Info("Auto Update AM2R has been set to " + autoUpdateAM2RCheck.Checked + "."); log.Info("Auto Update AM2R has been set to " + autoUpdateAM2RCheck.Checked + ".");
CrossPlatformOperations.WriteToConfig("AutoUpdateAM2R", (bool)autoUpdateAM2RCheck.Checked); CrossPlatformOperations.WriteToConfig("AutoUpdateAM2R", (bool)autoUpdateAM2RCheck.Checked);
} }
/// <summary>Gets called when <see cref="autoUpdateLauncherCheck"/> gets clicked and writes its new value to the config.</summary> /// <summary>Gets called when <see cref="autoUpdateLauncherCheck"/> gets clicked and writes its new value to the config.</summary>
private void AutoUpdateLauncherCheckChanged(object sender, EventArgs e) private void AutoUpdateLauncherCheckChanged(object sender, EventArgs e)
{ {
Log.Info("Auto Update Launcher has been set to " + autoUpdateAM2RCheck.Checked + "."); log.Info("Auto Update Launcher has been set to " + autoUpdateAM2RCheck.Checked + ".");
CrossPlatformOperations.WriteToConfig("AutoUpdateLauncher", (bool)autoUpdateAM2RCheck.Checked); CrossPlatformOperations.WriteToConfig("AutoUpdateLauncher", (bool)autoUpdateAM2RCheck.Checked);
} }
@ -816,7 +816,7 @@ namespace AM2RLauncher
/// and enables <see cref="customMirrorTextBox"/> accordingly.</summary> /// and enables <see cref="customMirrorTextBox"/> accordingly.</summary>
private void CustomMirrorCheckChanged(object sender, EventArgs e) private void CustomMirrorCheckChanged(object sender, EventArgs e)
{ {
Log.Info("Use Custom Mirror option has been set to " + customMirrorCheck.Checked + "."); log.Info("Use Custom Mirror option has been set to " + customMirrorCheck.Checked + ".");
CrossPlatformOperations.WriteToConfig("CustomMirrorEnabled", (bool)customMirrorCheck.Checked); CrossPlatformOperations.WriteToConfig("CustomMirrorEnabled", (bool)customMirrorCheck.Checked);
bool enabled = (bool)customMirrorCheck.Checked; bool enabled = (bool)customMirrorCheck.Checked;
@ -847,14 +847,14 @@ namespace AM2RLauncher
{ {
currentMirror = mirrorList[mirrorDropDown.SelectedIndex]; currentMirror = mirrorList[mirrorDropDown.SelectedIndex];
Log.Info("Current mirror has been set to " + currentMirror + "."); log.Info("Current mirror has been set to " + currentMirror + ".");
CrossPlatformOperations.WriteToConfig("MirrorIndex", mirrorDropDown.SelectedIndex); CrossPlatformOperations.WriteToConfig("MirrorIndex", mirrorDropDown.SelectedIndex);
// Don't overwrite the git config while we download!!! // Don't overwrite the git config while we download!!!
if (updateState == UpdateState.Downloading) return; if (updateState == UpdateState.Downloading) return;
Log.Info("Overwriting mirror in gitconfig."); log.Info("Overwriting mirror in gitconfig.");
// Check if the gitConfig exists, if yes regex the gitURL, and replace it with the new current Mirror. // Check if the gitConfig exists, if yes regex the gitURL, and replace it with the new current Mirror.
string gitConfigPath = CrossPlatformOperations.CURRENTPATH + "/PatchData/.git/config"; string gitConfigPath = CrossPlatformOperations.CURRENTPATH + "/PatchData/.git/config";
@ -871,7 +871,7 @@ namespace AM2RLauncher
/// </summary> /// </summary>
private void ProfileDebugLogCheckedChanged(object sender, EventArgs e) private void ProfileDebugLogCheckedChanged(object sender, EventArgs e)
{ {
Log.Info("Create Game Debug Logs option has been set to " + profileDebugLogCheck.Checked + "."); log.Info("Create Game Debug Logs option has been set to " + profileDebugLogCheck.Checked + ".");
CrossPlatformOperations.WriteToConfig("ProfileDebugLog", profileDebugLogCheck.Checked); CrossPlatformOperations.WriteToConfig("ProfileDebugLog", profileDebugLogCheck.Checked);
} }
@ -885,7 +885,7 @@ namespace AM2RLauncher
string mirrorText = customMirrorTextBox.Text; string mirrorText = customMirrorTextBox.Text;
if (!gitURLRegex.IsMatch(mirrorText)) if (!gitURLRegex.IsMatch(mirrorText))
{ {
Log.Info("User used " + mirrorText + " as a custom Mirror, didn't pass git validation test."); log.Info("User used " + mirrorText + " as a custom Mirror, didn't pass git validation test.");
MessageBox.Show(Language.Text.InvalidGitURL.Replace("$NAME", mirrorText), Language.Text.ErrorWindowTitle, MessageBoxType.Error); MessageBox.Show(Language.Text.InvalidGitURL.Replace("$NAME", mirrorText), Language.Text.ErrorWindowTitle, MessageBoxType.Error);
return; return;
} }
@ -893,7 +893,7 @@ namespace AM2RLauncher
currentMirror = mirrorText; currentMirror = mirrorText;
CrossPlatformOperations.WriteToConfig("CustomMirrorText", currentMirror); CrossPlatformOperations.WriteToConfig("CustomMirrorText", currentMirror);
Log.Info("Overwriting mirror in gitconfig."); log.Info("Overwriting mirror in gitconfig.");
// Check if the gitConfig exists, if yes regex the gitURL, and replace it with the new current Mirror. // Check if the gitConfig exists, if yes regex the gitURL, and replace it with the new current Mirror.
string gitConfigPath = CrossPlatformOperations.CURRENTPATH + "/PatchData/.git/config"; string gitConfigPath = CrossPlatformOperations.CURRENTPATH + "/PatchData/.git/config";
@ -903,7 +903,7 @@ namespace AM2RLauncher
gitConfig = gitConfig.Replace(match.Value, currentMirror); gitConfig = gitConfig.Replace(match.Value, currentMirror);
File.WriteAllText(gitConfigPath, gitConfig); File.WriteAllText(gitConfigPath, gitConfig);
Log.Info("Custom Mirror has been set to " + currentMirror + "."); log.Info("Custom Mirror has been set to " + currentMirror + ".");
} }
/// <summary> /// <summary>
@ -911,7 +911,7 @@ namespace AM2RLauncher
/// </summary> /// </summary>
private void CustomEnvVarTextBoxLostFocus(object sender, EventArgs e) private void CustomEnvVarTextBoxLostFocus(object sender, EventArgs e)
{ {
Log.Info("Custom Environment variables have been set to \"" + customEnvVarTextBox.Text + "\"."); log.Info("Custom Environment variables have been set to \"" + customEnvVarTextBox.Text + "\".");
CrossPlatformOperations.WriteToConfig("CustomEnvVar", customEnvVarTextBox.Text); CrossPlatformOperations.WriteToConfig("CustomEnvVar", customEnvVarTextBox.Text);
} }
@ -932,21 +932,21 @@ namespace AM2RLauncher
private void DeleteModButtonClicked(object sender, EventArgs e) private void DeleteModButtonClicked(object sender, EventArgs e)
{ {
ProfileXML profile = profileList[settingsProfileDropDown.SelectedIndex]; ProfileXML profile = profileList[settingsProfileDropDown.SelectedIndex];
Log.Info("User is attempting to delete profile " + profile.Name + "."); log.Info("User is attempting to delete profile " + profile.Name + ".");
DialogResult result = MessageBox.Show(Language.Text.DeleteModWarning.Replace("$NAME", profile.Name), Language.Text.WarningWindowTitle, DialogResult result = MessageBox.Show(Language.Text.DeleteModWarning.Replace("$NAME", profile.Name), Language.Text.WarningWindowTitle,
MessageBoxButtons.OKCancel, MessageBoxType.Warning, MessageBoxDefaultButton.Cancel); MessageBoxButtons.OKCancel, MessageBoxType.Warning, MessageBoxDefaultButton.Cancel);
if (result == DialogResult.Ok) if (result == DialogResult.Ok)
{ {
Log.Info("User did not cancel. Proceeding to delete " + profile); log.Info("User did not cancel. Proceeding to delete " + profile);
DeleteProfile(profile); DeleteProfile(profile);
Log.Info(profile + " has been deleted"); log.Info(profile + " has been deleted");
MessageBox.Show(Language.Text.DeleteModButtonSuccess.Replace("$NAME", profile.Name), Language.Text.SuccessWindowTitle); MessageBox.Show(Language.Text.DeleteModButtonSuccess.Replace("$NAME", profile.Name), Language.Text.SuccessWindowTitle);
} }
else else
{ {
Log.Info("User has cancelled profile deletion."); log.Info("User has cancelled profile deletion.");
} }
} }
@ -956,7 +956,7 @@ namespace AM2RLauncher
/// </summary> /// </summary>
private void UpdateModButtonClicked(object sender, EventArgs e) private void UpdateModButtonClicked(object sender, EventArgs e)
{ {
Log.Info("User requested to update mod. Requesting user input for new mod .zip..."); log.Info("User requested to update mod. Requesting user input for new mod .zip...");
bool abort = false; bool abort = false;
@ -973,18 +973,18 @@ namespace AM2RLauncher
if (fileFinder.ShowDialog(this) != DialogResult.Ok) if (fileFinder.ShowDialog(this) != DialogResult.Ok)
{ {
Log.Info("User cancelled the Mod selection."); log.Info("User cancelled the Mod selection.");
return; return;
} }
if (!String.IsNullOrWhiteSpace(fileFinder.FileName)) // This is default if (!String.IsNullOrWhiteSpace(fileFinder.FileName)) // This is default
{ {
Log.Info("User selected \"" + fileFinder.FileName + "\""); log.Info("User selected \"" + fileFinder.FileName + "\"");
// If either a directory was selected or the file somehow went missing, cancel // If either a directory was selected or the file somehow went missing, cancel
if (!File.Exists(fileFinder.FileName)) if (!File.Exists(fileFinder.FileName))
{ {
Log.Error("Selected mod .zip file not found! Cancelling mod update."); log.Error("Selected mod .zip file not found! Cancelling mod update.");
return; return;
} }
@ -1001,7 +1001,7 @@ namespace AM2RLauncher
// Let's check if profile.xml exists in there! If it doesn't throw an error and cleanup // Let's check if profile.xml exists in there! If it doesn't throw an error and cleanup
if (!File.Exists(modsDir + "/" + extractedName + "/profile.xml")) if (!File.Exists(modsDir + "/" + extractedName + "/profile.xml"))
{ {
Log.Error(fileFinder.FileName + " does not contain profile.xml! Cancelling mod update."); log.Error(fileFinder.FileName + " does not contain profile.xml! Cancelling mod update.");
MessageBox.Show(Language.Text.ModIsInvalidMessage.Replace("$NAME", extractedName), Language.Text.ErrorWindowTitle, MessageBoxType.Error); MessageBox.Show(Language.Text.ModIsInvalidMessage.Replace("$NAME", extractedName), Language.Text.ErrorWindowTitle, MessageBoxType.Error);
Directory.Delete(modsDir + "/" + extractedName, true); Directory.Delete(modsDir + "/" + extractedName, true);
File.Delete(CrossPlatformOperations.CURRENTPATH + "/Mods/" + modFile.Name); File.Delete(CrossPlatformOperations.CURRENTPATH + "/Mods/" + modFile.Name);
@ -1029,7 +1029,7 @@ namespace AM2RLauncher
} }
else // Cancel the operation! else // Cancel the operation!
{ {
Log.Error("User has cancelled mod update!"); log.Error("User has cancelled mod update!");
abort = true; abort = true;
} }
} }
@ -1037,7 +1037,7 @@ namespace AM2RLauncher
{ {
// Cancel the operation! // Cancel the operation!
// Show message to tell user that mod could not be found, install this separately // Show message to tell user that mod could not be found, install this separately
Log.Error("Mod is not installed! Cancelling mod update."); log.Error("Mod is not installed! Cancelling mod update.");
MessageBox.Show(Language.Text.UpdateModButtonWrongMod.Replace("$NAME", currentProfile.Name).Replace("$SELECT", profile.Name), MessageBox.Show(Language.Text.UpdateModButtonWrongMod.Replace("$NAME", currentProfile.Name).Replace("$SELECT", profile.Name),
Language.Text.WarningWindowTitle, MessageBoxButtons.OK); Language.Text.WarningWindowTitle, MessageBoxButtons.OK);
abort = true; abort = true;
@ -1051,7 +1051,7 @@ namespace AM2RLauncher
return; return;
} }
Log.Info("Successfully updated mod profile " + profile.Name + "."); log.Info("Successfully updated mod profile " + profile.Name + ".");
MessageBox.Show(Language.Text.ModSuccessfullyInstalledMessage.Replace("$NAME", currentProfile.Name), Language.Text.SuccessWindowTitle); MessageBox.Show(Language.Text.ModSuccessfullyInstalledMessage.Replace("$NAME", currentProfile.Name), Language.Text.SuccessWindowTitle);
UpdateStateMachine(); UpdateStateMachine();
} }
@ -1070,7 +1070,7 @@ namespace AM2RLauncher
/// </summary> /// </summary>
private void MainformClosing(object sender, CancelEventArgs e) private void MainformClosing(object sender, CancelEventArgs e)
{ {
Log.Info("Attempting to close MainForm!"); log.Info("Attempting to close MainForm!");
CrossPlatformOperations.WriteToConfig("Width", ClientSize.Width); CrossPlatformOperations.WriteToConfig("Width", ClientSize.Width);
CrossPlatformOperations.WriteToConfig("Height", ClientSize.Height); CrossPlatformOperations.WriteToConfig("Height", ClientSize.Height);
@ -1101,9 +1101,9 @@ namespace AM2RLauncher
trayIndicator.Visible = false; trayIndicator.Visible = false;
if (e.Cancel) if (e.Cancel)
Log.Info("Cancelled MainForm closing event during UpdateState." + updateState + "."); log.Info("Cancelled MainForm closing event during UpdateState." + updateState + ".");
else else
Log.Info("Successfully closed MainForm. Exiting main thread."); log.Info("Successfully closed MainForm. Exiting main thread.");
} }
} }

@ -273,7 +273,7 @@ namespace AM2RLauncher
/// </summary> /// </summary>
private void DeleteProfile(ProfileXML profile, bool reloadProfileList = true) private void DeleteProfile(ProfileXML profile, bool reloadProfileList = true)
{ {
Log.Info("Attempting to delete profile " + profile.Name + "..."); log.Info("Attempting to delete profile " + profile.Name + "...");
// Delete folder in Mods // Delete folder in Mods
if (Directory.Exists(CrossPlatformOperations.CURRENTPATH + profile.DataPath)) if (Directory.Exists(CrossPlatformOperations.CURRENTPATH + profile.DataPath))
@ -297,7 +297,7 @@ namespace AM2RLauncher
if (reloadProfileList) if (reloadProfileList)
LoadProfiles(); LoadProfiles();
Log.Info("Successfully deleted profile " + profile.Name + "."); log.Info("Successfully deleted profile " + profile.Name + ".");
} }
/// <summary> /// <summary>
@ -306,7 +306,7 @@ namespace AM2RLauncher
//TODO: Seperate this (and by extension, deleteProfile) from UI and backend //TODO: Seperate this (and by extension, deleteProfile) from UI and backend
private void LoadProfiles() private void LoadProfiles()
{ {
Log.Info("Loading profiles..."); log.Info("Loading profiles...");
// Reset loaded profiles // Reset loaded profiles
profileDropDown.Items.Clear(); profileDropDown.Items.Clear();
@ -383,7 +383,7 @@ namespace AM2RLauncher
settingsProfileDropDown.Items.AddRange(profileDropDown.Items); settingsProfileDropDown.Items.AddRange(profileDropDown.Items);
settingsProfileDropDown.SelectedIndex = profileDropDown.Items.Count != 0 ? 0 : -1; settingsProfileDropDown.SelectedIndex = profileDropDown.Items.Count != 0 ? 0 : -1;
Log.Info("Loaded " + profileList.Count + " profile(s)."); log.Info("Loaded " + profileList.Count + " profile(s).");
// Refresh the author and version label on the main tab // Refresh the author and version label on the main tab
if (profileList.Count > 0) if (profileList.Count > 0)

@ -24,7 +24,7 @@ namespace AM2RLauncher
/// <summary> /// <summary>
/// Our log object, that handles logging the current execution to a file. /// Our log object, that handles logging the current execution to a file.
/// </summary> /// </summary>
private static readonly ILog Log = LogManager.GetLogger(typeof(MainForm)); private static readonly ILog log = LogManager.GetLogger(typeof(MainForm));
/// <summary> /// <summary>
/// The current Launcher version. /// The current Launcher version.
@ -89,7 +89,7 @@ namespace AM2RLauncher
// This mutex needs to CONTINUE existing for the entire application's lifetime, or else the rest of this won't ever work! // This mutex needs to CONTINUE existing for the entire application's lifetime, or else the rest of this won't ever work!
// We're basically using it to key a thread and scan for other instances of that tag. // We're basically using it to key a thread and scan for other instances of that tag.
Mutex mutex = new Mutex(true, "AM2RLauncher", out singleInstance); private Mutex mutex = new Mutex(true, "AM2RLauncher", out singleInstance);
public MainForm() public MainForm()
{ {
@ -112,27 +112,27 @@ namespace AM2RLauncher
Environment.Exit(0); Environment.Exit(0);
} }
Log.Info("Mutex check passed. Entering main thread."); log.Info("Mutex check passed. Entering main thread.");
Log.Info("Current Launcher Version: " + VERSION); log.Info("Current Launcher Version: " + VERSION);
Log.Info("Current Platform-ID is: " + Platform.ID); log.Info("Current Platform-ID is: " + Platform.ID);
Log.Info("Current OS is: " + OS.Name); log.Info("Current OS is: " + OS.Name);
// Set the Current Directory to the path the Launcher is located. Fixes some relative path issues. // Set the Current Directory to the path the Launcher is located. Fixes some relative path issues.
Environment.CurrentDirectory = CrossPlatformOperations.CURRENTPATH; Environment.CurrentDirectory = CrossPlatformOperations.CURRENTPATH;
Log.Info("Set Launcher CWD to " + Environment.CurrentDirectory); log.Info("Set Launcher CWD to " + Environment.CurrentDirectory);
// But log actual folder location nonetheless // But log actual folder location nonetheless
Log.Info("Actual Launcher location: " + Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory)); log.Info("Actual Launcher location: " + Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory));
// Set the language to what User wanted or choose local language // Set the language to what User wanted or choose local language
string userLanguage = CrossPlatformOperations.ReadFromConfig("Language").ToLower(); string userLanguage = CrossPlatformOperations.ReadFromConfig("Language").ToLower();
if (!userLanguage.Equals("default")) if (!userLanguage.Equals("default"))
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultures(CultureTypes.AllCultures).First(c => c.NativeName.ToLower().Contains(userLanguage)); Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultures(CultureTypes.AllCultures).First(c => c.NativeName.ToLower().Contains(userLanguage));
Log.Info("Language has been set to: " + Thread.CurrentThread.CurrentUICulture.EnglishName); log.Info("Language has been set to: " + Thread.CurrentThread.CurrentUICulture.EnglishName);
#region VARIABLE INITIALIZATION #region VARIABLE INITIALIZATION
Log.Info("Beginning UI initialization..."); log.Info("Beginning UI initialization...");
// System tray indicator // System tray indicator
showButton = new ButtonMenuItem { Text = Language.Text.TrayButtonShow }; showButton = new ButtonMenuItem { Text = Language.Text.TrayButtonShow };
@ -159,7 +159,7 @@ namespace AM2RLauncher
// Custom splash texts // Custom splash texts
string splash = Splash.GetSplash(); string splash = Splash.GetSplash();
Log.Info("Randomly chosen splash: " + splash); log.Info("Randomly chosen splash: " + splash);
// Load bitmaps // Load bitmaps
redditIcon = new Bitmap(AM2RLauncher.Properties.Resources.redditIcon48); redditIcon = new Bitmap(AM2RLauncher.Properties.Resources.redditIcon48);
@ -205,7 +205,7 @@ namespace AM2RLauncher
ClientSize = new Size(500, ClientSize.Height); ClientSize = new Size(500, ClientSize.Height);
if (ClientSize.Height < 400) if (ClientSize.Height < 400)
ClientSize = new Size(ClientSize.Width, 400); ClientSize = new Size(ClientSize.Width, 400);
Log.Info("Start the launcher with Size: " + ClientSize.Width + ", " + ClientSize.Height); log.Info("Start the launcher with Size: " + ClientSize.Width + ", " + ClientSize.Height);
if (Boolean.Parse(CrossPlatformOperations.ReadFromConfig("IsMaximized"))) Maximize(); if (Boolean.Parse(CrossPlatformOperations.ReadFromConfig("IsMaximized"))) Maximize();
drawable = new Drawable { BackgroundColor = colBGNoAlpha }; drawable = new Drawable { BackgroundColor = colBGNoAlpha };
@ -518,7 +518,7 @@ namespace AM2RLauncher
if (languageDropDown.SelectedIndex == -1) if (languageDropDown.SelectedIndex == -1)
{ {
Log.Info("User has tried to use " + tmpLanguage + " as a Language, but it was not found. Reverting to System Language"); log.Info("User has tried to use " + tmpLanguage + " as a Language, but it was not found. Reverting to System Language");
languageDropDown.SelectedIndex = 0; languageDropDown.SelectedIndex = 0;
} }
@ -771,8 +771,8 @@ namespace AM2RLauncher
}; };
#region EVENTS #region EVENTS
Log.Info("All UI objects have been initialized, UI has been set up."); log.Info("All UI objects have been initialized, UI has been set up.");
Log.Info("Beginning event linkage..."); log.Info("Beginning event linkage...");
Closing += MainformClosing; Closing += MainformClosing;
showButton.Click += ShowButtonClick; showButton.Click += ShowButtonClick;
@ -806,7 +806,7 @@ namespace AM2RLauncher
newsWebView.DocumentLoaded += NewsWebViewDocumentLoaded; newsWebView.DocumentLoaded += NewsWebViewDocumentLoaded;
changelogWebView.DocumentLoaded += ChangelogWebViewDocumentLoaded; changelogWebView.DocumentLoaded += ChangelogWebViewDocumentLoaded;
Log.Info("Events linked successfully."); log.Info("Events linked successfully.");
#endregion #endregion
} }

Loading…
Cancel
Save