using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LLHandlers;
using Microsoft.CodeAnalysis;
using TMPro;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("ModpackVersion")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+03979f44bdcc899ff775099c241ae3dc8fee854c")]
[assembly: AssemblyProduct("ModpackVersion")]
[assembly: AssemblyTitle("ModpackVersion")]
[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 ModpackVersion
{
internal class Configs
{
private static ConfigFile config;
internal static ConfigEntry<Plugin.ModpackVariation> Variation { get; private set; }
internal static ConfigEntry<int> VersionMajor { get; private set; }
internal static ConfigEntry<int> VersionMinor { get; private set; }
internal static void Init()
{
config = ((BaseUnityPlugin)Plugin.Instance).Config;
Variation = config.Bind<Plugin.ModpackVariation>("Version", "Variation", Plugin.ModpackVariation.ONLINE, (ConfigDescription)null);
VersionMajor = config.Bind<int>("Version", "VersionMajor", 1, (ConfigDescription)null);
VersionMinor = config.Bind<int>("Version", "VersionMinor", 0, (ConfigDescription)null);
}
}
internal class HarmonyPatches
{
private static class MainMenuPatch
{
[HarmonyPatch(typeof(ScreenMenu), "OnOpen")]
[HarmonyPostfix]
private static void OnOpen_Postfix(ScreenMenu __instance)
{
__instance.lbVersion.overflowMode = (TextOverflowModes)0;
__instance.lbVersion.enableWordWrapping = false;
}
[HarmonyPatch(typeof(ScreenMenu), "UpdatePlayerInfo")]
[HarmonyPostfix]
private static void UpdatePlayerInfo_Postfix(ScreenMenu __instance)
{
TextHandler.SetText(__instance.lbVersion, string.Format("{0} Modpack v{1}.{2}", (Configs.Variation.Value == Plugin.ModpackVariation.ONLINE) ? "Online" : "LAN", Configs.VersionMajor.Value, Configs.VersionMinor.Value));
}
}
internal static void PatchAll()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
Harmony val = new Harmony("avgduck.plugins.llb.modpackversion");
val.PatchAll(typeof(MainMenuPatch));
Plugin.LogGlobal.LogInfo((object)"Main menu patch applied");
}
}
[BepInPlugin("avgduck.plugins.llb.modpackversion", "ModpackVersion", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal enum ModpackVariation
{
ONLINE,
LAN
}
public const string GUID = "avgduck.plugins.llb.modpackversion";
public static Plugin Instance { get; private set; }
internal static ManualLogSource LogGlobal { get; private set; }
private void Awake()
{
Instance = this;
LogGlobal = ((BaseUnityPlugin)this).Logger;
Configs.Init();
HarmonyPatches.PatchAll();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ModpackVersion";
public const string PLUGIN_NAME = "ModpackVersion";
public const string PLUGIN_VERSION = "1.0.0";
}
}