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 JointCompanyLogo.Utils;
using Microsoft.CodeAnalysis;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("JointCompanyLogo")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("JointCompanyLogo")]
[assembly: AssemblyTitle("JointCompanyLogo")]
[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 JointCompanyLogo
{
public static class PluginInformation
{
public const string PLUGIN_NAME = "PrikolnyiLogo";
public const string PLUGIN_VERSION = "1.47.0";
public const string PLUGIN_GUID = "me.richard.coffee.shop.prikolnyilogo";
}
[BepInPlugin("me.richard.coffee.shop.prikolnyilogo", "PrikolnyiLogo", "1.47.0")]
public class Plugin : BaseUnityPlugin
{
public static Texture2D mainLogo;
public static ManualLogSource StaticLogger;
private Harmony harmony;
private void Awake()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
StaticLogger = ((BaseUnityPlugin)this).Logger;
harmony = new Harmony("me.richard.coffee.shop.prikolnyilogo");
harmony.PatchAll();
AssetBundle val = BundleUtilities.LoadBundleFromInternalAssembly("richardcompany.assets", Assembly.GetExecutingAssembly());
string[] allAssetNames = val.GetAllAssetNames();
foreach (string text in allAssetNames)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)("Loading asset: " + text));
}
mainLogo = val.LoadPersistentAsset<Texture2D>("assets/lethallogo.png");
val.Unload(false);
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Resolution {((Texture)mainLogo).width} x {((Texture)mainLogo).height}");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin PrikolnyiLogo is loaded!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "JointCompanyLogo";
public const string PLUGIN_NAME = "JointCompanyLogo";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace JointCompanyLogo.Patches
{
[HarmonyPatch(typeof(MenuManager), "Awake")]
public static class LogoPatch
{
[HarmonyPriority(0)]
public static void Postfix(MenuManager __instance)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
try
{
GameObject gameObject = ((Component)((Component)__instance).transform.parent).gameObject;
GameObject gameObject2 = ((Component)gameObject.transform.Find("MenuContainer")).gameObject;
Scene scene = gameObject2.scene;
if (!(((Scene)(ref scene)).name != "MainMenu"))
{
GameObject gameObject3 = ((Component)gameObject2.transform.Find("MainButtons").Find("HeaderImage")).gameObject;
Image component = gameObject3.GetComponent<Image>();
component.sprite = Sprite.Create(Plugin.mainLogo, new Rect(0f, 0f, (float)((Texture)Plugin.mainLogo).width, (float)((Texture)Plugin.mainLogo).height), new Vector2(0.5f, 0.5f));
GameObject gameObject4 = ((Component)gameObject2.transform.Find("LoadingScreen").Find("Image")).gameObject;
Image component2 = gameObject4.GetComponent<Image>();
component2.sprite = Sprite.Create(Plugin.mainLogo, new Rect(0f, 0f, (float)((Texture)Plugin.mainLogo).width, (float)((Texture)Plugin.mainLogo).height), new Vector2(0.5f, 0.5f));
}
}
catch (Exception ex)
{
Plugin.StaticLogger.LogError((object)ex.Message);
}
}
private static void Traverse(GameObject obj)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
Plugin.StaticLogger.LogInfo((object)((Object)obj).name);
foreach (Transform item in obj.transform)
{
Transform val = item;
Traverse(((Component)val).gameObject);
}
Plugin.StaticLogger.LogInfo((object)"-----------");
}
}
}
namespace JointCompanyLogo.Utils
{
public class BundleUtilities
{
public static byte[] GetResourceBytes(string filename, Assembly assembly)
{
string[] manifestResourceNames = assembly.GetManifestResourceNames();
foreach (string text in manifestResourceNames)
{
if (!text.Contains(filename))
{
continue;
}
using Stream stream = assembly.GetManifestResourceStream(text);
if (stream == null)
{
return null;
}
byte[] array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
return array;
}
return null;
}
public static AssetBundle LoadBundleFromInternalAssembly(string filename, Assembly assembly)
{
return AssetBundle.LoadFromMemory(GetResourceBytes(filename, assembly));
}
}
public static class AssetBundleExtension
{
public static T LoadPersistentAsset<T>(this AssetBundle bundle, string name) where T : Object
{
Object val = bundle.LoadAsset(name);
if (val != (Object)null)
{
val.hideFlags = (HideFlags)32;
return (T)(object)val;
}
return default(T);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}