using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MrovLib;
using MrovLib.Compatibility;
using MrovLib.Events;
using TestingTools.Compatibility;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityExplorer.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("MrovLib")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("UnityExplorer.BIE5.Mono")]
[assembly: IgnoresAccessChecksTo("WeatherRegistry")]
[assembly: AssemblyCompany("TestingTools")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("0.0.2.0")]
[assembly: AssemblyInformationalVersion("0.0.2+e8f3d7de5ebfd500f37f0f733ab9a3ae33a555ff")]
[assembly: AssemblyProduct("TestingTools")]
[assembly: AssemblyTitle("TestingTools")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/AndreyMrovol/LethalTemplate/")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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 TestingTools
{
public class ConfigManager
{
public static ConfigFile configFile;
public static ConfigManager Instance { get; internal set; }
internal static ConfigEntry<string> SaveFileName { get; set; }
internal static ConfigEntry<bool> RemoveSaveFile { get; set; }
public static void Init(ConfigFile config)
{
Instance = new ConfigManager(config);
}
private ConfigManager(ConfigFile config)
{
configFile = config;
SaveFileName = configFile.Bind<string>("Save File", "SaveFileName", "TestingFile1", "The name of the save file to use when starting the game");
RemoveSaveFile = configFile.Bind<bool>("Save File", "RemoveSaveFile", true, "Remove the save file when starting the game");
}
}
public static class DeleteSaveFile
{
public static void DeleteSaveFileIfNeeded()
{
if (ConfigManager.RemoveSaveFile.Value)
{
string value = ConfigManager.SaveFileName.Value;
if (ES3.FileExists(value))
{
ES3.DeleteFile(value);
Plugin.logger.LogInfo((object)("Deleted save file: " + value));
}
}
}
}
[HarmonyPatch(typeof(GameNetworkManager))]
public class MainMenuHost
{
[HarmonyPrefix]
[HarmonyPatch("Start")]
private static async void StartGameWhenReady()
{
SceneManager.GetSceneByName("MainMenu");
while (true)
{
Scene sceneByName = SceneManager.GetSceneByName("MainMenu");
if (((Scene)(ref sceneByName)).isLoaded)
{
break;
}
await Task.Yield();
}
MenuManager val = Object.FindObjectOfType<MenuManager>();
if (ConfigManager.RemoveSaveFile.Value)
{
DeleteSaveFile.DeleteSaveFileIfNeeded();
}
GameNetworkManager.Instance.currentSaveFileName = ConfigManager.SaveFileName.Value;
val.ConfirmHostButton();
}
}
[BepInPlugin("TestingTools", "TestingTools", "0.0.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource logger;
internal static Harmony harmony = new Harmony("TestingTools");
internal UnityExplorerCompat unityExplorerCompat;
private void Awake()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
logger = ((BaseUnityPlugin)this).Logger;
harmony.PatchAll();
ConfigManager.Init(((BaseUnityPlugin)this).Config);
EventManager.MainMenuLoaded.AddListener((Event)delegate
{
if (((CompatibilityBase)unityExplorerCompat).IsModPresent)
{
logger.LogInfo((object)"Closing Unity Explorer");
unityExplorerCompat.CloseExplorer();
}
});
unityExplorerCompat = new UnityExplorerCompat("com.sinai.unityexplorer");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin TestingTools is loaded!");
}
}
public class Logger : Logger
{
public override ManualLogSource LogSource { get; set; }
public Logger(string SourceName, LoggingType defaultLoggingType = 1)
: base(SourceName, defaultLoggingType)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
((Logger)this).ModName = SourceName;
((Logger)this).LogSource = Logger.CreateLogSource("TestingTools");
((Logger)this)._name = SourceName;
}
}
[HarmonyPatch(typeof(PreInitSceneScript))]
public class SkipLANSelection
{
[HarmonyPatch("SetLaunchPanelsEnabled")]
[HarmonyPostfix]
public static void Skip(PreInitSceneScript __instance)
{
__instance.ChooseLaunchOption(false);
Plugin.logger.LogInfo((object)"LAN Selection skipped");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "TestingTools";
public const string PLUGIN_NAME = "TestingTools";
public const string PLUGIN_VERSION = "0.0.2";
}
}
namespace TestingTools.Compatibility
{
internal class UnityExplorerCompat : CompatibilityBase
{
public UnityExplorerCompat(string guid, string version = null)
: base(guid, version)
{
}
public void CloseExplorer()
{
if (((CompatibilityBase)this).IsModPresent)
{
Plugin.logger.LogInfo((object)"Closing Unity Explorer");
UIManager.ShowMenu = false;
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}