using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib;
using InstaTest;
using MelonLoader;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "InstaTest", "1.0.0", "HL2H0", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("InstaTest")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("InstaTest")]
[assembly: AssemblyTitle("InstaTest")]
[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 InstaTest
{
public class Core : MelonMod
{
private string _levelBarcode;
private string _previousLevelBarcode;
private bool _usingInstaTest;
public override void OnInitializeMelon()
{
_levelBarcode = GetLevelBarcode();
if (_levelBarcode != null && _usingInstaTest)
{
SetLevelBarcode(_levelBarcode);
((MelonBase)this).LoggerInstance.Msg("Launching BONELAB With Barcode : " + _levelBarcode);
Hooking.OnLevelLoaded += OnLevelLoaded;
}
else
{
((MelonBase)this).LoggerInstance.Msg("No level barcode specified, running game normally");
}
}
private void OnLevelLoaded(LevelInfo obj)
{
((MelonBase)this).LoggerInstance.Msg("Level loaded. Resetting level barcode");
MelonPreferences.SetEntryValue<string>("BootstrapOverride", "LevelBarcode", _previousLevelBarcode);
MelonPreferences.GetCategory("BootstrapOverride").SaveToFile(true);
}
private string GetLevelBarcode()
{
string[] commandLineArgs = Environment.GetCommandLineArgs();
if (((ReadOnlySpan<string>)commandLineArgs).Contains("--insta-test"))
{
string result = commandLineArgs[((ReadOnlySpan<string>)commandLineArgs).IndexOf("--insta-test") + 1];
_usingInstaTest = true;
return result;
}
return null;
}
private void SetLevelBarcode(string barcode)
{
MelonPreferences_Entry<string> entry = MelonPreferences.GetEntry<string>("BootstrapOverride", "LevelBarcode");
if (entry == null)
{
((MelonBase)this).LoggerInstance.Error("Couldn't find BootstrapOverride preferences");
return;
}
_previousLevelBarcode = entry.Value;
MelonPreferences.SetEntryValue<string>("BootstrapOverride", "LevelBarcode", barcode);
}
}
}