Browse Source

Moved some loading around to let plugins have PDBs

Added window direct writer to StandardLogger
pull/11/head
Anairkoen Schno 5 years ago
parent
commit
dbaadd82e7
7 changed files with 20 additions and 11 deletions
  1. +1
    -1
      Doorstop
  2. +1
    -0
      IPA.Injector/ConsoleWindow.cs
  3. +1
    -1
      IPA.Loader/Loader/Features/PrintFeature.cs
  4. +7
    -7
      IPA.Loader/Loader/LibLoader.cs
  5. +4
    -2
      IPA.Loader/Loader/PluginManager.cs
  6. +6
    -0
      IPA.Loader/Logging/StandardLogger.cs
  7. BIN
      Refs/UnityEngine.CoreModule.dll

+ 1
- 1
Doorstop

@ -1 +1 @@
Subproject commit 310ab026a8905588dab29f250a2385ed2cb7c41f
Subproject commit 6b6de3b81cf142c73a8ef845f705fb1e51a7670d

+ 1
- 0
IPA.Injector/ConsoleWindow.cs View File

@ -1,6 +1,7 @@
using System; using System;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using IPA.Logging;
using Microsoft.Win32.SafeHandles; using Microsoft.Win32.SafeHandles;
namespace IPA.Injector namespace IPA.Injector


+ 1
- 1
IPA.Loader/Loader/Features/PrintFeature.cs View File

@ -25,7 +25,7 @@ namespace IPA.Loader.Features
{ {
public override bool Initialize(PluginLoader.PluginMetadata meta, string[] parameters) public override bool Initialize(PluginLoader.PluginMetadata meta, string[] parameters)
{ {
Logger.features.Debug($"{meta.Name}: {string.Join(" ", parameters)}");
Logger.features.Warn($"{meta.Name}: {string.Join(" ", parameters)}");
return true; return true;
} }
} }


+ 7
- 7
IPA.Loader/Loader/LibLoader.cs View File

@ -15,7 +15,7 @@ namespace IPA.Loader
var testFile = $"{name.Name}.{name.Version}.dll"; var testFile = $"{name.Name}.{name.Version}.dll";
if (LibLoader.filenameLocations.TryGetValue(testFile, out string path))
if (LibLoader.FilenameLocations.TryGetValue(testFile, out string path))
{ {
if (File.Exists(path)) if (File.Exists(path))
{ {
@ -31,18 +31,18 @@ namespace IPA.Loader
{ {
internal static string LibraryPath => Path.Combine(Environment.CurrentDirectory, "Libs"); internal static string LibraryPath => Path.Combine(Environment.CurrentDirectory, "Libs");
internal static string NativeLibraryPath => Path.Combine(LibraryPath, "Native"); internal static string NativeLibraryPath => Path.Combine(LibraryPath, "Native");
internal static Dictionary<string, string> filenameLocations;
internal static Dictionary<string, string> FilenameLocations;
internal static void SetupAssemblyFilenames() internal static void SetupAssemblyFilenames()
{ {
if (filenameLocations == null)
if (FilenameLocations == null)
{ {
filenameLocations = new Dictionary<string, string>();
FilenameLocations = new Dictionary<string, string>();
foreach (var fn in TraverseTree(LibraryPath, s => s != NativeLibraryPath)) foreach (var fn in TraverseTree(LibraryPath, s => s != NativeLibraryPath))
if (filenameLocations.ContainsKey(fn.Name))
if (FilenameLocations.ContainsKey(fn.Name))
Log(Logger.Level.Critical, $"Multiple instances of {fn.Name} exist in Libs! Ignoring {fn.FullName}"); Log(Logger.Level.Critical, $"Multiple instances of {fn.Name} exist in Libs! Ignoring {fn.FullName}");
else filenameLocations.Add(fn.Name, fn.FullName);
else FilenameLocations.Add(fn.Name, fn.FullName);
} }
} }
@ -56,7 +56,7 @@ namespace IPA.Loader
var testFile = $"{asmName.Name}.{asmName.Version}.dll"; var testFile = $"{asmName.Name}.{asmName.Version}.dll";
Log(Logger.Level.Debug, $"Looking for file {testFile}"); Log(Logger.Level.Debug, $"Looking for file {testFile}");
if (filenameLocations.TryGetValue(testFile, out string path))
if (FilenameLocations.TryGetValue(testFile, out string path))
{ {
Log(Logger.Level.Debug, $"Found file {testFile} as {path}"); Log(Logger.Level.Debug, $"Found file {testFile} as {path}");
if (File.Exists(path)) if (File.Exists(path))


+ 4
- 2
IPA.Loader/Loader/PluginManager.cs View File

@ -117,11 +117,14 @@ namespace IPA.Loader
} }
} }
// initialize BSIPA plugins first
_bsPlugins.AddRange(PluginLoader.LoadPlugins());
//Copy plugins to .cache //Copy plugins to .cache
string[] originalPlugins = Directory.GetFiles(pluginDirectory, "*.dll"); string[] originalPlugins = Directory.GetFiles(pluginDirectory, "*.dll");
foreach (string s in originalPlugins) foreach (string s in originalPlugins)
{ {
if (PluginsMetadata.Select(m => m.File.Name).Contains(s)) continue;
if (PluginsMetadata.Select(m => m.File.FullName).Contains(s)) continue;
string pluginCopy = Path.Combine(cacheDir, Path.GetFileName(s)); string pluginCopy = Path.Combine(cacheDir, Path.GetFileName(s));
#region Fix assemblies for refactor #region Fix assemblies for refactor
@ -190,7 +193,6 @@ namespace IPA.Loader
var result = LoadPluginsFromFile(s); var result = LoadPluginsFromFile(s);
_ipaPlugins.AddRange(result.Item2); _ipaPlugins.AddRange(result.Item2);
} }
_bsPlugins.AddRange(PluginLoader.LoadPlugins());
Logger.log.Info(exeName); Logger.log.Info(exeName);
Logger.log.Info($"Running on Unity {Application.unityVersion}"); Logger.log.Info($"Running on Unity {Application.unityVersion}");


+ 6
- 0
IPA.Loader/Logging/StandardLogger.cs View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@ -51,6 +52,11 @@ namespace IPA.Logging
new GlobalLogFilePrinter() new GlobalLogFilePrinter()
}; };
/// <summary>
/// The <see cref="TextWriter"/> for writing directly to the console window, or stdout if no window open.
/// </summary>
public static TextWriter ConsoleWriter { get; internal set; } = Console.Out;
/// <summary> /// <summary>
/// Adds to the default printer pool that all printers inherit from. Printers added this way will be passed every message from every logger. /// Adds to the default printer pool that all printers inherit from. Printers added this way will be passed every message from every logger.
/// </summary> /// </summary>


BIN
Refs/UnityEngine.CoreModule.dll View File


Loading…
Cancel
Save