using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("BugFixer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BugFixer")]
[assembly: AssemblyTitle("BugFixer")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BugFixer;
[BepInPlugin("h3vr.invent60.bugfixer", "BugFixer", "1.0.1")]
public class BugFixerPlugin : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <DiagnoseNullInfoPlugins>d__2 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DiagnoseNullInfoPlugins>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
{
<>1__state = -1;
BaseUnityPlugin[] array = Object.FindObjectsOfType<BaseUnityPlugin>();
foreach (BaseUnityPlugin val in array)
{
if (val.Info == null)
{
Log.LogWarning((object)("[BugFixer] F1 crash candidate — null Info on: " + ((object)val).GetType().FullName));
}
}
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
internal static ManualLogSource Log;
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
new Harmony("h3vr.invent60.bugfixer").PatchAll(typeof(BugFixerPatches));
((MonoBehaviour)this).StartCoroutine(DiagnoseNullInfoPlugins());
Log.LogInfo((object)"[BugFixer] v1.0.1 loaded.");
}
[IteratorStateMachine(typeof(<DiagnoseNullInfoPlugins>d__2))]
private IEnumerator DiagnoseNullInfoPlugins()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DiagnoseNullInfoPlugins>d__2(0);
}
}
internal static class BugFixerPatches
{
[HarmonyPatch(typeof(BoltActionRifle_Handle), "UpdateInteraction")]
[HarmonyPrefix]
private static bool NullGuardBoltHandle(FVRViveHand hand)
{
return (Object)(object)hand != (Object)null;
}
}