using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Peak;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PEAK_NoQuicksaveDeletion")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9147dc89e1c13f7dd625dc07d05e2af6214df5d6")]
[assembly: AssemblyProduct("scarletcafe-mods-peak-noquicksavedeletion")]
[assembly: AssemblyTitle("PEAK_NoQuicksaveDeletion")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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;
}
}
}
namespace PEAK_NoQuicksaveDeletion
{
public class Patches
{
[HarmonyPatch(typeof(Quicksave), "DestroySaveData")]
private class NoQuickSaveDeletionPatch
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
List<CodeInstruction> list = instructions.ToList();
MethodInfo method = typeof(File).GetMethod("Delete", BindingFlags.Static | BindingFlags.Public);
for (int i = 0; i < list.Count; i++)
{
CodeInstruction val = list[i];
if (val.opcode == OpCodes.Call && CodeInstructionExtensions.Calls(val, method))
{
list[i - 1] = new CodeInstruction(OpCodes.Nop, (object)null);
list[i] = new CodeInstruction(OpCodes.Nop, (object)null);
}
}
return list;
}
}
}
[BepInPlugin("PEAK_NoQuicksaveDeletion", "scarletcafe-mods-peak-noquicksavedeletion", "1.0.0")]
[BepInProcess("PEAK.exe")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
internal static Harmony harmony;
private void Awake()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin PEAK_NoQuicksaveDeletion is loaded!");
harmony = new Harmony("scarletcafe.mods.peak.noquicksavedeletion");
harmony.PatchAll();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "PEAK_NoQuicksaveDeletion";
public const string PLUGIN_NAME = "scarletcafe-mods-peak-noquicksavedeletion";
public const string PLUGIN_VERSION = "1.0.0";
}
}