using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using HarmonyLib;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MissingLevelFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MissingLevelFix")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("eaa320c0-507d-478c-be6b-4abc96f7d486")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MissingLevelFix
{
[BepInPlugin("de.dasgerippe.distance.missinglevelfix", "MissingLevelFix", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("de.dasgerippe.distance.missinglevelfix").PatchAll();
}
}
}
namespace MissingLevelFix.Properties
{
internal static class ModInfo
{
internal const string ID = "de.dasgerippe.distance.missinglevelfix";
internal const string NAME = "MissingLevelFix";
internal const string VERSION = "1.0.0";
}
}
namespace MissingLevelFix.Patches.Assembly_CSharp
{
[HarmonyPatch]
internal class GetPublishedFileDetailsTask_OnCallResult
{
internal static MethodBase TargetMethod()
{
return typeof(SteamworksUGC).GetNestedType("GetPublishedFileDetailsTask", BindingFlags.NonPublic).GetMethod("OnCallResult", BindingFlags.Instance | BindingFlags.NonPublic);
}
internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
MethodInfo strictFilenameValidationMethod = AccessTools.Method(typeof(Resource), "IsValidFileName", (Type[])null, (Type[])null);
MethodInfo generousFilenameValidationMethod = AccessTools.Method(typeof(GetPublishedFileDetailsTask_OnCallResult), "GenerousIsValidFileName", (Type[])null, (Type[])null);
foreach (CodeInstruction instruction in instructions)
{
if (instruction.opcode == OpCodes.Call && instruction.operand == strictFilenameValidationMethod)
{
instruction.operand = generousFilenameValidationMethod;
}
yield return instruction;
}
}
private static bool GenerousIsValidFileName(string filename)
{
return !string.IsNullOrEmpty(filename.Trim());
}
}
}