rename AM2RLauncher.Core to AM2RLauncherLib

pull/32/head
Miepee 4 years ago
parent cd56089fe8
commit 10e77406ae

@ -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;

@ -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.

@ -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

@ -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

@ -35,7 +35,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AM2RLauncherCore\AM2RLauncher.Core.csproj" />
<ProjectReference Include="..\AM2RLauncherCore\AM2RLauncherLib.csproj" />
</ItemGroup>
<ItemGroup>

@ -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!
/// <summary>The Version that identifies this current release.</summary>
public const string VERSION = Core.Core.Version;
public const string VERSION = AM2RLauncherLib.Core.Version;
/// <summary>The Path of the oldConfig. Only gets used Windows-only</summary>
private static readonly string oldConfigPath = CrossPlatformOperations.CurrentPath + "/" + CrossPlatformOperations.LauncherName + ".oldCfg";

@ -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<ProfileXML>(File.ReadAllText(Core.Core.ProfilesPath + "/Community Updates (Latest)/profile.xml"));
ProfileXML installedUpdatesProfile = Serializer.Deserialize<ProfileXML>(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);
}
/// <summary>
@ -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

@ -1,5 +1,5 @@
using AM2RLauncher.Core;
using AM2RLauncher.Core.XML;
using AM2RLauncherLib;
using AM2RLauncherLib.XML;
using AM2RLauncher.Language;
using Eto.Forms;
using LibGit2Sharp;

@ -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

@ -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
/// </summary>
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;
/// <summary><see cref="List{T}"/> of <see cref="ProfileXML"/>s, used for actually working with profile data.</summary>
//TODO: this should be moved into AM2RLauncher.Core
//TODO: this should be moved into AM2RLauncherLib
private List<ProfileXML> profileList;
/// <summary><see cref="List{T}"/> of <see cref="ListItem"/>s so that Eto's annoying <see cref="IListItem"/> interface is appeased. Used for profile name display in DropDowns.</summary>
private List<ListItem> profileNames;

@ -2,13 +2,11 @@
using System;
using System.Runtime.InteropServices;
namespace AM2RLauncher.Core;
namespace AM2RLauncherLib;
/// <summary>
/// Class that has core stuff that doesn't fit anywhere else
/// Class that has core stuff that doesn't fit anywhere else.
/// </summary>
//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
{
/// <summary>

@ -5,7 +5,7 @@ using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace AM2RLauncher.Core;
namespace AM2RLauncherLib;
/// <summary>
/// Class that does operations that work cross-platform.

@ -4,7 +4,7 @@ using System.IO;
using System.Net;
using System.Security.Cryptography;
namespace AM2RLauncher.Core;
namespace AM2RLauncherLib;
/// <summary>
/// Class that has various Helper functions. Basically anything that could be used outside the Launcher resides here.

@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace AM2RLauncher.Core;
namespace AM2RLauncherLib;
/// <summary>
/// Class that has information about the current running operating system.

@ -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;
/// <summary>
/// An enum, that has possible return codes for <see cref="Profile.CheckIfZipIsAM2R11"/>.

@ -1,7 +1,7 @@
using System;
using System.Linq;
namespace AM2RLauncher.Core;
namespace AM2RLauncherLib;
/// <summary>
/// Class only for providing Splashes

@ -1,7 +1,7 @@
using System;
using System.Xml.Serialization;
namespace AM2RLauncher.Core.XML;
namespace AM2RLauncherLib.XML;
/// <summary>
/// Class that handles how the mod settings are saved as XML.

@ -2,7 +2,7 @@
using System.IO;
using System.Text;
namespace AM2RLauncher.Core.XML;
namespace AM2RLauncherLib.XML;
/// <summary>
/// The <c>Serializer</c> class, that serializes to and deserializes from XML files.

Loading…
Cancel
Save