using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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("WebfishingRichPresence")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+13abe24509360eea518d1c207b8fed9d4e415ac2")]
[assembly: AssemblyProduct("WebfishingRichPresence")]
[assembly: AssemblyTitle("WebfishingRichPresence")]
[assembly: AssemblyVersion("1.1.0.0")]
[module: RefSafetyRules(11)]
namespace WebfishingRichPresence;
public class LibRpcFetcher : IScriptMod
{
[CompilerGenerated]
private sealed class <Modify>d__1 : 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;
private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap1;
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__1(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 || num == 1)
{
try
{
}
finally
{
<>m__Finally1();
}
}
}
private bool MoveNext()
{
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>7__wrap1 = tokens.GetEnumerator();
<>1__state = -3;
break;
case 1:
<>1__state = -3;
break;
}
if (((global::System.Collections.IEnumerator)<>7__wrap1).MoveNext())
{
Token current = <>7__wrap1.Current;
ConstantToken val = (ConstantToken)(object)((current is ConstantToken) ? current : null);
if (val != null)
{
Variant value = val.Value;
StringVariant val2 = (StringVariant)(object)((value is StringVariant) ? value : null);
if (val2 != null && val2.Value == "%LIBRPCPATH%")
{
val2.Value = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "librpc.dll");
}
}
<>2__current = current;
<>1__state = 1;
return true;
}
<>m__Finally1();
<>7__wrap1 = 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__wrap1 != null)
{
((global::System.IDisposable)<>7__wrap1).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__1 <Modify>d__;
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
<Modify>d__ = this;
}
else
{
<Modify>d__ = new <Modify>d__1(0);
}
<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();
}
}
public bool ShouldRun(string path)
{
return path == "res://mods/WebfishingRichPresence/main.gdc";
}
[IteratorStateMachine(typeof(<Modify>d__1))]
public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
{
global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
try
{
while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
{
Token current = enumerator.Current;
ConstantToken val = (ConstantToken)(object)((current is ConstantToken) ? current : null);
if (val != null)
{
Variant value = val.Value;
StringVariant val2 = (StringVariant)(object)((value is StringVariant) ? value : null);
if (val2 != null && val2.Value == "%LIBRPCPATH%")
{
val2.Value = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "librpc.dll");
}
}
yield return current;
}
}
finally
{
((global::System.IDisposable)enumerator)?.Dispose();
}
}
}
public class Mod : IMod, global::System.IDisposable
{
public Mod(IModInterface modInterface)
{
modInterface.RegisterScriptMod((IScriptMod)(object)new LibRpcFetcher());
modInterface.RegisterScriptMod((IScriptMod)(object)new RichPresenceForwarder());
}
public void Dispose()
{
}
}
public class RichPresenceForwarder : IScriptMod
{
[CompilerGenerated]
private sealed class <Modify>d__1 : 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;
private MultiTokenWaiter <setRichPresenceWaiter>5__2;
private MultiTokenWaiter <emitMembersUpdatedWaiter>5__3;
private TokenWaiter <newlineWaiter>5__4;
private bool <settingStatus>5__5;
private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap5;
private Token <token>5__7;
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__1(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) <= 16u)
{
try
{
}
finally
{
<>m__Finally1();
}
}
}
private bool MoveNext()
{
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Expected O, but got Unknown
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Expected O, but got Unknown
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Expected O, but got Unknown
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Expected O, but got Unknown
//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0307: Expected O, but got Unknown
//IL_0323: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Expected O, but got Unknown
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Expected O, but got Unknown
//IL_0354: Unknown result type (might be due to invalid IL or missing references)
//IL_035e: Expected O, but got Unknown
//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
//IL_03bc: Expected O, but got Unknown
//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
//IL_03e3: Expected O, but got Unknown
//IL_0406: Unknown result type (might be due to invalid IL or missing references)
//IL_0410: Expected O, but got Unknown
//IL_045f: Unknown result type (might be due to invalid IL or missing references)
//IL_0469: Expected O, but got Unknown
//IL_0486: Unknown result type (might be due to invalid IL or missing references)
//IL_0490: Expected O, but got Unknown
//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
//IL_04bd: Expected O, but got Unknown
//IL_0432: Unknown result type (might be due to invalid IL or missing references)
//IL_043c: Expected O, but got Unknown
//IL_0385: Unknown result type (might be due to invalid IL or missing references)
//IL_038f: Expected O, but got Unknown
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Expected O, but got Unknown
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Expected O, but got Unknown
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Expected O, but got Unknown
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Expected O, but got Unknown
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<setRichPresenceWaiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[2]
{
(Token t) => (int)t.Type == 48,
delegate(Token t)
{
IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val4 != null && val4.Name == "set_rich_presence";
}
}, false, false);
<emitMembersUpdatedWaiter>5__3 = new MultiTokenWaiter(new Func<Token, bool>[4]
{
delegate(Token t)
{
IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val3 != null && val3.Name == "emit_signal";
},
(Token t) => (int)t.Type == 80,
delegate(Token t)
{
ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
if (val != null)
{
Variant value = val.Value;
StringVariant val2 = (StringVariant)(object)((value is StringVariant) ? value : null);
if (val2 != null)
{
return val2.Value == "_members_updated";
}
}
return false;
},
(Token t) => (int)t.Type == 81
}, false, false);
<newlineWaiter>5__4 = new TokenWaiter((Func<Token, bool>)((Token t) => (int)t.Type == 89), true);
<settingStatus>5__5 = false;
<>7__wrap5 = tokens.GetEnumerator();
<>1__state = -3;
break;
case 1:
<>1__state = -3;
if (<setRichPresenceWaiter>5__2.Check(<token>5__7))
{
<settingStatus>5__5 = true;
<newlineWaiter>5__4.SetReady();
}
else if (<emitMembersUpdatedWaiter>5__3.Check(<token>5__7))
{
<settingStatus>5__5 = false;
<newlineWaiter>5__4.SetReady();
}
else if (<newlineWaiter>5__4.Check(<token>5__7))
{
<>2__current = new Token((TokenType)38, (uint?)null);
<>1__state = 2;
return true;
}
goto IL_04fc;
case 2:
<>1__state = -3;
<>2__current = new Token((TokenType)87, (uint?)null);
<>1__state = 3;
return true;
case 3:
<>1__state = -3;
<>2__current = (Token)new ConstantToken((Variant)new StringVariant("/root/WebfishingRichPresence"));
<>1__state = 4;
return true;
case 4:
<>1__state = -3;
<>2__current = new Token((TokenType)86, (uint?)null);
<>1__state = 5;
return true;
case 5:
<>1__state = -3;
<>2__current = new Token((TokenType)87, (uint?)null);
<>1__state = 6;
return true;
case 6:
<>1__state = -3;
<>2__current = (Token)new ConstantToken((Variant)new StringVariant("/root/WebfishingRichPresence"));
<>1__state = 7;
return true;
case 7:
<>1__state = -3;
<>2__current = new Token((TokenType)84, (uint?)null);
<>1__state = 8;
return true;
case 8:
<>1__state = -3;
if (<settingStatus>5__5)
{
<>2__current = (Token)new IdentifierToken("set_status");
<>1__state = 9;
return true;
}
<>2__current = (Token)new IdentifierToken("set_num_players");
<>1__state = 13;
return true;
case 9:
<>1__state = -3;
<>2__current = new Token((TokenType)80, (uint?)null);
<>1__state = 10;
return true;
case 10:
<>1__state = -3;
<>2__current = (Token)new IdentifierToken("token");
<>1__state = 11;
return true;
case 11:
<>1__state = -3;
<>2__current = new Token((TokenType)81, (uint?)null);
<>1__state = 12;
return true;
case 12:
<>1__state = -3;
goto IL_04d1;
case 13:
<>1__state = -3;
<>2__current = new Token((TokenType)80, (uint?)null);
<>1__state = 14;
return true;
case 14:
<>1__state = -3;
<>2__current = (Token)new IdentifierToken("MEMBERS");
<>1__state = 15;
return true;
case 15:
<>1__state = -3;
<>2__current = new Token((TokenType)81, (uint?)null);
<>1__state = 16;
return true;
case 16:
<>1__state = -3;
goto IL_04d1;
case 17:
{
<>1__state = -3;
<newlineWaiter>5__4.Reset();
goto IL_04fc;
}
IL_04d1:
<>2__current = <token>5__7;
<>1__state = 17;
return true;
IL_04fc:
<token>5__7 = null;
break;
}
if (((global::System.Collections.IEnumerator)<>7__wrap5).MoveNext())
{
<token>5__7 = <>7__wrap5.Current;
<>2__current = <token>5__7;
<>1__state = 1;
return true;
}
<>m__Finally1();
<>7__wrap5 = 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__wrap5 != null)
{
((global::System.IDisposable)<>7__wrap5).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__1 <Modify>d__;
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
<Modify>d__ = this;
}
else
{
<Modify>d__ = new <Modify>d__1(0);
}
<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();
}
}
public bool ShouldRun(string path)
{
return path == "res://Scenes/Singletons/SteamNetwork.gdc";
}
[IteratorStateMachine(typeof(<Modify>d__1))]
public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
{
MultiTokenWaiter setRichPresenceWaiter = new MultiTokenWaiter(new Func<Token, bool>[2]
{
(Token t) => (int)t.Type == 48,
delegate(Token t)
{
IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val4 != null && val4.Name == "set_rich_presence";
}
}, false, false);
MultiTokenWaiter emitMembersUpdatedWaiter = new MultiTokenWaiter(new Func<Token, bool>[4]
{
delegate(Token t)
{
IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val3 != null && val3.Name == "emit_signal";
},
(Token t) => (int)t.Type == 80,
delegate(Token t)
{
ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
if (val != null)
{
Variant value = val.Value;
StringVariant val2 = (StringVariant)(object)((value is StringVariant) ? value : null);
if (val2 != null)
{
return val2.Value == "_members_updated";
}
}
return false;
},
(Token t) => (int)t.Type == 81
}, false, false);
TokenWaiter newlineWaiter = new TokenWaiter((Func<Token, bool>)((Token t) => (int)t.Type == 89), true);
bool settingStatus = false;
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 (setRichPresenceWaiter.Check(token))
{
settingStatus = true;
newlineWaiter.SetReady();
}
else if (emitMembersUpdatedWaiter.Check(token))
{
settingStatus = false;
newlineWaiter.SetReady();
}
else if (newlineWaiter.Check(token))
{
yield return new Token((TokenType)38, (uint?)null);
yield return new Token((TokenType)87, (uint?)null);
yield return (Token)new ConstantToken((Variant)new StringVariant("/root/WebfishingRichPresence"));
yield return new Token((TokenType)86, (uint?)null);
yield return new Token((TokenType)87, (uint?)null);
yield return (Token)new ConstantToken((Variant)new StringVariant("/root/WebfishingRichPresence"));
yield return new Token((TokenType)84, (uint?)null);
if (settingStatus)
{
yield return (Token)new IdentifierToken("set_status");
yield return new Token((TokenType)80, (uint?)null);
yield return (Token)new IdentifierToken("token");
yield return new Token((TokenType)81, (uint?)null);
}
else
{
yield return (Token)new IdentifierToken("set_num_players");
yield return new Token((TokenType)80, (uint?)null);
yield return (Token)new IdentifierToken("MEMBERS");
yield return new Token((TokenType)81, (uint?)null);
}
yield return token;
newlineWaiter.Reset();
}
}
}
finally
{
((global::System.IDisposable)enumerator)?.Dispose();
}
}
}