using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("CRDriveQuietFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CRDriveQuietFix")]
[assembly: AssemblyTitle("CRDriveQuietFix")]
[assembly: AssemblyVersion("1.0.0.0")]
[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;
}
}
}
[BepInPlugin("local.fix.cr.drivemono", "CR DriveMono Quiet Fix", "0.4.0")]
public class Plugin : BaseUnityPlugin
{
private struct PatchTarget
{
public readonly string TypeName;
public readonly string MethodName;
public PatchTarget(string typeName, string methodName)
{
TypeName = typeName;
MethodName = methodName;
}
}
private const string HarmonyId = "local.fix.cr.drivemono";
private static readonly PatchTarget[] Targets = new PatchTarget[10]
{
new PatchTarget("CR.MonoBehaviors.DriveMono", "Update"),
new PatchTarget("CR.MonoBehaviors.MitosisMono", "Attack"),
new PatchTarget("CR.MonoBehaviors.MitosisBlockMono", "OnUpdate"),
new PatchTarget("CR.MonoBehaviors.FlexMono", "Update"),
new PatchTarget("CR.MonoBehaviors.DoveSpriteMono", "Attack"),
new PatchTarget("CR.MonoBehaviors.FaeEmbersMono+FaeSpawner", "Start"),
new PatchTarget("PCE.MonoBehaviours.PacPlayerEffect", "OnUpdate"),
new PatchTarget("PCE.MonoBehaviours.SuperJumpEffect", "OnUpdate"),
new PatchTarget("PCE.MonoBehaviours.SpawnBulletsEffect", "SetGun"),
new PatchTarget("PCE.MonoBehaviours.SpawnBulletsEffect", "RPCA_Shoot")
};
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
Harmony val = new Harmony("local.fix.cr.drivemono");
PatchTarget[] targets = Targets;
for (int i = 0; i < targets.Length; i++)
{
PatchTarget patchTarget = targets[i];
Type type = FindType(patchTarget.TypeName);
if (type == null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)(patchTarget.TypeName + " type not found, skipped"));
continue;
}
MethodInfo methodInfo = AccessTools.Method(type, patchTarget.MethodName, (Type[])null, (Type[])null);
if (methodInfo == null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)(patchTarget.TypeName + "." + patchTarget.MethodName + " not found, skipped"));
continue;
}
val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "Finalizer", (Type[])null), (HarmonyMethod)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)(patchTarget.TypeName + "." + patchTarget.MethodName + " finalizer installed"));
}
}
private static Type FindType(string typeName)
{
Type type = AccessTools.TypeByName(typeName);
if (type != null)
{
return type;
}
int num = typeName.LastIndexOf('+');
if (num <= 0)
{
return null;
}
Type type2 = AccessTools.TypeByName(typeName.Substring(0, num));
if (type2 == null)
{
return null;
}
return AccessTools.Inner(type2, typeName.Substring(num + 1));
}
private static Exception Finalizer(Exception __exception)
{
if (__exception is NullReferenceException)
{
return null;
}
return __exception;
}
}