Decompiled source of 20 Mixing threhold v1.0.3

ChangeMixerThrehold.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using ChangeMixerThrehold;
using HarmonyLib;
using Il2CppScheduleOne.Management;
using MelonLoader;
using Microsoft.CodeAnalysis;
using ModManagerPhoneApp;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(EntryPoint), "ChangeMixerThrehold", "1.0.1", "_peron", null)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ChangeMixerThrehold")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ChangeMixerThrehold")]
[assembly: AssemblyTitle("ChangeMixerThrehold")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace ChangeMixerThrehold
{
	public class EntryPoint : MelonMod
	{
		[HarmonyPatch(typeof(MixingStationConfiguration))]
		public class MixingStationConfigurationPatch
		{
			[HarmonyPatch("Selected")]
			[HarmonyPrefix]
			public static bool Selected(MixingStationConfiguration __instance)
			{
				if (Mathf.Approximately(__instance.StartThrehold.MinValue, 1f))
				{
					NumberField startThrehold = __instance.StartThrehold;
					MelonPreferences_Entry? entry = _entry;
					startThrehold.Configure(1f, (float)(((entry != null) ? entry.BoxedValue : null) ?? ((object)20f)), true);
				}
				return true;
			}
		}

		private static MelonPreferences_Category? _cat;

		private static MelonPreferences_Entry? _entry;

		public override void OnInitializeMelon()
		{
			_cat = MelonPreferences.CreateCategory("ChangeMixerThrehold_MaxThreholdCategory", "MixerThrehold - Config");
			_entry = _cat.CreateEntry<float>("ChangeMixerThrehold_MaxThrehold", 20f, "MaxThrehold", false);
			_cat.SetFilePath("UserData/MaxThrehold.cfg");
			_cat.SaveToFile(true);
			try
			{
				ModSettingsEvents.OnPreferencesSaved += LoadAllCategories;
				((MelonBase)this).LoggerInstance.Msg("Successfully subscribed to Mod Manager save event.");
			}
			catch (Exception ex)
			{
				((MelonBase)this).LoggerInstance.Warning("Could not subscribe to Mod Manager event (Mod Manager may not be installed/compatible): " + ex.Message);
			}
		}

		public static void LoadAllCategories()
		{
			foreach (MelonPreferences_Category category in MelonPreferences.Categories)
			{
				category.LoadFromFile(true);
			}
		}
	}
}