コード例 #1
0
ファイル: PPatchManager.cs プロジェクト: pyromanci/ONIMods
 /// <summary>
 /// Runs all patches for the specified time.
 /// </summary>
 /// <param name="when">The time to run the patch.</param>
 private static void RunThisMod(uint when)
 {
     if (patches.TryGetValue(when, out PrivateRunList toRun))
     {
         // Create Harmony instance for the patches
         var instance = HarmonyInstance.Create("PLib.PostLoad." + RunAt.ToString(when));
         foreach (var method in toRun)
         {
             try {
                 method.Run(instance);
             } catch (TargetInvocationException e) {
                 // Use the inner exception
                 PUtil.LogException(e.GetBaseException());
             }
         }
コード例 #2
0
 /// <summary>
 /// Runs all patches for the specified time.
 /// </summary>
 /// <param name="when">The time to run the patch.</param>
 private static void RunThisMod(uint when)
 {
     if (patches.TryGetValue(when, out PrivateRunList toRun))
     {
         // Create Harmony instance for the patches
         var instance = HarmonyInstance.Create("PLib.PostLoad." + RunAt.ToString(when));
         foreach (var method in toRun)
         {
             try {
                 method.Run(instance);
             } catch (Exception e) {
                 // Say which mod's postload crashed
                 PUtil.LogException(e);
             }
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// Runs all patches for all mods at the given time. Only to be run by the forwarded
        /// instance!
        /// </summary>
        /// <param name="when">The runtime (do not use Immediate) of patches to run.</param>
        internal static void RunAll(uint when)
        {
            SharedRunList toRun;

            lock (PSharedData.GetLock(PRegistry.KEY_POSTLOAD_LOCK)) {
                InitMaster();
                if (!master.TryGetValue(when, out toRun))
                {
                    toRun = null;
                }
            }
            if (toRun != null)
            {
                PRegistry.LogPatchDebug("Executing handlers for stage {1} from {0:D} mod(s)".
                                        F(toRun.Count, RunAt.ToString(when)));
                foreach (var modHandler in toRun)
                {
                    modHandler?.Invoke(when);
                }
            }
        }
コード例 #4
0
 public override string ToString()
 {
     return("PLibPatch[RunAt={0},PatchType={1},MethodName={2}]".F(RunAt.ToString(
                                                                      Runtime), PatchType, MethodName));
 }
コード例 #5
0
 public override string ToString()
 {
     return("PLibMethod[RunAt={0}]".F(RunAt.ToString(Runtime)));
 }