Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Manual Backup Saver MelanieMelicious v1.0.0
ManualBackupSaver.dll
Decompiled a week agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using Dawn; using HarmonyLib; using LethalLevelLoader; using MelMelBackupSaver; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ManualBackupSaver")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("ManualBackupSaver")] [assembly: AssemblyProduct("Manual Backup Saver")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } internal class HarmonyPatches { [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "SaveGame")] [HarmonyPriority(0)] private static void UpdateSaveState(GameNetworkManager __instance) { try { if (__instance.isHostingGame && !((Object)(object)SaveButton.Instance == (Object)null)) { SaveButton.Instance.UpdateStatus(); } } catch { Plugin.mls.LogError((object)"Issue with updating Save Status on Backup Saver."); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "LoadUnlockables")] private static void UnlockSaver(StartOfRound __instance) { try { if ((Object)(object)SaveButton.Instance == (Object)null) { GameObject val = Object.Instantiate<GameObject>(Plugin.backupSaver.prefabObject); val.GetComponent<NetworkObject>().Spawn(false); Plugin.backupSaver.alreadyUnlocked = true; } } catch { Plugin.mls.LogError((object)"Issue with spawning Backup Saver."); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("MelanieMelicious.ManualBackupSaver", "Melanie Melicious - Manual Backup Saver", "1.0.0")] internal class Plugin : BaseUnityPlugin { private const string GUID = "MelanieMelicious.ManualBackupSaver"; private const string NAME = "Melanie Melicious - Manual Backup Saver"; private const string VERSION = "1.0.0"; private readonly Harmony harmony = new Harmony("MelanieMelicious.ManualBackupSaver"); internal static ManualLogSource mls; internal static UnlockableItem backupSaver; internal static bool alt; private void Awake() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown mls = Logger.CreateLogSource("MelanieMelicious.ManualBackupSaver"); mls = ((BaseUnityPlugin)this).Logger; if (Chainloader.PluginInfos.ContainsKey("com.github.teamxiaolan.dawnlib")) { alt = true; } harmony.PatchAll(typeof(HarmonyPatches)); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "melaniebackupsaver")); ExtendedMod val2 = val.LoadAsset<ExtendedMod>("Assets/MelanieBackupSaver/ManualBackupSaver.asset"); val2.ExtendedUnlockableItems.Add(new ExtendedUnlockableItem { UnlockableItem = val.LoadAsset<UnlockablesList>("Assets/MelanieBackupSaver/BackupSaver.asset").unlockables[0], ItemCost = 0 }); backupSaver = val2.ExtendedUnlockableItems[0].UnlockableItem; PatchedContent.RegisterExtendedMod(val2); } } namespace MelMelBackupSaver { public class SaveButton : MonoBehaviour { internal static SaveButton Instance; private const string moddata = ".moddata"; private const string backupLoc = "MelMelBackupSaves/"; private const string dawnPath = "DawnLib/"; [SerializeField] private MeshRenderer[] saves = (MeshRenderer[])(object)new MeshRenderer[0]; [SerializeField] private Material[] saveState = (Material[])(object)new Material[0]; private string save; private string dawnSave; internal void UpdateStatus() { for (int i = 0; i < saves.Length; i++) { if (ES3.FileExists("MelMelBackupSaves/" + i + "/" + save)) { ((Renderer)saves[i]).sharedMaterials = (Material[])(object)new Material[1] { saveState[1] }; } } } public void Save(int saveIndex) { if (!GameNetworkManager.Instance.isHostingGame) { HUDManager.Instance.DisplayTip("Error:", "You cannot save as a non-host!", true, false, "LC_Tip1"); return; } try { if (ES3.FileExists(save)) { ES3.CopyFile(save, "MelMelBackupSaves/" + saveIndex + "/" + save); ((Renderer)saves[saveIndex]).sharedMaterials = (Material[])(object)new Material[1] { saveState[0] }; } if (ES3.FileExists(save + ".moddata")) { ES3.CopyFile(save + ".moddata", "MelMelBackupSaves/" + saveIndex + "/" + save + ".moddata"); } if (Plugin.alt) { DawnSave(saveIndex); } } catch { Plugin.mls.LogError((object)$"Failed to save backup {saveIndex}!"); } } private void DawnSave(int saveIndex) { dawnSave = DawnLib.GetCurrentContract().FileName; if (ES3.FileExists("DawnLib/" + dawnSave)) { ES3.CopyFile("DawnLib/" + dawnSave, "MelMelBackupSaves/" + saveIndex + "/DawnLib/" + dawnSave); } dawnSave = DawnLib.GetCurrentSave().FileName; if (ES3.FileExists("DawnLib/" + dawnSave)) { ES3.CopyFile("DawnLib/" + dawnSave, "MelMelBackupSaves/" + saveIndex + "/DawnLib/" + dawnSave); } } private void Awake() { if (!GameNetworkManager.Instance.isHostingGame) { for (int i = 0; i < saves.Length; i++) { ((Renderer)saves[i]).sharedMaterials = (Material[])(object)new Material[1] { saveState[3] }; } return; } Instance = this; save = GameNetworkManager.Instance.currentSaveFileName; for (int j = 0; j < saves.Length; j++) { if (ES3.FileExists("MelMelBackupSaves/" + j + "/" + save)) { ((Renderer)saves[j]).sharedMaterials = (Material[])(object)new Material[1] { saveState[1] }; } else { ((Renderer)saves[j]).sharedMaterials = (Material[])(object)new Material[1] { saveState[2] }; } } } private void OnDisable() { Instance = null; } } }