Decompiled source of NotificationMod v1.0.0

NotificationMod.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NotificationMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NotificationMod")]
[assembly: AssemblyTitle("NotificationMod")]
[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 NotificationMod
{
	[BepInPlugin("com.yourname.notificationmod", "Notification Mod", "1.0.0")]
	public class NotificationMod : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <ShowModalWindow>d__4 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public NotificationMod <>4__this;

			private Type <modalType>5__1;

			private object <modalInstance>5__2;

			private MethodInfo <showError>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ShowModalWindow>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<modalType>5__1 = null;
				<modalInstance>5__2 = null;
				<showError>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSecondsRealtime(2f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<modalType>5__1 = <>4__this.GetModalType();
					if (<modalType>5__1 != null)
					{
						<modalInstance>5__2 = <>4__this.FindModalInstance(<modalType>5__1);
						if (<modalInstance>5__2 != null)
						{
							<showError>5__3 = <modalType>5__1.GetMethod("ShowError", new Type[2]
							{
								typeof(string),
								typeof(string)
							});
							if (<showError>5__3 != null)
							{
								<showError>5__3.Invoke(<modalInstance>5__2, new object[2] { "Notification Mod", "✅ Мод успешно загружен!\n\nИгра работает в обычном режиме." });
								((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"✅ Модальное окно показано!");
							}
							<showError>5__3 = null;
						}
						<modalInstance>5__2 = null;
					}
					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();
			}
		}

		public const string GUID = "com.yourname.notificationmod";

		public const string Name = "Notification Mod";

		public const string Version = "1.0.0";

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"✅ Notification Mod загружен!");
			Harmony val = new Harmony("com.yourname.notificationmod");
			Type type = Type.GetType("MainMenuHandler, Assembly-CSharp");
			if (type != null)
			{
				MethodInfo method = type.GetMethod("CheckAVXSupport", BindingFlags.Instance | BindingFlags.NonPublic);
				if (method != null)
				{
					val.Patch((MethodBase)method, new HarmonyMethod(typeof(AVXPatch).GetMethod("Prefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					((BaseUnityPlugin)this).Logger.LogInfo((object)"✅ AVX проверка отключена!");
				}
			}
			((MonoBehaviour)this).StartCoroutine(ShowModalWindow());
		}

		[IteratorStateMachine(typeof(<ShowModalWindow>d__4))]
		private IEnumerator ShowModalWindow()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ShowModalWindow>d__4(0)
			{
				<>4__this = this
			};
		}

		private Type GetModalType()
		{
			Type type = Type.GetType("Modal, Assembly-CSharp");
			if (type != null)
			{
				return type;
			}
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly in assemblies)
			{
				type = assembly.GetType("Modal");
				if (type != null)
				{
					return type;
				}
			}
			return null;
		}

		private object FindModalInstance(Type modalType)
		{
			return typeof(Object).GetMethod("FindObjectOfType", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(Type) }, null)?.Invoke(null, new object[1] { modalType });
		}
	}
	public class AVXPatch
	{
		public static bool Prefix()
		{
			Debug.Log((object)"[Notification Mod] AVX check bypassed!");
			return false;
		}
	}
}