Decompiled source of UnityExplorer Fixer v0.1.1

UnityExplorer-Fixer.dll

Decompiled 17 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UniverseLib.UI;

[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("UnityExplorer-Fixer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Unity Explorer Fixer")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+93b4669d0cc0363ce9512ec8279a79c47556b088")]
[assembly: AssemblyProduct("UnityExplorer-Fixer")]
[assembly: AssemblyTitle("UnityExplorer-Fixer")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 UnityExplorerFixer
{
	internal static class Log
	{
		private static ManualLogSource? logSource;

		internal static void Init(ManualLogSource logSource)
		{
			Log.logSource = logSource;
		}

		internal static void Debug(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogDebug(data);
			}
		}

		internal static void Error(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogError(data);
			}
		}

		internal static void Exception(Exception ex)
		{
			Error(ex.Message + ", " + ex.StackTrace);
		}

		internal static void Fatal(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogFatal(data);
			}
		}

		internal static void Info(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogInfo(data);
			}
		}

		internal static void Message(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogMessage(data);
			}
		}

		internal static void Warning(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogWarning(data);
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("UnityExplorer-Fixer", "UnityExplorer-Fixer", "1.0.0")]
	public class UnityExplorerFixer : BaseUnityPlugin
	{
		private Harmony harmony;

		public static bool IsUnityExplorerPresent;

		private void Awake()
		{
			try
			{
				Log.Init(((BaseUnityPlugin)this).Logger);
				RCGLifeCycle.DontDestroyForever(((Component)this).gameObject);
				IsUnityExplorerPresent = Chainloader.PluginInfos.ContainsKey("com.originalnicodr.cinematicunityexplorer") || Chainloader.PluginInfos.ContainsKey("com.sinai.unityexplorer");
				harmony = Harmony.CreateAndPatchAll(typeof(UnityExplorerFixer).Assembly, (string)null);
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin UnityExplorer-Fixer is loaded!");
			}
			catch (Exception data)
			{
				Log.Error(data);
			}
		}

		private void OnDestroy()
		{
			harmony.UnpatchSelf();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "UnityExplorer-Fixer";

		public const string PLUGIN_NAME = "UnityExplorer-Fixer";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace UnityExplorerFixer.HarmonyPatches
{
	[HarmonyPatch(typeof(UniversalUI))]
	internal static class UniversalUIPatches
	{
		[HarmonyPatch("Init")]
		[HarmonyPostfix]
		private static void Init_Postfix()
		{
			try
			{
				if (UnityExplorerFixer.IsUnityExplorerPresent && (Object)(object)UniversalUI.PoolHolder != (Object)null)
				{
					RCGLifeCycle.DontDestroyForever(UniversalUI.PoolHolder);
				}
			}
			catch (Exception ex)
			{
				Log.Exception(ex);
			}
		}
	}
}