Skip to content

Commit

Permalink
Merge branch 'master' of github.com:PULSAR-Modders/pulsar-mod-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
FloppyDisk committed Jul 14, 2023
2 parents 9018cf4 + 5a8d588 commit b1f3bbe
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions PulsarInjector/Injector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using PulsarModLoader.Utilities;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
Expand Down Expand Up @@ -256,11 +257,17 @@ static void InstallModLoader(string targetAssemblyPath)
Logger.Info("=== Injecting Harmony Initialization ===");
InjectionTools.PatchMethod(targetAssemblyPath, "PLGlobal", "Awake", typeof(HarmonyInjector), "InitializeHarmony");

Logger.Info("=== Copying Assemblies ===");
//CopyAssemblies. Has loggers in method.
CopyAssemblies(Path.GetDirectoryName(targetAssemblyPath));

Logger.Info("Success! You may now run the game normally.");

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Logger.Info("The mods folder is being opened.");
Process.Start("explorer.exe", Modsdir);
}

Logger.Info("Press any key to continue...");
Console.ReadKey();
}
Expand All @@ -269,6 +276,7 @@ static void CopyAssemblies(string targetAssemblyDir)
{
string PulsarModLoaderDll = CheckForUpdates(typeof(PulsarModLoader.PulsarMod).Assembly.Location);

Logger.Info("=== Copying Assemblies ===");
/* Copy important assemblies to target assembly's directory */
string sourceDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string[] copyables = new string[] {
Expand Down Expand Up @@ -310,6 +318,7 @@ static string CheckForUpdates(string CurrentPMLDll)
short[] UpdatedVersionAsNum = UpdatedVersion.Split('.').Select(s => short.Parse(s)).ToArray();

for (byte i = 0; i < 4; i++)
{
if (UpdatedVersionAsNum[i] > versionAsNum[i])
{
CurrentPMLDll = UpdatedPMLDll;
Expand All @@ -321,14 +330,15 @@ static string CheckForUpdates(string CurrentPMLDll)
{
break;
}
}
}

Logger.Info("=== Updates ===");
Logger.Info("Check for a newer version of PML?");
Logger.Info("(Y/N)");

if (Console.ReadLine().ToUpper() == "N")
return CurrentPMLDll;
Logger.Info("Checking for a newer version of PML...");
//Logger.Info("(Y/N)");
//
//if (Console.ReadLine().ToUpper() == "N")
// return CurrentPMLDll;

using (var web = new System.Net.WebClient())
{
Expand All @@ -342,7 +352,7 @@ static string CheckForUpdates(string CurrentPMLDll)
if (version.StartsWith(versionFromInfo))
return CurrentPMLDll;

Logger.Info($"New update available! Download {versionFromInfo}?");
Logger.Info($"New update available! Download {versionFromInfo}? (Current Verson: {version})");
Logger.Info("(Y/N)");

if (Console.ReadLine().ToUpper() == "N")
Expand Down

0 comments on commit b1f3bbe

Please sign in to comment.