diff --git a/IPA.Loader/Loader/LibLoader.cs b/IPA.Loader/Loader/LibLoader.cs index 02653768..573c5775 100644 --- a/IPA.Loader/Loader/LibLoader.cs +++ b/IPA.Loader/Loader/LibLoader.cs @@ -40,8 +40,8 @@ namespace IPA.Loader if (File.Exists(path)) return AssemblyDefinition.ReadAssembly(path, parameters); } - - + + return base.Resolve(name, parameters); } } @@ -121,8 +121,8 @@ namespace IPA.Loader SetupAssemblyFilenames(); var testFile = $"{asmName.Name}.dll"; - Log(Logger.Level.Debug, $"Looking for file {asmName.Name}.dll"); - + Log(Logger.Level.Debug, $"Looking for file {asmName.Name}.dll"); + if (FilenameLocations.TryGetValue(testFile, out var path)) { Log(Logger.Level.Debug, $"Found file {testFile} as {path}"); diff --git a/IPA.Loader/Utilities/Utils.cs b/IPA.Loader/Utilities/Utils.cs index a86bbc36..e3931e28 100644 --- a/IPA.Loader/Utilities/Utils.cs +++ b/IPA.Loader/Utilities/Utils.cs @@ -5,10 +5,11 @@ using System.Linq; using System.Collections.Generic; using Mono.Cecil; using System.Runtime.CompilerServices; +using System.Threading; #if NET3 using File = Net3_Proxy.File; #endif - + namespace IPA.Utilities { /// @@ -143,7 +144,7 @@ namespace IPA.Utilities /// if you can use safely, otherwise public static bool CanUseDateTimeNowSafely { get; private set; } = true; private static bool DateTimeSafetyUnknown = true; - private static ulong UnsafeAdvanceTicks = 1; + private static long UnsafeAdvanceTicks = 1; /// /// Gets the current if supported, otherwise, if Mono would throw a fit, @@ -170,7 +171,7 @@ namespace IPA.Utilities else { if (CanUseDateTimeNowSafely) return DateTime.Now; - else return DateTime.MinValue.AddTicks((long)UnsafeAdvanceTicks++); // return MinValue as a fallback + else return DateTime.MinValue.AddTicks(Interlocked.Increment(ref UnsafeAdvanceTicks)); // return MinValue as a fallback } } @@ -190,8 +191,8 @@ namespace IPA.Utilities return cmpVal; } - /// - /// An object used to manage scope guards. + /// + /// An object used to manage scope guards. /// /// /// @@ -199,12 +200,12 @@ namespace IPA.Utilities /// /// /// - public struct ScopeGuardObject : IDisposable - { + public struct ScopeGuardObject : IDisposable + { private readonly Action action; - /// - /// Creates a new scope guard that will invoke when disposed. - /// + /// + /// Creates a new scope guard that will invoke when disposed. + /// /// the action to run on dispose public ScopeGuardObject(Action action) => this.action = action; @@ -212,10 +213,10 @@ namespace IPA.Utilities => action?.Invoke(); } - /// - /// Creates a scope guard for a given . - /// - /// the to run on dispose + /// + /// Creates a scope guard for a given . + /// + /// the to run on dispose /// a that will run on disposal /// ///