Decompiled source of TungLink v1.1.0

Mods/TungLink.dll

Decompiled 2 days 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 HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using MelonLoader;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using TungLink;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "TungLink", "1.0.0", "The Static Squad because last time i set my name as The Static Team instead of the The Static Squad", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("TungLink")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TungLink")]
[assembly: AssemblyTitle("TungLink")]
[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]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 TungLink
{
	public class Core : MelonMod
	{
		public static Texture2D leTexture = Texture2D.blackTexture;

		public override void OnInitializeMelon()
		{
			((MelonBase)this).LoggerInstance.Msg("hey there bro");
			((MelonBase)this).LoggerInstance.Msg("Initialized.");
			string text = Path.Combine(MelonEnvironment.UserLibsDirectory, "tripleT.png");
			if (!File.Exists(text))
			{
				((MelonBase)this).LoggerInstance.Msg("Texture not found at " + text + ". Please place your texture there.");
				((MelonBase)this).LoggerInstance.Msg("microslops vs studio added that log up there");
			}
			else
			{
				((MelonBase)this).LoggerInstance.Msg("Loading texture... " + text);
				Il2CppImageConversionManager.LoadImage(leTexture, Il2CppStructArray<byte>.op_Implicit(File.ReadAllBytes(text)));
				((MelonBase)this).HarmonyInstance.PatchAll();
			}
		}

		[HarmonyPatch(typeof(Object), "Instantiate")]
		private static void Postfix(ref Object __result)
		{
			Object obj = __result;
			GameObject val = (GameObject)(object)((obj is GameObject) ? obj : null);
			if (val == null)
			{
				return;
			}
			Il2CppArrayBase<Renderer> componentsInChildren = ((Component)val.transform.root).GetComponentsInChildren<Renderer>(true);
			foreach (Renderer item in componentsInChildren)
			{
				foreach (Material item2 in (Il2CppArrayBase<Material>)(object)item.sharedMaterials)
				{
					item2.mainTexture = (Texture)(object)leTexture;
				}
			}
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			Il2CppArrayBase<Renderer> val = Object.FindObjectsOfType<Renderer>(true);
			foreach (Renderer item in val)
			{
				foreach (Material item2 in (Il2CppArrayBase<Material>)(object)item.sharedMaterials)
				{
					item2.mainTexture = (Texture)(object)leTexture;
				}
			}
		}
	}
}