Decompiled source of TackleBox v0.5.2

GDWeave/mods/TackleBox/TackleBox.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using GDWeave;
using GDWeave.Godot;
using GDWeave.Godot.Variants;
using GDWeave.Modding;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("TackleBox")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1d39c7636c2db09c979ad5cff1e9bbfc8292ddea")]
[assembly: AssemblyProduct("TackleBox")]
[assembly: AssemblyTitle("TackleBox")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace TackleBox;

public class Mod : IMod, global::System.IDisposable
{
	public Mod(IModInterface modInterface)
	{
		modInterface.RegisterScriptMod((IScriptMod)(object)new TackleBox(modInterface.LoadedMods));
	}

	public void Dispose()
	{
	}
}
public class TackleBox : IScriptMod
{
	[CompilerGenerated]
	private sealed class <Modify>d__5 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
	{
		private int <>1__state;

		private Token <>2__current;

		private int <>l__initialThreadId;

		private global::System.Collections.Generic.IEnumerable<Token> tokens;

		public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

		public TackleBox <>4__this;

		private MultiTokenWaiter <extendsWaiter>5__2;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap2;

		private Token <token>5__4;

		private int <i>5__5;

		private string[] <>7__wrap5;

		private int <>7__wrap6;

		Token global::System.Collections.Generic.IEnumerator<Token>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object global::System.Collections.IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <Modify>d__5(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void global::System.IDisposable.Dispose()
		{
			int num = <>1__state;
			if (num == -3 || (uint)(num - 1) <= 8u)
			{
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}
		}

		private bool MoveNext()
		{
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Expected O, but got Unknown
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Expected O, but got Unknown
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Expected O, but got Unknown
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Expected O, but got Unknown
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Expected O, but got Unknown
			try
			{
				int num = <>1__state;
				TackleBox tackleBox = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<extendsWaiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[2]
					{
						(Token t) => (int)t.Type == 51,
						(Token t) => (int)t.Type == 89
					}, false, true);
					<>7__wrap2 = tokens.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					if (<extendsWaiter>5__2.Check(<token>5__4))
					{
						<>2__current = new Token((TokenType)59, (uint?)null);
						<>1__state = 2;
						return true;
					}
					break;
				case 2:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("loaded_mods");
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -3;
					<>2__current = new Token((TokenType)23, (uint?)null);
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -3;
					<>2__current = new Token((TokenType)76, (uint?)null);
					<>1__state = 5;
					return true;
				case 5:
					<>1__state = -3;
					<i>5__5 = 0;
					<>7__wrap5 = tackleBox.LoadedMods;
					<>7__wrap6 = 0;
					goto IL_0260;
				case 6:
					<>1__state = -3;
					if (<i>5__5++ < tackleBox.LoadedMods.Length)
					{
						<>2__current = new Token((TokenType)82, (uint?)null);
						<>1__state = 7;
						return true;
					}
					goto IL_0252;
				case 7:
					<>1__state = -3;
					goto IL_0252;
				case 8:
					<>1__state = -3;
					<>2__current = new Token((TokenType)89, (uint?)null);
					<>1__state = 9;
					return true;
				case 9:
					{
						<>1__state = -3;
						<token>5__4 = null;
						break;
					}
					IL_0252:
					<>7__wrap6++;
					goto IL_0260;
					IL_0260:
					if (<>7__wrap6 < <>7__wrap5.Length)
					{
						string text = <>7__wrap5[<>7__wrap6];
						<>2__current = (Token)new ConstantToken((Variant)new StringVariant(text));
						<>1__state = 6;
						return true;
					}
					<>7__wrap5 = null;
					<>2__current = new Token((TokenType)77, (uint?)null);
					<>1__state = 8;
					return true;
				}
				if (((global::System.Collections.IEnumerator)<>7__wrap2).MoveNext())
				{
					<token>5__4 = <>7__wrap2.Current;
					<>2__current = <token>5__4;
					<>1__state = 1;
					return true;
				}
				<>m__Finally1();
				<>7__wrap2 = null;
				return false;
			}
			catch
			{
				//try-fault
				((global::System.IDisposable)this).Dispose();
				throw;
			}
		}

		bool global::System.Collections.IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		private void <>m__Finally1()
		{
			<>1__state = -1;
			if (<>7__wrap2 != null)
			{
				((global::System.IDisposable)<>7__wrap2).Dispose();
			}
		}

		[DebuggerHidden]
		void global::System.Collections.IEnumerator.Reset()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}

		[DebuggerHidden]
		global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
		{
			<Modify>d__5 <Modify>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<Modify>d__ = this;
			}
			else
			{
				<Modify>d__ = new <Modify>d__5(0)
				{
					<>4__this = <>4__this
				};
			}
			<Modify>d__.tokens = <>3__tokens;
			return <Modify>d__;
		}

		[DebuggerHidden]
		global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
		{
			return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
		}
	}

	[field: CompilerGenerated]
	private string[] LoadedMods
	{
		[CompilerGenerated]
		get;
	}

	public TackleBox(string[] loadedMods)
	{
		LoadedMods = loadedMods;
		base..ctor();
	}

	public bool ShouldRun(string path)
	{
		return path == "res://Scenes/Singletons/globals.gdc";
	}

	[IteratorStateMachine(typeof(<Modify>d__5))]
	public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		MultiTokenWaiter extendsWaiter = new MultiTokenWaiter(new Func<Token, bool>[2]
		{
			(Token t) => (int)t.Type == 51,
			(Token t) => (int)t.Type == 89
		}, false, true);
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token token = enumerator.Current;
				yield return token;
				if (!extendsWaiter.Check(token))
				{
					continue;
				}
				yield return new Token((TokenType)59, (uint?)null);
				yield return (Token)new IdentifierToken("loaded_mods");
				yield return new Token((TokenType)23, (uint?)null);
				yield return new Token((TokenType)76, (uint?)null);
				int i = 0;
				string[] loadedMods = LoadedMods;
				foreach (string text in loadedMods)
				{
					yield return (Token)new ConstantToken((Variant)new StringVariant(text));
					if (i++ < LoadedMods.Length)
					{
						yield return new Token((TokenType)82, (uint?)null);
					}
				}
				yield return new Token((TokenType)77, (uint?)null);
				yield return new Token((TokenType)89, (uint?)null);
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
	}
}