using System;
using System.Collections;
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 LabFusion.Downloading;
using LabFusion.Downloading.ModIO;
using LabFusion.Utilities;
using MelonLoader;
using Microsoft.CodeAnalysis;
using PalletPaste;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "PalletPaste", "1.0.0", "Fizzyhex", null)]
[assembly: MelonColor(20, 194, 215, 255)]
[assembly: MelonAuthorColor(108, 116, 230, 255)]
[assembly: MelonAdditionalDependencies(new string[] { "LabFusion" })]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("PalletPaste")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b000a15f99e97c57276ea64983336358c56354c3")]
[assembly: AssemblyProduct("PalletPaste")]
[assembly: AssemblyTitle("PalletPaste")]
[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]
[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 PalletPaste
{
public class Core : MelonMod
{
public override void OnUpdate()
{
if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)118))
{
OnPaste();
}
}
private static void OnPaste()
{
string systemCopyBuffer = GUIUtility.systemCopyBuffer;
if (Downloader.IsModPageUrl(systemCopyBuffer))
{
MelonLogger.Msg("Mod.io link detected: " + systemCopyBuffer.Trim());
Downloader.DownloadFromModPageUrl(systemCopyBuffer.Trim());
}
}
}
public static class Downloader
{
[CompilerGenerated]
private static class <>O
{
public static DownloadCallback <0>__OnDownloadComplete;
}
public static void DownloadFromModPageUrl(string modPageUrl)
{
ModIOSettings.LoadToken((Action<string>)OnTokenLoaded);
void OnTokenLoaded(string token)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
string modSlug = modPageUrl.Split('/')[^1];
ModIOManagerPublic.GetModFromSlug(modSlug, (ModCallback)delegate(ModCallbackInfo info)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
QueueDownload(info, modSlug);
});
}
}
public static void QueueDownload(ModCallbackInfo info, string displayName)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Expected O, but got Unknown
//IL_00d0: Expected O, but got Unknown
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
if ((int)info.result == 1)
{
MelonLogger.Msg("Failed to get mod info");
FusionNotifier.Send(new FusionNotification
{
title = NotificationText.op_Implicit("Pallet Paster"),
message = NotificationText.op_Implicit("Failed to fetch mod info for " + displayName),
type = (NotificationType)2
});
return;
}
MelonLogger.Msg("Got mod info - downloading...");
ModTransaction val = new ModTransaction
{
ModFile = new ModIOFile(((ModData)(ref info.data)).Id, (int?)null)
};
object obj = <>O.<0>__OnDownloadComplete;
if (obj == null)
{
DownloadCallback val2 = OnDownloadComplete;
<>O.<0>__OnDownloadComplete = val2;
obj = (object)val2;
}
val.Callback = (DownloadCallback)obj;
FusionNotifier.Send(new FusionNotification
{
title = NotificationText.op_Implicit("Pallet Paster"),
message = NotificationText.op_Implicit(displayName + " was added to the download queue!")
});
ModIODownloader.EnqueueDownload(val);
static void OnDownloadComplete(DownloadCallbackInfo transaction)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)transaction.result == 1)
{
MelonLogger.Msg("Download failed!");
}
else
{
MelonLogger.Msg("Download succeeded!");
}
}
}
public static bool IsModPageUrl(string text)
{
string text2 = text.Replace("http://", "").Replace("https://", "");
if (text2.Contains("bonelab/m/"))
{
return text2.StartsWith("mod.io");
}
return false;
}
}
public static class ModIOManagerPublic
{
public static void GetModFromSlug(string modSlug, ModCallback modCallback)
{
string url = ModIOSettings.GameApiPath + "@" + modSlug;
MelonLogger.Msg("Downloading mod file from '" + url + "'...");
ModIOSettings.LoadToken((Action<string>)OnTokenLoaded);
void OnTokenLoaded(string token)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrWhiteSpace(token))
{
ModCallback obj = modCallback;
if (obj != null)
{
obj.Invoke(ModCallbackInfo.FailedCallback);
}
}
else
{
MelonCoroutines.Start((IEnumerator)typeof(ModIOManager).GetMethod("CoGetMod", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[3] { url, token, modCallback }));
}
}
}
}
}