Decompiled source of BorderlessRocks v1.1.0

Mods/Borderless_Rocks.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Borderless_Rocks;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UIFramework;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "Borderless Rocks", "1.1.0", "Orangenal", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Borderless_Rocks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Borderless_Rocks")]
[assembly: AssemblyTitle("Borderless_Rocks")]
[assembly: NeutralResourcesLanguage("en-US")]
[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 Borderless_Rocks
{
	public class Core : MelonMod
	{
		private bool borderless;

		private const string configPath = "UserData/BorderlessRocks";

		private const string configFile = "config.cfg";

		private MelonPreferences_Category BorderlessRocksCategory;

		private MelonPreferences_Entry<bool> borderlessEntry;

		public override void OnInitializeMelon()
		{
			if (!Directory.Exists("UserData/BorderlessRocks"))
			{
				Directory.CreateDirectory("UserData/BorderlessRocks");
			}
			BorderlessRocksCategory = MelonPreferences.CreateCategory("BorderlessRocks", "Borderless Rocks");
			BorderlessRocksCategory.SetFilePath(Path.Combine("UserData/BorderlessRocks", "config.cfg"));
			borderlessEntry = BorderlessRocksCategory.CreateEntry<bool>("Borderless", true, "Borderless", "Sets the game to windowed borderless mode", false, false, (ValueValidator)null, (string)null);
			((ModelModItem)UI.Register((MelonBase)(object)this, (MelonPreferences_Category[])(object)new MelonPreferences_Category[1] { BorderlessRocksCategory })).OnModSaved += OnSave;
			((MelonBase)this).LoggerInstance.Msg("Initialised.");
		}

		public override void OnUpdate()
		{
			if (Input.GetKeyDown((KeyCode)292))
			{
				borderless = !borderless;
				borderlessEntry.Value = borderless;
				((MelonPreferences_Entry)borderlessEntry).Save();
				MakeBorderless(borderless);
			}
		}

		public void MakeBorderless(bool enable)
		{
			int systemWidth = Display.main.systemWidth;
			int systemHeight = Display.main.systemHeight;
			Screen.SetResolution(systemWidth, systemHeight, enable);
		}

		private void OnSave()
		{
			borderless = borderlessEntry.Value;
			MakeBorderless(borderless);
		}
	}
}