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 BepInEx.Logging;
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("bitmotte.GutterNets")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GutterNets")]
[assembly: AssemblyTitle("bitmotte.GutterNets")]
[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 GutterNets
{
[BepInPlugin("bitmotte.GutterNets", "GutterNets", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
private void Awake()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin bitmotte.GutterNets is loaded!");
Harmony val = new Harmony("bitmotte.GutterNets");
val.PatchAll();
}
}
[HarmonyPatch(typeof(Guttertank), "Start")]
public class ThePatchThatDoesTheThingItChangesTheTextureThatIsTheThing
{
private static void Prefix(Guttertank __instance)
{
int num = Random.Range(1, 21);
if (num == 1)
{
SimpleTexUtils.ChangeTex(((Component)((Component)__instance).transform.GetChild(0).GetChild(0).GetChild(0)
.GetChild(1)).gameObject, SimpleTexUtils.MakeTex(EmbeddedAccess.AccessFile("T_GutterThighs.png")));
}
else
{
SimpleTexUtils.ChangeTex(((Component)((Component)__instance).transform.GetChild(0).GetChild(0).GetChild(0)
.GetChild(1)).gameObject, SimpleTexUtils.MakeTex(EmbeddedAccess.AccessFile("T_GutterNets.png")));
}
}
}
public static class EmbeddedAccess
{
public static byte[] AccessFile(string fileName)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
byte[] array;
using (Stream stream = executingAssembly.GetManifestResourceStream("GutterNets.resources." + fileName))
{
if (stream == null)
{
return null;
}
array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
}
return array;
}
}
public static class SimpleTexUtils
{
public static void ChangeTex(GameObject gameObject, Texture2D tex)
{
Plugin.Logger.LogInfo((object)gameObject);
Material[] materials = ((Renderer)gameObject.GetComponent<SkinnedMeshRenderer>()).materials;
foreach (Material val in materials)
{
val.mainTexture = (Texture)(object)tex;
}
}
public static Texture2D MakeTex(byte[] data)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
Texture2D val = null;
val = new Texture2D(2, 2);
ImageConversion.LoadImage(val, data);
return val;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "bitmotte.GutterNets";
public const string PLUGIN_NAME = "GutterNets";
public const string PLUGIN_VERSION = "1.0.0";
}
}