Decompiled source of YapBack v0.0.2

GDWeave/mods/Toes.YapBack/YapBack.dll

Decompiled 2 weeks 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;
using YapBack.Patches;

[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("Toes")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("Socks")]
[assembly: AssemblyTitle("YapBack")]
[assembly: AssemblyVersion("0.0.1.0")]
[module: RefSafetyRules(11)]
namespace YapBack
{
	public class Mod : IMod, global::System.IDisposable
	{
		public static Mod Instance;

		public Mod(IModInterface modInterface)
		{
			Instance = this;
			modInterface.RegisterScriptMod((IScriptMod)(object)new ChatPatch());
			modInterface.Logger.Information("YapBack -- Toes -- loaded");
		}

		public void Dispose()
		{
		}
	}
}
namespace YapBack.Patches
{
	public class ChatPatch : IScriptMod
	{
		[CompilerGenerated]
		private sealed class <Modify>d__2 : 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 string path;

			public string <>3__path;

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

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

			public ChatPatch <>4__this;

			private MultiTokenWaiter <three>5__1;

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

			private Token <token>5__3;

			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__2(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) > 6u)
				{
					return;
				}
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}

			private bool MoveNext()
			{
				//IL_0225: Unknown result type (might be due to invalid IL or missing references)
				//IL_022f: Expected O, but got Unknown
				//IL_0251: Unknown result type (might be due to invalid IL or missing references)
				//IL_025b: Expected O, but got Unknown
				//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0209: Expected O, but got Unknown
				//IL_019f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a9: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<three>5__1 = new MultiTokenWaiter(new Func<Token, bool>[9]
						{
							delegate(Token t)
							{
								IdentifierToken val5 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val5 != null && val5.Name == "_update_chat";
							},
							(Token t) => (int)t.Type == 80,
							delegate(Token t)
							{
								IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val4 != null && val4.Name == "text";
							},
							(Token t) => (int)t.Type == 82,
							delegate(Token t)
							{
								IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
								return val3 != null && val3.Name == "local";
							},
							(Token t) => (int)t.Type == 23,
							delegate(Token t)
							{
								ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
								int result;
								if (val != null)
								{
									Variant value = val.Value;
									BoolVariant val2 = (BoolVariant)(object)((value is BoolVariant) ? value : null);
									if (val2 != null)
									{
										result = ((!val2.Value) ? 1 : 0);
										goto IL_0025;
									}
								}
								result = 0;
								goto IL_0025;
								IL_0025:
								return (byte)result != 0;
							},
							(Token t) => (int)t.Type == 81,
							(Token t) => (int)t.Type == 86
						}, false, false);
						<>s__2 = tokens.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						<>2__current = (Token)new IdentifierToken("GAMECHAT_COLLECTIONS");
						<>1__state = 2;
						return true;
					case 2:
						<>1__state = -3;
						<>2__current = new Token((TokenType)84, (uint?)null);
						<>1__state = 3;
						return true;
					case 3:
						<>1__state = -3;
						<>2__current = <token>5__3;
						<>1__state = 4;
						return true;
					case 4:
						<>1__state = -3;
						<>2__current = <token>5__3;
						<>1__state = 5;
						return true;
					case 5:
						<>1__state = -3;
						<>2__current = <token>5__3;
						<>1__state = 6;
						return true;
					case 6:
						<>1__state = -3;
						goto IL_02f5;
					case 7:
						{
							<>1__state = -3;
							goto IL_02f5;
						}
						IL_02f5:
						<token>5__3 = null;
						break;
					}
					if (((global::System.Collections.IEnumerator)<>s__2).MoveNext())
					{
						<token>5__3 = <>s__2.Current;
						if (<three>5__1.Check(<token>5__3))
						{
							<>2__current = new Token((TokenType)38, (uint?)null);
							<>1__state = 1;
							return true;
						}
						<>2__current = <token>5__3;
						<>1__state = 7;
						return true;
					}
					<>m__Finally1();
					<>s__2 = 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 (<>s__2 != null)
				{
					((global::System.IDisposable)<>s__2).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__2 <Modify>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Modify>d__ = this;
				}
				else
				{
					<Modify>d__ = new <Modify>d__2(0)
					{
						<>4__this = <>4__this
					};
				}
				<Modify>d__.path = <>3__path;
				<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();
			}
		}

		private const int MAX_LINES = 12;

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

		[IteratorStateMachine(typeof(<Modify>d__2))]
		public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
		{
			MultiTokenWaiter three = new MultiTokenWaiter(new Func<Token, bool>[9]
			{
				delegate(Token t)
				{
					IdentifierToken val5 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val5 != null && val5.Name == "_update_chat";
				},
				(Token t) => (int)t.Type == 80,
				delegate(Token t)
				{
					IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val4 != null && val4.Name == "text";
				},
				(Token t) => (int)t.Type == 82,
				delegate(Token t)
				{
					IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val3 != null && val3.Name == "local";
				},
				(Token t) => (int)t.Type == 23,
				delegate(Token t)
				{
					ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
					int result;
					if (val != null)
					{
						Variant value = val.Value;
						BoolVariant val2 = (BoolVariant)(object)((value is BoolVariant) ? value : null);
						if (val2 != null)
						{
							result = ((!val2.Value) ? 1 : 0);
							goto IL_0025;
						}
					}
					result = 0;
					goto IL_0025;
					IL_0025:
					return (byte)result != 0;
				},
				(Token t) => (int)t.Type == 81,
				(Token t) => (int)t.Type == 86
			}, false, false);
			global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
			try
			{
				while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
				{
					Token token = enumerator.Current;
					if (three.Check(token))
					{
						yield return new Token((TokenType)38, (uint?)null);
						yield return (Token)new IdentifierToken("GAMECHAT_COLLECTIONS");
						yield return new Token((TokenType)84, (uint?)null);
						yield return token;
						yield return token;
						yield return token;
					}
					else
					{
						yield return token;
					}
				}
			}
			finally
			{
				((global::System.IDisposable)enumerator)?.Dispose();
			}
		}
	}
}