Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Verse;
- using Harmony;
- using System.Xml;
- using System.IO;
- namespace DebugActions
- {
- class DebugActions : Mod
- {
- public DebugActions(ModContentPack content) : base(content)
- {
- HarmonyInstance.Create("rimworld.debugactions").PatchAll();
- }
- }
- [HarmonyPatch (typeof(LoadedModManager), "CombineIntoUnifiedXML")]
- internal static class SaveXML
- {
- public static XmlDocument instance;
- static void Postfix(XmlDocument __result)
- {
- if (instance == null) instance = __result;
- }
- }
- [HarmonyPatch (typeof(Dialog_DebugActionsMenu), "DoListingItems_Entry")]
- static class AddDebugActions
- {
- static void Prefix(Dialog_DebugActionsMenu __instance)
- {
- var menu = __instance;
- menu.DoLabel("XML");
- menu.DebugAction("Dump", delegate {
- StringWriter sw = new StringWriter();
- SaveXML.instance.Save(sw);
- string formattedXml = sw.ToString();
- Log.Message(formattedXml);
- });
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement