/// <summary> /// Do patching and checks various parameters of the game. /// </summary> public static void CheckAll() { LanguageWorkerPatcher.DoPatching(); LoadedLanguage active = LanguageDatabase.activeLanguage; LanguageWorkerPatcher.LogMessage("Active: " + active.FriendlyNameEnglish + " (Folder: " + active.folderName + ") " + active.Worker.GetType()); foreach (LoadedLanguage l in LanguageDatabase.AllLoadedLanguages) { if (LanguageWorkerPatcher.IsTargetLanguage(l.FriendlyNameEnglish)) { LanguageWorkerPatcher.LogMessage("Other: " + l.FriendlyNameEnglish + " (Folder: " + l.folderName + ") " + l.info.languageWorkerClass); } } }
static void Postfix(GrammarRequest __result) { #if DEBUG LanguageWorkerPatcher.LogMessage("--InspectionPatch called..."); LanguageWorkerPatcher.LogMessage("result: " + __result); foreach (Rule r in __result.Rules) { LanguageWorkerPatcher.LogMessage(r.ToString()); } LanguageWorkerPatcher.LogMessage("constants: " + __result.Constants); if (__result.Constants != null) { foreach (var c in __result.Constants) { LanguageWorkerPatcher.LogMessage(c.Key + "=" + c.Value); } } #endif }
static bool RulesForDefPrefix(ref IEnumerable <Rule> __result, string prefix, Def def) { // if the current language is not the target, do nothing if (!LanguageWorkerPatcher.IsTargetLanguage(LanguageDatabase.activeLanguage.FriendlyNameEnglish)) { return(true); } // Rewrite the method entirely since it is short enough __result = LanguageWorkerPatcher.FixRulesForDef(prefix, def); #if DEBUG LanguageWorkerPatcher.LogMessage("--RulesForDefPrefix called..."); LanguageWorkerPatcher.LogMessage("result: " + __result); foreach (Rule r in __result) { LanguageWorkerPatcher.LogMessage(r.ToString()); } #endif // DO NOT CONTINUE to the original GrammarUtility.RulesforPawn return(false); }