From 10e77406ae0ef056ebe386cb84c8fb410d1b0bf2 Mon Sep 17 00:00:00 2001 From: Miepee <38186597+Miepee@users.noreply.github.com> Date: Sat, 21 May 2022 20:14:22 +0200 Subject: [PATCH] rename AM2RLauncher.Core to AM2RLauncherLib --- AM2RLauncher/AM2RLauncher.Gtk/Program.cs | 2 +- AM2RLauncher/AM2RLauncher.Mac/Program.cs | 2 +- AM2RLauncher/AM2RLauncher.Wpf/Program.cs | 4 +- AM2RLauncher/AM2RLauncher.sln | 2 +- AM2RLauncher/AM2RLauncher/AM2RLauncher.csproj | 2 +- AM2RLauncher/AM2RLauncher/LauncherUpdater.cs | 4 +- .../AM2RLauncher/MainForm/MainForm.Events.cs | 38 +++++++++---------- .../AM2RLauncher/MainForm/MainForm.Methods.cs | 4 +- .../MainForm/MainForm.StateMachine.cs | 4 +- .../AM2RLauncher/MainForm/MainForm.UI.cs | 12 +++--- ...her.Core.csproj => AM2RLauncherLib.csproj} | 0 AM2RLauncher/AM2RLauncherCore/Core.cs | 6 +-- .../CrossPlatformOperations.cs | 2 +- .../AM2RLauncherCore/HelperMethods.cs | 2 +- AM2RLauncher/AM2RLauncherCore/OS.cs | 2 +- AM2RLauncher/AM2RLauncherCore/Profile.cs | 6 +-- AM2RLauncher/AM2RLauncherCore/Splash.cs | 2 +- .../AM2RLauncherCore/XML/ProfileXML.cs | 2 +- .../AM2RLauncherCore/XML/Serializer.cs | 2 +- 19 files changed, 48 insertions(+), 50 deletions(-) rename AM2RLauncher/AM2RLauncherCore/{AM2RLauncher.Core.csproj => AM2RLauncherLib.csproj} (100%) diff --git a/AM2RLauncher/AM2RLauncher.Gtk/Program.cs b/AM2RLauncher/AM2RLauncher.Gtk/Program.cs index 469503c..f07b948 100644 --- a/AM2RLauncher/AM2RLauncher.Gtk/Program.cs +++ b/AM2RLauncher/AM2RLauncher.Gtk/Program.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; -using AM2RLauncher.Core; +using AM2RLauncherLib; using log4net.Repository.Hierarchy; using Application = Eto.Forms.Application; using FileInfo = System.IO.FileInfo; diff --git a/AM2RLauncher/AM2RLauncher.Mac/Program.cs b/AM2RLauncher/AM2RLauncher.Mac/Program.cs index 976037c..e8799e6 100644 --- a/AM2RLauncher/AM2RLauncher.Mac/Program.cs +++ b/AM2RLauncher/AM2RLauncher.Mac/Program.cs @@ -3,7 +3,7 @@ using log4net; using log4net.Config; using System; using System.IO; -using AM2RLauncher.Core; +using AM2RLauncherLib; using log4net.Repository.Hierarchy; // ReSharper disable LocalizableElement - we want hardcoded strings for console writes. diff --git a/AM2RLauncher/AM2RLauncher.Wpf/Program.cs b/AM2RLauncher/AM2RLauncher.Wpf/Program.cs index f6d8305..208e4cc 100644 --- a/AM2RLauncher/AM2RLauncher.Wpf/Program.cs +++ b/AM2RLauncher/AM2RLauncher.Wpf/Program.cs @@ -3,7 +3,7 @@ using log4net; using log4net.Config; using System; using System.IO; -using AM2RLauncher.Core; +using AM2RLauncherLib; using log4net.Repository.Hierarchy; // ReSharper disable LocalizableElement - we want hardcoded strings for console writes. @@ -43,7 +43,7 @@ internal static class MainClass #endif //Log Wine - if (Core.Core.IsThisRunningFromWine) + if (AM2RLauncherLib.Core.IsThisRunningFromWine) log.Info("Currently running from WINE!"); // Try catch in case it ever crashes before actually getting to the Eto application diff --git a/AM2RLauncher/AM2RLauncher.sln b/AM2RLauncher/AM2RLauncher.sln index 656931e..f36ede4 100644 --- a/AM2RLauncher/AM2RLauncher.sln +++ b/AM2RLauncher/AM2RLauncher.sln @@ -5,7 +5,7 @@ VisualStudioVersion = 17.0.31912.275 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AM2RLauncher", "AM2RLauncher\AM2RLauncher.csproj", "{9B67055C-5AEF-4F83-AFE0-38E600183C9F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AM2RLauncher.Core", "AM2RLauncherCore\AM2RLauncher.Core.csproj", "{B3AAD6F3-41B9-4981-8CD4-FE683429AD95}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AM2RLauncherLib", "AM2RLauncherCore\AM2RLauncherLib.csproj", "{B3AAD6F3-41B9-4981-8CD4-FE683429AD95}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AM2RLauncher.Gtk", "AM2RLauncher.Gtk\AM2RLauncher.Gtk.csproj", "{0A619FA8-61B4-48C6-9461-21B3FE137D03}" EndProject diff --git a/AM2RLauncher/AM2RLauncher/AM2RLauncher.csproj b/AM2RLauncher/AM2RLauncher/AM2RLauncher.csproj index ed4776e..4a0e502 100644 --- a/AM2RLauncher/AM2RLauncher/AM2RLauncher.csproj +++ b/AM2RLauncher/AM2RLauncher/AM2RLauncher.csproj @@ -35,7 +35,7 @@ - + diff --git a/AM2RLauncher/AM2RLauncher/LauncherUpdater.cs b/AM2RLauncher/AM2RLauncher/LauncherUpdater.cs index eda4c10..fbf54f4 100644 --- a/AM2RLauncher/AM2RLauncher/LauncherUpdater.cs +++ b/AM2RLauncher/AM2RLauncher/LauncherUpdater.cs @@ -1,4 +1,4 @@ -using AM2RLauncher.Core; +using AM2RLauncherLib; using AM2RLauncher; using Eto.Forms; using log4net; @@ -19,7 +19,7 @@ namespace AM2RLauncher // Auto updating is fun! /// The Version that identifies this current release. - public const string VERSION = Core.Core.Version; + public const string VERSION = AM2RLauncherLib.Core.Version; /// The Path of the oldConfig. Only gets used Windows-only private static readonly string oldConfigPath = CrossPlatformOperations.CurrentPath + "/" + CrossPlatformOperations.LauncherName + ".oldCfg"; diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs index c912167..3de164d 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs @@ -1,5 +1,5 @@ -using AM2RLauncher.Core; -using AM2RLauncher.Core.XML; +using AM2RLauncherLib; +using AM2RLauncherLib.XML; using AM2RLauncher.Language; using Eto.Forms; using LibGit2Sharp; @@ -158,7 +158,7 @@ namespace AM2RLauncher // TODO: why do we delete patchdata if user cancels pulling? log.Info(ex.Message); MessageBox.Show(this, Text.CorruptPatchData, Text.ErrorWindowTitle, MessageBoxType.Error); - HelperMethods.DeleteDirectory(Core.Core.PatchDataPath); + HelperMethods.DeleteDirectory(AM2RLauncherLib.Core.PatchDataPath); } // This is for any exceptions from libgit catch (LibGit2SharpException ex) @@ -202,7 +202,7 @@ namespace AM2RLauncher // Also, add a non-installable profile for it so people can access the older version or delete it from the mod manager. if ((profileList.Count > 0) && Profile.IsProfileInstalled(profileList[0])) { - ProfileXML installedUpdatesProfile = Serializer.Deserialize(File.ReadAllText(Core.Core.ProfilesPath + "/Community Updates (Latest)/profile.xml")); + ProfileXML installedUpdatesProfile = Serializer.Deserialize(File.ReadAllText(AM2RLauncherLib.Core.ProfilesPath + "/Community Updates (Latest)/profile.xml")); if (installedUpdatesProfile.Version != profileList[0].Version) { @@ -247,14 +247,14 @@ namespace AM2RLauncher try { // Cleanup invalid PatchData directory if it exists - if (Directory.Exists(Core.Core.PatchDataPath)) + if (Directory.Exists(AM2RLauncherLib.Core.PatchDataPath)) { log.Info("PatchData directory already exists, cleaning up..."); - HelperMethods.DeleteDirectory(Core.Core.PatchDataPath); + HelperMethods.DeleteDirectory(AM2RLauncherLib.Core.PatchDataPath); } // Separate thread so launcher doesn't get locked - await Task.Run(() => Repository.Clone(currentMirror, Core.Core.PatchDataPath, cloneOptions)); + await Task.Run(() => Repository.Clone(currentMirror, AM2RLauncherLib.Core.PatchDataPath, cloneOptions)); } // We deliberately cancelled this, so no error handling catch (UserCancelledException) @@ -276,8 +276,8 @@ namespace AM2RLauncher { log.Error("LibGit2SharpException: " + ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace); MessageBox.Show(this, ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace, Text.ErrorWindowTitle, MessageBoxType.Error); - if (Directory.Exists(Core.Core.PatchDataPath)) - HelperMethods.DeleteDirectory(Core.Core.PatchDataPath); + if (Directory.Exists(AM2RLauncherLib.Core.PatchDataPath)) + HelperMethods.DeleteDirectory(AM2RLauncherLib.Core.PatchDataPath); } successful = false; } @@ -288,7 +288,7 @@ namespace AM2RLauncher MessageBox.Show(this, ex.Message + "\n*****Stack Trace*****\n\n" + ex.StackTrace, Text.ErrorWindowTitle, MessageBoxType.Error); if (Directory.Exists(CrossPlatformOperations.CurrentPath + " / PatchData")) - HelperMethods.DeleteDirectory(Core.Core.PatchDataPath); + HelperMethods.DeleteDirectory(AM2RLauncherLib.Core.PatchDataPath); successful = false; } @@ -365,8 +365,8 @@ namespace AM2RLauncher } // We check if it exists first, because someone coughDRUIDcough might've copied it into here while on the showDialog - if (fileFinder.FileName != Core.Core.AM2R11File) - File.Copy(fileFinder.FileName, Core.Core.AM2R11File); + if (fileFinder.FileName != AM2RLauncherLib.Core.AM2R11File) + File.Copy(fileFinder.FileName, AM2RLauncherLib.Core.AM2R11File); log.Info("AM2R_11.zip successfully imported."); UpdateStateMachine(); @@ -607,7 +607,7 @@ namespace AM2RLauncher log.Info("Overwriting mirror in gitconfig."); // Check if the gitConfig exists, if yes regex the gitURL, and replace it with the new current Mirror. - string gitConfigPath = Core.Core.PatchDataPath + "/.git/config"; + string gitConfigPath = AM2RLauncherLib.Core.PatchDataPath + "/.git/config"; if (!File.Exists(gitConfigPath)) return; string gitConfig = File.ReadAllText(gitConfigPath); @@ -660,7 +660,7 @@ namespace AM2RLauncher log.Info("Overwriting mirror in gitconfig."); // Check if the gitConfig exists, if yes regex the gitURL, and replace it with the new current Mirror. - string gitConfigPath = Core.Core.PatchDataPath + "/.git/config"; + string gitConfigPath = AM2RLauncherLib.Core.PatchDataPath + "/.git/config"; if (!File.Exists(gitConfigPath)) return; string gitConfig = File.ReadAllText(gitConfigPath); Match match = gitURLRegex.Match(gitConfig); @@ -712,7 +712,7 @@ namespace AM2RLauncher FileInfo modFile = new FileInfo(fileFinder.FileName); string modFileName = Path.GetFileNameWithoutExtension(modFile.Name); - string extractedModDir = Core.Core.ModsPath + "/" + modFileName; + string extractedModDir = AM2RLauncherLib.Core.ModsPath + "/" + modFileName; // Check first, if the directory is already there, if yes, throw error if (Directory.Exists(extractedModDir)) @@ -795,7 +795,7 @@ namespace AM2RLauncher updateModButton.ToolTip = HelperMethods.GetText(Text.UpdateModButtonToolTip, profileName); } - profileButton.Enabled = Directory.Exists(Core.Core.ProfilesPath + "/" + profileName); + profileButton.Enabled = Directory.Exists(AM2RLauncherLib.Core.ProfilesPath + "/" + profileName); profileButton.ToolTip = HelperMethods.GetText(Text.OpenProfileFolderToolTip, profileName); saveButton.Enabled = true; saveButton.ToolTip = HelperMethods.GetText(Text.OpenSaveFolderToolTip, profileName); @@ -816,7 +816,7 @@ namespace AM2RLauncher return; ProfileXML profile = profileList[modSettingsProfileDropDown.SelectedIndex]; log.Info("User opened the profile directory for profile " + profile.Name + ", which is " + profile.SaveLocation); - CrossPlatformOperations.OpenFolder(Core.Core.ProfilesPath + "/" + profile.Name); + CrossPlatformOperations.OpenFolder(AM2RLauncherLib.Core.ProfilesPath + "/" + profile.Name); } /// @@ -886,7 +886,7 @@ namespace AM2RLauncher FileInfo modFile = new FileInfo(fileFinder.FileName); string extractedName = Path.GetFileNameWithoutExtension(modFile.Name) + "_new"; - string extractedModDir = Core.Core.ModsPath + "/" + extractedName; + string extractedModDir = AM2RLauncherLib.Core.ModsPath + "/" + extractedName; // If for some reason old files remain, delete them so that extraction doesn't throw if (Directory.Exists(extractedModDir)) @@ -940,7 +940,7 @@ namespace AM2RLauncher DeleteProfileAndAdjustLists(currentProfile); // Rename directory to take the old one's place - string originalFolder = Core.Core.ModsPath + "/" + Path.GetFileNameWithoutExtension(modFile.Name); + string originalFolder = AM2RLauncherLib.Core.ModsPath + "/" + Path.GetFileNameWithoutExtension(modFile.Name); Directory.Move(extractedModDir, originalFolder); // Adjust our lists so it gets recognized diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Methods.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Methods.cs index 9e3452b..4e7d3d3 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Methods.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Methods.cs @@ -1,5 +1,5 @@ -using AM2RLauncher.Core; -using AM2RLauncher.Core.XML; +using AM2RLauncherLib; +using AM2RLauncherLib.XML; using AM2RLauncher.Language; using Eto.Forms; using LibGit2Sharp; diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs index 4d25f78..30c04c1 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs @@ -1,7 +1,7 @@ using Eto.Drawing; using System; -using AM2RLauncher.Core; -using AM2RLauncher.Core.XML; +using AM2RLauncherLib; +using AM2RLauncherLib.XML; using AM2RLauncher.Language; namespace AM2RLauncher diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs index d6bc975..52af7ab 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs @@ -1,5 +1,5 @@ -using AM2RLauncher.Core; -using AM2RLauncher.Core.XML; +using AM2RLauncherLib; +using AM2RLauncherLib.XML; using AM2RLauncher.Language; using AM2RLauncher.Properties; using Eto.Drawing; @@ -78,9 +78,9 @@ namespace AM2RLauncher /// private static string currentMirror; - private static readonly bool isInternetThere = Core.Core.IsInternetThere; + private static readonly bool isInternetThere = AM2RLauncherLib.Core.IsInternetThere; - private static readonly bool isThisRunningFromWine = Core.Core.IsThisRunningFromWine; + private static readonly bool isThisRunningFromWine = AM2RLauncherLib.Core.IsThisRunningFromWine; private static bool singleInstance; @@ -100,7 +100,7 @@ namespace AM2RLauncher Process current = Process.GetCurrentProcess(); Process process = Process.GetProcessesByName(current.ProcessName).First(p => p.Id == current.Id); if (process != null) - Core.Core.SetForegroundWindow(process.MainWindowHandle); + AM2RLauncherLib.Core.SetForegroundWindow(process.MainWindowHandle); } Environment.Exit(0); } @@ -828,7 +828,7 @@ namespace AM2RLauncher private TrayIndicator trayIndicator; /// of s, used for actually working with profile data. - //TODO: this should be moved into AM2RLauncher.Core + //TODO: this should be moved into AM2RLauncherLib private List profileList; /// of s so that Eto's annoying interface is appeased. Used for profile name display in DropDowns. private List profileNames; diff --git a/AM2RLauncher/AM2RLauncherCore/AM2RLauncher.Core.csproj b/AM2RLauncher/AM2RLauncherCore/AM2RLauncherLib.csproj similarity index 100% rename from AM2RLauncher/AM2RLauncherCore/AM2RLauncher.Core.csproj rename to AM2RLauncher/AM2RLauncherCore/AM2RLauncherLib.csproj diff --git a/AM2RLauncher/AM2RLauncherCore/Core.cs b/AM2RLauncher/AM2RLauncherCore/Core.cs index bbfbd2b..cb08405 100644 --- a/AM2RLauncher/AM2RLauncherCore/Core.cs +++ b/AM2RLauncher/AM2RLauncherCore/Core.cs @@ -2,13 +2,11 @@ using System; using System.Runtime.InteropServices; -namespace AM2RLauncher.Core; +namespace AM2RLauncherLib; /// -/// Class that has core stuff that doesn't fit anywhere else +/// Class that has core stuff that doesn't fit anywhere else. /// -//TODO: "Core" is a really stupid name and either this should get renamed, or AM2RLauncher.Core should get renamed. -// I am however bad at thinking of names public static class Core { /// diff --git a/AM2RLauncher/AM2RLauncherCore/CrossPlatformOperations.cs b/AM2RLauncher/AM2RLauncherCore/CrossPlatformOperations.cs index 21e9eb1..bf3481c 100644 --- a/AM2RLauncher/AM2RLauncherCore/CrossPlatformOperations.cs +++ b/AM2RLauncher/AM2RLauncherCore/CrossPlatformOperations.cs @@ -5,7 +5,7 @@ using System.Diagnostics; using System.IO; using System.Reflection; -namespace AM2RLauncher.Core; +namespace AM2RLauncherLib; /// /// Class that does operations that work cross-platform. diff --git a/AM2RLauncher/AM2RLauncherCore/HelperMethods.cs b/AM2RLauncher/AM2RLauncherCore/HelperMethods.cs index ac2ab94..afae751 100644 --- a/AM2RLauncher/AM2RLauncherCore/HelperMethods.cs +++ b/AM2RLauncher/AM2RLauncherCore/HelperMethods.cs @@ -4,7 +4,7 @@ using System.IO; using System.Net; using System.Security.Cryptography; -namespace AM2RLauncher.Core; +namespace AM2RLauncherLib; /// /// Class that has various Helper functions. Basically anything that could be used outside the Launcher resides here. diff --git a/AM2RLauncher/AM2RLauncherCore/OS.cs b/AM2RLauncher/AM2RLauncherCore/OS.cs index 09dc0ba..c2c03f1 100644 --- a/AM2RLauncher/AM2RLauncherCore/OS.cs +++ b/AM2RLauncher/AM2RLauncherCore/OS.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace AM2RLauncher.Core; +namespace AM2RLauncherLib; /// /// Class that has information about the current running operating system. diff --git a/AM2RLauncher/AM2RLauncherCore/Profile.cs b/AM2RLauncher/AM2RLauncherCore/Profile.cs index d714e7f..10590e1 100644 --- a/AM2RLauncher/AM2RLauncherCore/Profile.cs +++ b/AM2RLauncher/AM2RLauncherCore/Profile.cs @@ -1,5 +1,4 @@ -using AM2RLauncher.Core.XML; -using LibGit2Sharp; +using LibGit2Sharp; using log4net; using System; using System.Collections.Generic; @@ -8,8 +7,9 @@ using System.IO; using System.IO.Compression; using System.Linq; using System.Text.RegularExpressions; +using AM2RLauncherLib.XML; -namespace AM2RLauncher.Core; +namespace AM2RLauncherLib; /// /// An enum, that has possible return codes for . diff --git a/AM2RLauncher/AM2RLauncherCore/Splash.cs b/AM2RLauncher/AM2RLauncherCore/Splash.cs index 85380f6..159da0d 100644 --- a/AM2RLauncher/AM2RLauncherCore/Splash.cs +++ b/AM2RLauncher/AM2RLauncherCore/Splash.cs @@ -1,7 +1,7 @@ using System; using System.Linq; -namespace AM2RLauncher.Core; +namespace AM2RLauncherLib; /// /// Class only for providing Splashes diff --git a/AM2RLauncher/AM2RLauncherCore/XML/ProfileXML.cs b/AM2RLauncher/AM2RLauncherCore/XML/ProfileXML.cs index d61cc54..314c806 100644 --- a/AM2RLauncher/AM2RLauncherCore/XML/ProfileXML.cs +++ b/AM2RLauncher/AM2RLauncherCore/XML/ProfileXML.cs @@ -1,7 +1,7 @@ using System; using System.Xml.Serialization; -namespace AM2RLauncher.Core.XML; +namespace AM2RLauncherLib.XML; /// /// Class that handles how the mod settings are saved as XML. diff --git a/AM2RLauncher/AM2RLauncherCore/XML/Serializer.cs b/AM2RLauncher/AM2RLauncherCore/XML/Serializer.cs index 4c177cb..1c4fc90 100644 --- a/AM2RLauncher/AM2RLauncherCore/XML/Serializer.cs +++ b/AM2RLauncher/AM2RLauncherCore/XML/Serializer.cs @@ -2,7 +2,7 @@ using System.IO; using System.Text; -namespace AM2RLauncher.Core.XML; +namespace AM2RLauncherLib.XML; /// /// The Serializer class, that serializes to and deserializes from XML files.