Decompiled source of SmileOSDarkMode v1.0.0

Plugins/DarkmodeSmileOS.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.IO;
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 TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[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("DarkmodeSmileOS")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c41d222e43e01bf595121464463426a582532adb")]
[assembly: AssemblyProduct("DarkmodeSmileOS")]
[assembly: AssemblyTitle("DarkmodeSmileOS")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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 DarkModeSmileOS
{
	[HarmonyPatch]
	[BepInPlugin("bobot.DarkmodeSmileOS", "Smile OS Dark Mode", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "bobot.DarkmodeSmileOS";

		private static Harmony _harmony;

		private static AssetBundle bundle;

		private static Sprite darkDialogueBox;

		private static Sprite darkUiBox;

		private static Sprite darkUiBoxButton;

		private static Sprite darkUiBoxButtonPressed;

		public const string bundleName = "darkmode";

		private void Start()
		{
			bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "darkmode"));
			darkDialogueBox = bundle.LoadAsset<Sprite>("Dark dialogue box");
			darkUiBox = bundle.LoadAsset<Sprite>("Dark UIbox");
			darkUiBoxButton = bundle.LoadAsset<Sprite>("Dark UIboxbutton");
			darkUiBoxButtonPressed = bundle.LoadAsset<Sprite>("Dark UIboxbuttonpressed");
			SceneManager.sceneLoaded += delegate
			{
				//IL_0155: Unknown result type (might be due to invalid IL or missing references)
				//IL_016e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0194: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				Image[] array = Object.FindObjectsOfType<Image>(true);
				foreach (Image val in array)
				{
					if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.sprite))
					{
						if (((Object)val.sprite).name == "dialogue box")
						{
							val.sprite = darkDialogueBox;
						}
						if (((Object)val.sprite).name == "UIbox")
						{
							val.sprite = darkUiBox;
						}
						if (((Object)val.sprite).name == "UIboxbutton")
						{
							val.sprite = darkUiBoxButton;
						}
						if (((Object)val.sprite).name == "UIboxbuttonpressed")
						{
							val.sprite = darkUiBoxButtonPressed;
						}
						if (((Graphic)val).color == new Color(0.15f, 0.15f, 0.15f, 1f))
						{
							((Graphic)val).color = new Color(0.85f, 0.85f, 0.85f, 1f);
						}
					}
				}
				TMP_Text[] array2 = Object.FindObjectsOfType<TMP_Text>(true);
				foreach (TMP_Text val2 in array2)
				{
					if (Object.op_Implicit((Object)(object)val2) && ((Graphic)val2).color == new Color(0.15f, 0.15f, 0.15f, 1f))
					{
						((Graphic)val2).color = new Color(0.85f, 0.85f, 0.85f, 1f);
					}
				}
			};
		}
	}
}