Decompiled source of RumblePiShock v1.0.3
Mods/RumblePiShock.dll
Decompiled 2 months agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using Il2CppRUMBLE.Managers; using Il2CppRUMBLE.Utilities; using MelonLoader; using RumbleModUI; using RumbleModdingAPI; using RumblePiShock; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(main), "RumblePiShock", "1.0.3", "UlvakSkillz", null)] [assembly: MelonGame("Buckethead Entertainment", "RUMBLE")] [assembly: MelonColor(255, 195, 0, 255)] [assembly: MelonAuthorColor(255, 195, 0, 255)] [assembly: VerifyLoaderVersion(0, 6, 2, true)] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ba617958-e188-4730-ab7a-182e0ebc1e2b")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyVersion("0.0.0.0")] namespace RumblePiShock; public static class ModBuildInfo { public const string Version = "1.0.3"; } public class PiShockInfo { public string UserName; public string APIKey; public string ShareCode; public PiShockInfo(string userName, string apiKey, string shareCode) { UserName = userName; APIKey = apiKey; ShareCode = shareCode; } } public class main : MelonMod { private string FILEPATH = "UserData\\PiShock"; private string FILENAME = "UserInfo.txt"; private string currentScene = "Loader"; private bool piShockLoaded = false; private int sceneCount = 0; private int health; private bool waitForMatchStart = false; private UI UI = UI.instance; private Mod RumblePiShock = new Mod(); private bool enabled = true; private bool mode = true; private int multiplier = 1; private int duration = 1; private int maxShock = 100; private int maxVibrate = 100; private bool roundLossTrigger = true; private int roundLossIntensity = 50; private bool randomIntensity = false; private Random random = new Random(); private bool shockSent = false; private void Log(string msg) { MelonLogger.Msg(msg); } private void Error(string msg) { MelonLogger.Error(msg); } private IEnumerator OpenExternalProgram(string programPath, string parameters) { ProcessStartInfo startInfo = new ProcessStartInfo { FileName = programPath, Arguments = parameters, UseShellExecute = false }; Process process = Process.Start(startInfo); while (!process.HasExited) { yield return (object)new WaitForSeconds(0.1f); } if (process.ExitCode == 0 && !piShockLoaded) { Log("PiShock Found!"); piShockLoaded = true; } } public void RunTestBeep() { MelonCoroutines.Start(OpenExternalProgram(FILEPATH + "\\PiShocker.exe", "2|1|50")); } public void RunShocker(int mode, int duration, int intensity) { MelonCoroutines.Start(OpenExternalProgram(FILEPATH + "\\PiShocker.exe", $"{mode}|{duration}|{intensity}")); } public override void OnLateInitializeMelon() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Expected O, but got Unknown //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Expected O, but got Unknown RumblePiShock.ModName = "RumblePiShock"; RumblePiShock.ModVersion = "1.0.3"; RumblePiShock.SetFolder("PiShock"); RumblePiShock.AddToList("Enabled", true, 0, "Toggles PiShock Usage", new Tags()); RumblePiShock.AddToList("Multiplier", 1, "Multiplier for Shock/Vibrate", new Tags()); RumblePiShock.AddToList("Mode", true, 0, $"Mode:{Environment.NewLine}On : Shock{Environment.NewLine}Off : Vibrate{Environment.NewLine}", new Tags()); RumblePiShock.AddToList("Duration", 1, "Time in Seconds to Shock/Vibrate 1 - 15", new Tags()); RumblePiShock.AddToList("Max Shock", 100, "Max Shock Level: 0 - 100", new Tags()); RumblePiShock.AddToList("Max Vibrate", 100, "Max Vibrate Level: 0 - 100", new Tags()); RumblePiShock.AddToList("Round Loss Trigger", true, 0, "Shock/Vibrate on Round Loss", new Tags()); RumblePiShock.AddToList("Round Loss Intensity", 50, "Shock/Vibrate intensity on Round Loss", new Tags()); RumblePiShock.AddToList("Random Intensity", false, 0, "Random Shock/Vibrate Intensity on Damage", new Tags()); RumblePiShock.GetFromFile(); RumblePiShock.ModSaved += Save; Save(); UI.instance.UI_Initialized += UIInit; Calls.onMapInitialized += SceneInit; if (File.Exists(FILEPATH + "\\" + FILENAME)) { RunTestBeep(); } else { Error("File Not Found: " + FILEPATH + "\\" + FILENAME); } } private void Save() { enabled = (bool)RumblePiShock.Settings[0].SavedValue; multiplier = (int)RumblePiShock.Settings[1].SavedValue; mode = (bool)RumblePiShock.Settings[2].SavedValue; if ((int)RumblePiShock.Settings[3].SavedValue < 1) { RumblePiShock.Settings[3].SavedValue = 1; } else if ((int)RumblePiShock.Settings[3].SavedValue > 15) { RumblePiShock.Settings[3].SavedValue = 15; } duration = (int)RumblePiShock.Settings[3].SavedValue; if ((int)RumblePiShock.Settings[4].SavedValue < 0) { RumblePiShock.Settings[4].SavedValue = 0; } else if ((int)RumblePiShock.Settings[4].SavedValue > 100) { RumblePiShock.Settings[4].SavedValue = 100; } maxShock = (int)RumblePiShock.Settings[4].SavedValue; if ((int)RumblePiShock.Settings[5].SavedValue < 0) { RumblePiShock.Settings[5].SavedValue = 0; } else if ((int)RumblePiShock.Settings[5].SavedValue > 100) { RumblePiShock.Settings[5].SavedValue = 100; } maxVibrate = (int)RumblePiShock.Settings[5].SavedValue; roundLossTrigger = (bool)RumblePiShock.Settings[6].SavedValue; if ((int)RumblePiShock.Settings[7].SavedValue < 0) { RumblePiShock.Settings[7].SavedValue = 0; } else if ((int)RumblePiShock.Settings[7].SavedValue > 100) { RumblePiShock.Settings[7].SavedValue = 100; } roundLossIntensity = (int)RumblePiShock.Settings[7].SavedValue; randomIntensity = (bool)RumblePiShock.Settings[8].SavedValue; } private void UIInit() { UI.AddMod(RumblePiShock); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { currentScene = sceneName; sceneCount++; } private void SceneInit() { if (piShockLoaded && (currentScene == "Map0" || currentScene == "Map1")) { MelonCoroutines.Start(HealthWatcher(sceneCount)); } } private IEnumerator HealthWatcher(int sceneNumber) { MelonCoroutines.Start(WaitForMatchStart(0, sceneNumber)); yield return (object)new WaitForSeconds(3f); health = Singleton<PlayerManager>.instance.localPlayer.Data.HealthPoints; while (sceneNumber == sceneCount) { if (enabled && !waitForMatchStart) { try { for (int i = 0; i < Singleton<PlayerManager>.instance.AllPlayers.Count; i++) { if (Singleton<PlayerManager>.instance.AllPlayers[i].Data.HealthPoints != 0 || waitForMatchStart) { continue; } if (roundLossTrigger && !shockSent && i == 0) { int damage2 = roundLossIntensity; int tempMode; if (mode) { if (damage2 > maxShock) { damage2 = maxShock; } tempMode = 0; } else { tempMode = 1; if (damage2 > maxVibrate) { damage2 = maxVibrate; } } shockSent = true; RunShocker(tempMode, duration, damage2); } MelonCoroutines.Start(WaitForMatchStart(i, sceneNumber)); } if (health > Singleton<PlayerManager>.instance.localPlayer.Data.HealthPoints && !shockSent) { int damage = (health - Singleton<PlayerManager>.instance.localPlayer.Data.HealthPoints) * 5 * multiplier; if (randomIntensity) { damage = random.Next(1, 21) * 5; } int tempMode2; if (mode) { if (damage > maxShock) { damage = maxShock; } tempMode2 = 0; } else { if (damage > maxVibrate) { damage = maxVibrate; } tempMode2 = 1; } RunShocker(tempMode2, duration, damage); } health = Singleton<PlayerManager>.instance.localPlayer.Data.HealthPoints; } catch { } } yield return (object)new WaitForFixedUpdate(); } } private IEnumerator WaitForMatchStart(int playerNumber, int sceneNumber) { yield return (object)new WaitForSeconds(0.5f); waitForMatchStart = true; while (waitForMatchStart && sceneCount == sceneNumber) { try { if (Singleton<PlayerManager>.instance.AllPlayers[playerNumber].Data.HealthPoints == 20) { health = Singleton<PlayerManager>.instance.localPlayer.Data.HealthPoints; waitForMatchStart = false; } } catch { } yield return (object)new WaitForFixedUpdate(); } shockSent = false; } }
UserData/PiShock/Refit.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Buffers; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Net.Http.Json; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using System.Web; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(/*Could not decode attribute arguments.*/)] [assembly: AssemblyFileVersion("7.0.0.12")] [assembly: AssemblyInformationalVersion("7.0.0.12+4744780644")] [assembly: InternalsVisibleTo("Refit.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001009dc017250415a0d51fddb74de84257c388028f04893673ca5c8f9e7145aea2b11443cb49dd79386d2255179a79ec516466b621f77e43386e711b775f77bb0e4b217f8c208c054e5f515ae33ee76bac1b56cdc20e1c151cf026a9b7f8362f1963825e546e16b360dfc63fe670403c9d6152c24491dd5dfb9ff68fe102ef3e1aed")] [assembly: InternalsVisibleTo("Refit.HttpClientFactory, PublicKey=00240000048000009400000006020000002400005253413100040000010001009dc017250415a0d51fddb74de84257c388028f04893673ca5c8f9e7145aea2b11443cb49dd79386d2255179a79ec516466b621f77e43386e711b775f77bb0e4b217f8c208c054e5f515ae33ee76bac1b56cdc20e1c151cf026a9b7f8362f1963825e546e16b360dfc63fe670403c9d6152c24491dd5dfb9ff68fe102ef3e1aed")] [assembly: InternalsVisibleTo("Refit.Newtonsoft.Json, PublicKey=00240000048000009400000006020000002400005253413100040000010001009dc017250415a0d51fddb74de84257c388028f04893673ca5c8f9e7145aea2b11443cb49dd79386d2255179a79ec516466b621f77e43386e711b775f77bb0e4b217f8c208c054e5f515ae33ee76bac1b56cdc20e1c151cf026a9b7f8362f1963825e546e16b360dfc63fe670403c9d6152c24491dd5dfb9ff68fe102ef3e1aed")] [assembly: InternalsVisibleTo("Refit.Xml, PublicKey=00240000048000009400000006020000002400005253413100040000010001009dc017250415a0d51fddb74de84257c388028f04893673ca5c8f9e7145aea2b11443cb49dd79386d2255179a79ec516466b621f77e43386e711b775f77bb0e4b217f8c208c054e5f515ae33ee76bac1b56cdc20e1c151cf026a9b7f8362f1963825e546e16b360dfc63fe670403c9d6152c24491dd5dfb9ff68fe102ef3e1aed")] [assembly: TargetFramework(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")] [assembly: AssemblyMetadata("CommitHash", "4744780644ecaa5e23ee93fccbadd9528eaa6add")] [assembly: AssemblyCompany(".NET Foundation and Contributors")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright (c) .NET Foundation and Contributors")] [assembly: AssemblyDescription("The automatic type-safe REST library for Xamarin and .NET")] [assembly: AssemblyProduct("Refit (net7.0)")] [assembly: AssemblyTitle("Refit")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/reactiveui/refit")] [assembly: AssemblyVersion("7.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : System.Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(/*Could not decode attribute arguments.*/)] internal sealed class NullableAttribute : System.Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(/*Could not decode attribute arguments.*/)] internal sealed class NullableContextAttribute : System.Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(/*Could not decode attribute arguments.*/)] internal sealed class RefSafetyRulesAttribute : System.Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [GeneratedCode("Nerdbank.GitVersioning.Tasks", "3.6.133.12845")] [ExcludeFromCodeCoverage] internal static class ThisAssembly { internal const string AssemblyConfiguration = "Release"; internal const string AssemblyFileVersion = "7.0.0.12"; internal const string AssemblyInformationalVersion = "7.0.0.12+4744780644"; internal const string AssemblyName = "Refit"; internal const string AssemblyTitle = "Refit"; internal const string AssemblyVersion = "7.0.0.0"; internal static readonly System.DateTime GitCommitDate = new System.DateTime(638236596140000000L, (DateTimeKind)1); internal const string GitCommitId = "4744780644ecaa5e23ee93fccbadd9528eaa6add"; internal const bool IsPrerelease = false; internal const bool IsPublicRelease = true; internal const string PublicKey = "00240000048000009400000006020000002400005253413100040000010001009dc017250415a0d51fddb74de84257c388028f04893673ca5c8f9e7145aea2b11443cb49dd79386d2255179a79ec516466b621f77e43386e711b775f77bb0e4b217f8c208c054e5f515ae33ee76bac1b56cdc20e1c151cf026a9b7f8362f1963825e546e16b360dfc63fe670403c9d6152c24491dd5dfb9ff68fe102ef3e1aed"; internal const string PublicKeyToken = "2f9b1262776509f5"; internal const string RootNamespace = "Refit"; } namespace System.Net.Http { [ExcludeFromCodeCoverage] internal class PushStreamContent : HttpContent { [StructLayout(0, Size = 1)] private struct AsyncVoid { } internal class CompleteTaskOnCloseStream : DelegatingStream { private readonly TaskCompletionSource<bool> serializeToStreamTask; public CompleteTaskOnCloseStream(Stream innerStream, TaskCompletionSource<bool> serializeToStreamTask) : base(innerStream) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) this.serializeToStreamTask = serializeToStreamTask ?? throw new ArgumentNullException("serializeToStreamTask"); } protected override void Dispose(bool disposing) { serializeToStreamTask.TrySetResult(true); } } [StructLayout(3)] [CompilerGenerated] private struct <SerializeToStreamAsync>d__9 : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder <>t__builder; public Stream stream; public PushStreamContent <>4__this; public TransportContext context; private TaskCompletionSource<bool> <serializeToStreamTask>5__2; private TaskAwaiter <>u__1; private TaskAwaiter<bool> <>u__2; private void MoveNext() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; PushStreamContent pushStreamContent = <>4__this; try { TaskAwaiter<bool> awaiter; TaskAwaiter awaiter2; if (num != 0) { if (num == 1) { awaiter = <>u__2; <>u__2 = default(TaskAwaiter<bool>); num = (<>1__state = -1); goto IL_00f6; } <serializeToStreamTask>5__2 = new TaskCompletionSource<bool>(); Stream val = (Stream)(object)new CompleteTaskOnCloseStream(stream, <serializeToStreamTask>5__2); awaiter2 = pushStreamContent.onStreamAvailable.Invoke(val, (HttpContent)(object)pushStreamContent, context).GetAwaiter(); if (!((TaskAwaiter)(ref awaiter2)).IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter2; ((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <SerializeToStreamAsync>d__9>(ref awaiter2, ref this); return; } } else { awaiter2 = <>u__1; <>u__1 = default(TaskAwaiter); num = (<>1__state = -1); } ((TaskAwaiter)(ref awaiter2)).GetResult(); awaiter = <serializeToStreamTask>5__2.Task.GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 1); <>u__2 = awaiter; ((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter<bool>, <SerializeToStreamAsync>d__9>(ref awaiter, ref this); return; } goto IL_00f6; IL_00f6: awaiter.GetResult(); } catch (System.Exception exception) { <>1__state = -2; <serializeToStreamTask>5__2 = null; ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; <serializeToStreamTask>5__2 = null; ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine); } } private readonly Func<Stream, HttpContent, TransportContext?, System.Threading.Tasks.Task> onStreamAvailable; public PushStreamContent(Action<Stream, HttpContent, TransportContext?> onStreamAvailable) : this(Taskify(onStreamAvailable), (MediaTypeHeaderValue?)null) { } public PushStreamContent(Func<Stream, HttpContent, TransportContext?, System.Threading.Tasks.Task> onStreamAvailable) : this(onStreamAvailable, (MediaTypeHeaderValue?)null) { } public PushStreamContent(Action<Stream, HttpContent, TransportContext?> onStreamAvailable, string mediaType) : this(Taskify(onStreamAvailable), new MediaTypeHeaderValue(mediaType)) { }//IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown public PushStreamContent(Func<Stream, HttpContent, TransportContext?, System.Threading.Tasks.Task> onStreamAvailable, string mediaType) : this(onStreamAvailable, new MediaTypeHeaderValue(mediaType)) { }//IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown public PushStreamContent(Action<Stream, HttpContent, TransportContext?> onStreamAvailable, MediaTypeHeaderValue? mediaType) : this(Taskify(onStreamAvailable), mediaType) { } public PushStreamContent(Func<Stream, HttpContent, TransportContext?, System.Threading.Tasks.Task> onStreamAvailable, MediaTypeHeaderValue? mediaType) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) this.onStreamAvailable = onStreamAvailable ?? throw new ArgumentNullException("onStreamAvailable"); ((HttpContent)this).Headers.ContentType = (MediaTypeHeaderValue)(((object)mediaType) ?? ((object)new MediaTypeHeaderValue("application/octet-stream"))); } private static Func<Stream, HttpContent, TransportContext?, System.Threading.Tasks.Task> Taskify(Action<Stream, HttpContent, TransportContext?> onStreamAvailable) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) Action<Stream, HttpContent, TransportContext?> onStreamAvailable2 = onStreamAvailable; if (onStreamAvailable2 == null) { throw new ArgumentNullException("onStreamAvailable"); } return delegate(Stream stream, HttpContent content, TransportContext? transportContext) { onStreamAvailable2.Invoke(stream, content, transportContext); return System.Threading.Tasks.Task.FromResult<AsyncVoid>(default(AsyncVoid)); }; } [AsyncStateMachine(typeof(<SerializeToStreamAsync>d__9))] protected override System.Threading.Tasks.Task SerializeToStreamAsync(Stream stream, TransportContext? context) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) <SerializeToStreamAsync>d__9 <SerializeToStreamAsync>d__ = default(<SerializeToStreamAsync>d__9); <SerializeToStreamAsync>d__.<>t__builder = AsyncTaskMethodBuilder.Create(); <SerializeToStreamAsync>d__.<>4__this = this; <SerializeToStreamAsync>d__.stream = stream; <SerializeToStreamAsync>d__.context = context; <SerializeToStreamAsync>d__.<>1__state = -1; ((AsyncTaskMethodBuilder)(ref <SerializeToStreamAsync>d__.<>t__builder)).Start<<SerializeToStreamAsync>d__9>(ref <SerializeToStreamAsync>d__); return ((AsyncTaskMethodBuilder)(ref <SerializeToStreamAsync>d__.<>t__builder)).Task; } protected override bool TryComputeLength(out long length) { length = -1L; return false; } } [ExcludeFromCodeCoverage] internal abstract class DelegatingStream : Stream { [field: CompilerGenerated] protected Stream InnerStream { [CompilerGenerated] get; [CompilerGenerated] private set; } public override bool CanRead => InnerStream.CanRead; public override bool CanSeek => InnerStream.CanSeek; public override bool CanWrite => InnerStream.CanWrite; public override long Length => InnerStream.Length; public override long Position { get { return InnerStream.Position; } set { InnerStream.Position = value; } } public override int ReadTimeout { get { return InnerStream.ReadTimeout; } set { InnerStream.ReadTimeout = value; } } public override bool CanTimeout => InnerStream.CanTimeout; public override int WriteTimeout { get { return InnerStream.WriteTimeout; } set { InnerStream.WriteTimeout = value; } } protected DelegatingStream(Stream innerStream) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) InnerStream = innerStream ?? throw new ArgumentNullException("innerStream"); } protected override void Dispose(bool disposing) { if (disposing) { InnerStream.Dispose(); } ((Stream)this).Dispose(disposing); } public override long Seek(long offset, SeekOrigin origin) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return InnerStream.Seek(offset, origin); } public override int Read(byte[] buffer, int offset, int count) { return InnerStream.Read(buffer, offset, count); } public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) return InnerStream.ReadAsync(buffer, offset, count, cancellationToken); } public override int ReadByte() { return InnerStream.ReadByte(); } public override void Flush() { InnerStream.Flush(); } public override System.Threading.Tasks.Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return InnerStream.CopyToAsync(destination, bufferSize, cancellationToken); } public override System.Threading.Tasks.Task FlushAsync(CancellationToken cancellationToken) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return InnerStream.FlushAsync(cancellationToken); } public override void SetLength(long value) { InnerStream.SetLength(value); } public override void Write(byte[] buffer, int offset, int count) { InnerStream.Write(buffer, offset, count); } public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) return InnerStream.WriteAsync(buffer, offset, count, cancellationToken); } public override void WriteByte(byte value) { InnerStream.WriteByte(value); } } } namespace System.Collections.Specialized { internal class NameValueCollection : Dictionary<string, string> { public string[] AllKeys => Enumerable.ToArray<string>((System.Collections.Generic.IEnumerable<string>)base.Keys); } } namespace Refit { internal sealed class AnonymousDisposable : System.IDisposable { private readonly Action block; public AnonymousDisposable(Action block) { this.block = block; } public void Dispose() { block.Invoke(); } } [Serializable] public class ApiException : System.Exception { [StructLayout(3)] [CompilerGenerated] private struct <Create>d__34 : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder<ApiException> <>t__builder; public string exceptionMessage; public HttpRequestMessage message; public HttpMethod httpMethod; public HttpResponseMessage response; public RefitSettings refitSettings; public System.Exception innerException; private ApiException <exception>5__2; private ConfiguredTaskAwaiter<string> <>u__1; private void MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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) int num = <>1__state; ApiException result; try { if (num == 0) { goto IL_006f; } <exception>5__2 = new ApiException(exceptionMessage, message, httpMethod, null, response.StatusCode, response.ReasonPhrase, response.Headers, refitSettings, innerException); if (response.Content != null) { goto IL_006f; } result = <exception>5__2; goto end_IL_0007; IL_006f: try { ConfiguredTaskAwaiter<string> awaiter; if (num != 0) { <exception>5__2.ContentHeaders = response.Content.Headers; awaiter = response.Content.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<string>, <Create>d__34>(ref awaiter, ref this); return; } } else { awaiter = <>u__1; <>u__1 = default(ConfiguredTaskAwaiter<string>); num = (<>1__state = -1); } string result2 = awaiter.GetResult(); <exception>5__2.Content = result2; HttpContentHeaders headers = response.Content.Headers; bool? obj; if (headers == null) { obj = null; } else { MediaTypeHeaderValue contentType = headers.ContentType; obj = ((contentType == null) ? null : contentType.MediaType?.Equals("application/problem+json")); } bool? flag = obj; if (flag.GetValueOrDefault()) { <exception>5__2 = ValidationApiException.Create(<exception>5__2); } response.Content.Dispose(); } catch { } result = <exception>5__2; end_IL_0007:; } catch (System.Exception exception) { <>1__state = -2; <exception>5__2 = null; <>t__builder.SetException(exception); return; } <>1__state = -2; <exception>5__2 = null; <>t__builder.SetResult(result); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { <>t__builder.SetStateMachine(stateMachine); } } [StructLayout(3)] [CompilerGenerated] private struct <GetContentAsAsync>d__32<T> : IAsyncStateMachine where T : notnull { public int <>1__state; public AsyncTaskMethodBuilder<T> <>t__builder; public ApiException <>4__this; private ConfiguredTaskAwaiter<T?> <>u__1; private void MoveNext() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; ApiException ex = <>4__this; T result; try { T val; ConfiguredTaskAwaiter<T> awaiter; if (num != 0) { if (!ex.HasContent) { val = default(T); goto IL_00ab; } awaiter = ex.RefitSettings.ContentSerializer.FromHttpContentAsync<T>((HttpContent)new StringContent(ex.Content)).ConfigureAwait(false).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<T>, <GetContentAsAsync>d__32<T>>(ref awaiter, ref this); return; } } else { awaiter = <>u__1; <>u__1 = default(ConfiguredTaskAwaiter<T>); num = (<>1__state = -1); } val = awaiter.GetResult(); goto IL_00ab; IL_00ab: result = val; } catch (System.Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(result); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { <>t__builder.SetStateMachine(stateMachine); } } [field: CompilerGenerated] public HttpStatusCode StatusCode { [CompilerGenerated] get; } [field: CompilerGenerated] public string? ReasonPhrase { [CompilerGenerated] get; } [field: CompilerGenerated] public HttpResponseHeaders Headers { [CompilerGenerated] get; } [field: CompilerGenerated] public HttpMethod HttpMethod { [CompilerGenerated] get; } public Uri? Uri => RequestMessage.RequestUri; [field: CompilerGenerated] public HttpRequestMessage RequestMessage { [CompilerGenerated] get; } [field: CompilerGenerated] public HttpContentHeaders? ContentHeaders { [CompilerGenerated] get; [CompilerGenerated] private set; } [field: CompilerGenerated] public string? Content { [CompilerGenerated] get; [CompilerGenerated] private set; } public bool HasContent => !string.IsNullOrWhiteSpace(Content); [field: CompilerGenerated] public RefitSettings RefitSettings { [CompilerGenerated] get; } protected ApiException(HttpRequestMessage message, HttpMethod httpMethod, string? content, HttpStatusCode statusCode, string? reasonPhrase, HttpResponseHeaders headers, RefitSettings refitSettings, System.Exception? innerException = null) : this(CreateMessage(statusCode, reasonPhrase), message, httpMethod, content, statusCode, reasonPhrase, headers, refitSettings, innerException) { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) protected ApiException(string exceptionMessage, HttpRequestMessage message, HttpMethod httpMethod, string? content, HttpStatusCode statusCode, string? reasonPhrase, HttpResponseHeaders headers, RefitSettings refitSettings, System.Exception? innerException = null) : base(exceptionMessage, innerException) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) RequestMessage = message; HttpMethod = httpMethod; StatusCode = statusCode; ReasonPhrase = reasonPhrase; Headers = headers; RefitSettings = refitSettings; Content = content; } [AsyncStateMachine(typeof(<GetContentAsAsync>d__32<>))] public async System.Threading.Tasks.Task<T?> GetContentAsAsync<T>() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return (!HasContent) ? default(T) : (await RefitSettings.ContentSerializer.FromHttpContentAsync<T>((HttpContent)new StringContent(Content)).ConfigureAwait(false)); } public static System.Threading.Tasks.Task<ApiException> Create(HttpRequestMessage message, HttpMethod httpMethod, HttpResponseMessage response, RefitSettings refitSettings, System.Exception? innerException = null) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Create(CreateMessage(response.StatusCode, response.ReasonPhrase), message, httpMethod, response, refitSettings, innerException); } [AsyncStateMachine(typeof(<Create>d__34))] public static async System.Threading.Tasks.Task<ApiException> Create(string exceptionMessage, HttpRequestMessage message, HttpMethod httpMethod, HttpResponseMessage response, RefitSettings refitSettings, System.Exception? innerException = null) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) ApiException exception = new ApiException(exceptionMessage, message, httpMethod, null, response.StatusCode, response.ReasonPhrase, response.Headers, refitSettings, innerException); if (response.Content == null) { return exception; } try { exception.ContentHeaders = response.Content.Headers; exception.Content = await response.Content.ReadAsStringAsync().ConfigureAwait(false); HttpContentHeaders headers = response.Content.Headers; bool? obj; if (headers == null) { obj = null; } else { MediaTypeHeaderValue contentType = headers.ContentType; obj = ((contentType == null) ? null : contentType.MediaType?.Equals("application/problem+json")); } bool? flag = obj; if (flag.GetValueOrDefault()) { exception = ValidationApiException.Create(exception); } response.Content.Dispose(); } catch { } return exception; } private static string CreateMessage(HttpStatusCode statusCode, string? reasonPhrase) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected I4, but got Unknown return $"Response status code does not indicate success: {(int)statusCode} ({reasonPhrase})."; } } internal static class ApiResponse { internal static T Create<T, TBody>(HttpResponseMessage resp, object? content, RefitSettings settings, ApiException? error = null) { return (T)Activator.CreateInstance(typeof(ApiResponse<TBody>), new object[4] { resp, content, settings, error }); } } public sealed class ApiResponse<T> : IApiResponse<T>, IApiResponse, System.IDisposable { [StructLayout(3)] [CompilerGenerated] private struct <EnsureSuccessStatusCodeAsync>d__28 : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder<ApiResponse<T>> <>t__builder; public ApiResponse<T> <>4__this; private ConfiguredTaskAwaiter<ApiException> <>u__1; private void MoveNext() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; ApiResponse<T> apiResponse = <>4__this; ApiResponse<T> result; try { ConfiguredTaskAwaiter<ApiException> awaiter; if (num == 0) { awaiter = <>u__1; <>u__1 = default(ConfiguredTaskAwaiter<ApiException>); num = (<>1__state = -1); goto IL_00b1; } ApiException ex; if (!apiResponse.IsSuccessStatusCode) { ex = apiResponse.Error; if (ex == null) { awaiter = ApiException.Create(apiResponse.response.RequestMessage, apiResponse.response.RequestMessage.Method, apiResponse.response, apiResponse.Settings).ConfigureAwait(false).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<ApiResponse<T>>, AsyncTaskMethodBuilder<ApiResponse<ApiResponse<T>>>>(ref <>t__builder).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<ApiException>, <EnsureSuccessStatusCodeAsync>d__28>(ref awaiter, ref this); return; } goto IL_00b1; } goto IL_00b9; } result = apiResponse; goto end_IL_000e; IL_00b1: ex = awaiter.GetResult(); goto IL_00b9; IL_00b9: ApiException ex2 = ex; apiResponse.Dispose(); throw ex2; end_IL_000e:; } catch (System.Exception exception) { <>1__state = -2; System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<ApiResponse<T>>, AsyncTaskMethodBuilder<ApiResponse<ApiResponse<T>>>>(ref <>t__builder).SetException(exception); return; } <>1__state = -2; System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<ApiResponse<T>>, AsyncTaskMethodBuilder<ApiResponse<ApiResponse<T>>>>(ref <>t__builder).SetResult((ApiResponse<ApiResponse<T>>)(object)result); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<ApiResponse<T>>, AsyncTaskMethodBuilder<ApiResponse<ApiResponse<T>>>>(ref <>t__builder).SetStateMachine(stateMachine); } } private readonly HttpResponseMessage response; private bool disposed; public T? Content { [CompilerGenerated] get; } public RefitSettings Settings { [CompilerGenerated] get; } public HttpResponseHeaders Headers => response.Headers; public HttpContentHeaders? ContentHeaders { get { HttpContent content = response.Content; if (content == null) { return null; } return content.Headers; } } [MemberNotNullWhen(true, "Content")] [MemberNotNullWhen(true, "ContentHeaders")] [MemberNotNullWhen(false, "Error")] public bool IsSuccessStatusCode { [MemberNotNullWhen(true, "Content")] [MemberNotNullWhen(true, "ContentHeaders")] [MemberNotNullWhen(false, "Error")] get { return response.IsSuccessStatusCode; } } public string? ReasonPhrase => response.ReasonPhrase; public HttpRequestMessage? RequestMessage => response.RequestMessage; public HttpStatusCode StatusCode => response.StatusCode; public Version Version => response.Version; public ApiException? Error { [CompilerGenerated] get; [CompilerGenerated] private set; } public ApiResponse(HttpResponseMessage response, T? content, RefitSettings settings, ApiException? error = null) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) this.response = response ?? throw new ArgumentNullException("response"); Error = error; Content = content; Settings = settings; } public void Dispose() { Dispose(disposing: true); } [AsyncStateMachine(typeof(ApiResponse<>.<EnsureSuccessStatusCodeAsync>d__28))] public async System.Threading.Tasks.Task<ApiResponse<T>> EnsureSuccessStatusCodeAsync() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (!IsSuccessStatusCode) { ApiException ex = Error; if (ex == null) { ex = await ApiException.Create(response.RequestMessage, response.RequestMessage.Method, response, Settings).ConfigureAwait(false); } ApiException ex2 = ex; Dispose(); throw ex2; } return this; } private void Dispose(bool disposing) { if (disposing && !disposed) { disposed = true; response.Dispose(); } } } public interface IApiResponse<out T> : IApiResponse, System.IDisposable { T? Content { get; } } public interface IApiResponse : System.IDisposable { HttpResponseHeaders Headers { get; } HttpContentHeaders? ContentHeaders { get; } [MemberNotNullWhen(true, "ContentHeaders")] [MemberNotNullWhen(false, "Error")] bool IsSuccessStatusCode { [MemberNotNullWhen(true, "ContentHeaders")] [MemberNotNullWhen(false, "Error")] get; } HttpStatusCode StatusCode { get; } string? ReasonPhrase { get; } HttpRequestMessage? RequestMessage { get; } Version Version { get; } ApiException? Error { get; } } public abstract class HttpMethodAttribute : System.Attribute { public abstract HttpMethod Method { get; } [field: CompilerGenerated] public virtual string Path { [CompilerGenerated] get; [CompilerGenerated] protected set; } public HttpMethodAttribute(string path) { Path = path; } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class GetAttribute : HttpMethodAttribute { public override HttpMethod Method => HttpMethod.Get; public GetAttribute(string path) : base(path) { } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class PostAttribute : HttpMethodAttribute { public override HttpMethod Method => HttpMethod.Post; public PostAttribute(string path) : base(path) { } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class PutAttribute : HttpMethodAttribute { public override HttpMethod Method => HttpMethod.Put; public PutAttribute(string path) : base(path) { } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class DeleteAttribute : HttpMethodAttribute { public override HttpMethod Method => HttpMethod.Delete; public DeleteAttribute(string path) : base(path) { } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class PatchAttribute : HttpMethodAttribute { public override HttpMethod Method => new HttpMethod("PATCH"); public PatchAttribute(string path) : base(path) { } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class OptionsAttribute : HttpMethodAttribute { public override HttpMethod Method => new HttpMethod("OPTIONS"); public OptionsAttribute(string path) : base(path) { } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class HeadAttribute : HttpMethodAttribute { public override HttpMethod Method => HttpMethod.Head; public HeadAttribute(string path) : base(path) { } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class MultipartAttribute : System.Attribute { [field: CompilerGenerated] public string BoundaryText { [CompilerGenerated] get; [CompilerGenerated] private set; } public MultipartAttribute(string boundaryText = "----MyGreatBoundary") { BoundaryText = boundaryText; } } public enum BodySerializationMethod { Default, [Obsolete("Use BodySerializationMethod.Serialized instead", false)] Json, UrlEncoded, Serialized } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class BodyAttribute : System.Attribute { [field: CompilerGenerated] public bool? Buffered { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public BodySerializationMethod SerializationMethod { [CompilerGenerated] get; [CompilerGenerated] protected set; } public BodyAttribute() { } public BodyAttribute(bool buffered) { Buffered = buffered; } public BodyAttribute(BodySerializationMethod serializationMethod, bool buffered) { SerializationMethod = serializationMethod; Buffered = buffered; } public BodyAttribute(BodySerializationMethod serializationMethod = BodySerializationMethod.Default) { SerializationMethod = serializationMethod; } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class AliasAsAttribute : System.Attribute { [field: CompilerGenerated] public string Name { [CompilerGenerated] get; [CompilerGenerated] protected set; } public AliasAsAttribute(string name) { Name = name; } } [AttributeUsage(/*Could not decode attribute arguments.*/)] [Obsolete("Use Refit.StreamPart, Refit.ByteArrayPart, Refit.FileInfoPart or if necessary, inherit from Refit.MultipartItem", false)] public class AttachmentNameAttribute : System.Attribute { [field: CompilerGenerated] public string Name { [CompilerGenerated] get; [CompilerGenerated] protected set; } public AttachmentNameAttribute(string name) { Name = name; } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class HeaderCollectionAttribute : System.Attribute { } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class HeadersAttribute : System.Attribute { [field: CompilerGenerated] public string[] Headers { [CompilerGenerated] get; } public HeadersAttribute(params string[] headers) { Headers = headers ?? System.Array.Empty<string>(); } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class HeaderAttribute : System.Attribute { [field: CompilerGenerated] public string Header { [CompilerGenerated] get; } public HeaderAttribute(string header) { Header = header; } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class PropertyAttribute : System.Attribute { [field: CompilerGenerated] public string? Key { [CompilerGenerated] get; } public PropertyAttribute() { } public PropertyAttribute(string key) { Key = key; } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class AuthorizeAttribute : System.Attribute { [field: CompilerGenerated] public string Scheme { [CompilerGenerated] get; } public AuthorizeAttribute(string scheme = "Bearer") { Scheme = scheme; } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class QueryAttribute : System.Attribute { private CollectionFormat? collectionFormat; [field: CompilerGenerated] public string Delimiter { [CompilerGenerated] get; [CompilerGenerated] protected set; } = "."; [field: CompilerGenerated] public string? Prefix { [CompilerGenerated] get; [CompilerGenerated] protected set; } [field: CompilerGenerated] public string? Format { [CompilerGenerated] get; [CompilerGenerated] set; } public CollectionFormat CollectionFormat { get { return collectionFormat.GetValueOrDefault(); } set { collectionFormat = value; } } public bool IsCollectionFormatSpecified => collectionFormat.HasValue; public QueryAttribute() { } public QueryAttribute(string delimiter) { Delimiter = delimiter; } public QueryAttribute(string delimiter, string prefix) { Delimiter = delimiter; Prefix = prefix; } public QueryAttribute(string delimiter, string prefix, string format) { Delimiter = delimiter; Prefix = prefix; Format = format; } public QueryAttribute(CollectionFormat collectionFormat) { CollectionFormat = collectionFormat; } } [AttributeUsage(/*Could not decode attribute arguments.*/)] public class QueryUriFormatAttribute : System.Attribute { [field: CompilerGenerated] public UriFormat UriFormat { [CompilerGenerated] get; } public QueryUriFormatAttribute(UriFormat uriFormat) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) UriFormat = uriFormat; } } internal class AuthenticatedHttpClientHandler : DelegatingHandler { [StructLayout(3)] [CompilerGenerated] private struct <SendAsync>d__2 : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder<HttpResponseMessage> <>t__builder; public HttpRequestMessage request; public AuthenticatedHttpClientHandler <>4__this; public CancellationToken cancellationToken; private AuthenticationHeaderValue <auth>5__2; private ConfiguredTaskAwaiter<string> <>u__1; private ConfiguredTaskAwaiter<HttpResponseMessage> <>u__2; private void MoveNext() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; AuthenticatedHttpClientHandler authenticatedHttpClientHandler = <>4__this; HttpResponseMessage result2; try { ConfiguredTaskAwaiter<HttpResponseMessage> awaiter; ConfiguredTaskAwaiter<string> awaiter2; if (num != 0) { if (num == 1) { awaiter = <>u__2; <>u__2 = default(ConfiguredTaskAwaiter<HttpResponseMessage>); num = (<>1__state = -1); goto IL_013e; } <auth>5__2 = request.Headers.Authorization; if (<auth>5__2 == null) { goto IL_00d4; } awaiter2 = authenticatedHttpClientHandler.getToken.Invoke(request, cancellationToken).ConfigureAwait(false).GetAwaiter(); if (!awaiter2.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter2; <>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<string>, <SendAsync>d__2>(ref awaiter2, ref this); return; } } else { awaiter2 = <>u__1; <>u__1 = default(ConfiguredTaskAwaiter<string>); num = (<>1__state = -1); } string result = awaiter2.GetResult(); request.Headers.Authorization = new AuthenticationHeaderValue(<auth>5__2.Scheme, result); goto IL_00d4; IL_013e: result2 = awaiter.GetResult(); goto end_IL_000e; IL_00d4: awaiter = authenticatedHttpClientHandler.<>n__0(request, cancellationToken).ConfigureAwait(false).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 1); <>u__2 = awaiter; <>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<HttpResponseMessage>, <SendAsync>d__2>(ref awaiter, ref this); return; } goto IL_013e; end_IL_000e:; } catch (System.Exception exception) { <>1__state = -2; <auth>5__2 = null; <>t__builder.SetException(exception); return; } <>1__state = -2; <auth>5__2 = null; <>t__builder.SetResult(result2); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { <>t__builder.SetStateMachine(stateMachine); } } private readonly Func<HttpRequestMessage, CancellationToken, System.Threading.Tasks.Task<string>> getToken; public AuthenticatedHttpClientHandler(Func<HttpRequestMessage, CancellationToken, System.Threading.Tasks.Task<string>> getToken, HttpMessageHandler? innerHandler = null) : base((HttpMessageHandler)(((object)innerHandler) ?? ((object)new HttpClientHandler()))) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) this.getToken = getToken ?? throw new ArgumentNullException("getToken"); } [AsyncStateMachine(typeof(<SendAsync>d__2))] protected override async System.Threading.Tasks.Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_001f: Unknown result type (might be due to invalid IL or missing references) AuthenticationHeaderValue auth = request.Headers.Authorization; if (auth != null) { string text = await getToken.Invoke(request, cancellationToken).ConfigureAwait(false); request.Headers.Authorization = new AuthenticationHeaderValue(auth.Scheme, text); } return await <>n__0(request, cancellationToken).ConfigureAwait(false); } [CompilerGenerated] [DebuggerHidden] private System.Threading.Tasks.Task<HttpResponseMessage> <>n__0(HttpRequestMessage request, CancellationToken cancellationToken) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return ((DelegatingHandler)this).SendAsync(request, cancellationToken); } } internal class CachedRequestBuilderImplementation<T> : CachedRequestBuilderImplementation, IRequestBuilder<T>, IRequestBuilder { public CachedRequestBuilderImplementation(IRequestBuilder<T> innerBuilder) : base(innerBuilder) { } } internal class CachedRequestBuilderImplementation : IRequestBuilder { private readonly IRequestBuilder innerBuilder; private readonly ConcurrentDictionary<string, Func<HttpClient, object[], object?>> methodDictionary = new ConcurrentDictionary<string, Func<HttpClient, object[], object>>(); public CachedRequestBuilderImplementation(IRequestBuilder innerBuilder) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) this.innerBuilder = innerBuilder ?? throw new ArgumentNullException("innerBuilder"); } public Func<HttpClient, object[], object?> BuildRestResultFuncForMethod(string methodName, System.Type[]? parameterTypes = null, System.Type[]? genericArgumentTypes = null) { string methodName2 = methodName; System.Type[] parameterTypes2 = parameterTypes; System.Type[] genericArgumentTypes2 = genericArgumentTypes; string cacheKey = GetCacheKey(methodName2, parameterTypes2 ?? System.Array.Empty<System.Type>(), genericArgumentTypes2 ?? System.Array.Empty<System.Type>()); return methodDictionary.GetOrAdd(cacheKey, (Func<string, Func<HttpClient, object[], object>>)((string _) => innerBuilder.BuildRestResultFuncForMethod(methodName2, parameterTypes2, genericArgumentTypes2))); } private static string GetCacheKey(string methodName, System.Type[] parameterTypes, System.Type[] genericArgumentTypes) { string genericString = GetGenericString(genericArgumentTypes); string argumentString = GetArgumentString(parameterTypes); return $"{methodName}{genericString}({argumentString})"; } private static string GetArgumentString(System.Type[] parameterTypes) { if (parameterTypes == null || parameterTypes.Length == 0) { return ""; } return string.Join(", ", Enumerable.Select<System.Type, string>((System.Collections.Generic.IEnumerable<System.Type>)parameterTypes, (Func<System.Type, string>)((System.Type t) => t.FullName))); } private static string GetGenericString(System.Type[] genericArgumentTypes) { if (genericArgumentTypes == null || genericArgumentTypes.Length == 0) { return ""; } return "<" + string.Join(", ", Enumerable.Select<System.Type, string>((System.Collections.Generic.IEnumerable<System.Type>)genericArgumentTypes, (Func<System.Type, string>)((System.Type t) => t.FullName))) + ">"; } } internal struct CloseGenericMethodKey : IEquatable<CloseGenericMethodKey> { [field: CompilerGenerated] public MethodInfo OpenMethodInfo { [CompilerGenerated] get; } [field: CompilerGenerated] public System.Type[] Types { [CompilerGenerated] get; } internal CloseGenericMethodKey(MethodInfo openMethodInfo, System.Type[] types) { OpenMethodInfo = openMethodInfo; Types = types; } public bool Equals(CloseGenericMethodKey other) { if (OpenMethodInfo == other.OpenMethodInfo) { return Enumerable.SequenceEqual<System.Type>((System.Collections.Generic.IEnumerable<System.Type>)Types, (System.Collections.Generic.IEnumerable<System.Type>)other.Types); } return false; } public override bool Equals(object? obj) { if (obj is CloseGenericMethodKey other) { return Equals(other); } return false; } public override int GetHashCode() { int num = 17; num = num * 23 + ((object)OpenMethodInfo).GetHashCode(); System.Type[] types = Types; foreach (System.Type type in types) { num = num * 23 + ((object)type).GetHashCode(); } return num; } } public enum CollectionFormat { RefitParameterFormatter, Csv, Ssv, Tsv, Pipes, Multi } internal class FormValueMultimap : System.Collections.Generic.IEnumerable<KeyValuePair<string?, string?>>, System.Collections.IEnumerable { private static readonly Dictionary<System.Type, PropertyInfo[]> PropertyCache = new Dictionary<System.Type, PropertyInfo[]>(); private readonly System.Collections.Generic.IList<KeyValuePair<string?, string?>> formEntries = (System.Collections.Generic.IList<KeyValuePair<string?, string?>>)new List<KeyValuePair<string, string>>(); private readonly IHttpContentSerializer contentSerializer; public System.Collections.Generic.IEnumerable<string?> Keys => Enumerable.Select<KeyValuePair<string, string>, string>((System.Collections.Generic.IEnumerable<KeyValuePair<string, string>>)this, (Func<KeyValuePair<string, string>, string>)((KeyValuePair<string, string> it) => it.Key)); public FormValueMultimap(object source, RefitSettings settings) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) RefitSettings settings2 = settings; base..ctor(); if (settings2 == null) { throw new ArgumentNullException("settings"); } contentSerializer = settings2.ContentSerializer; if (source == null) { return; } IDictionary val = (IDictionary)((source is IDictionary) ? source : null); if (val != null) { foreach (object item in (System.Collections.IEnumerable)val.Keys) { object obj = val[item]; if (obj != null) { Add(item.ToString(), settings2.FormUrlEncodedParameterFormatter.Format(obj, null)); } } return; } System.Type type = source.GetType(); lock (PropertyCache) { if (!PropertyCache.ContainsKey(type)) { PropertyCache[type] = GetProperties(type); } PropertyInfo[] array = PropertyCache[type]; foreach (PropertyInfo val2 in array) { object value = val2.GetValue(source, (object[])null); if (value == null) { continue; } string fieldNameForProperty = GetFieldNameForProperty(val2); QueryAttribute attrib = CustomAttributeExtensions.GetCustomAttribute<QueryAttribute>((MemberInfo)(object)val2, true); if (value is System.Collections.IEnumerable enumerable) { string text; string text2; System.Collections.Generic.IEnumerable<string> enumerable2; switch ((attrib != null && attrib.IsCollectionFormatSpecified) ? attrib.CollectionFormat : settings2.CollectionFormat) { case CollectionFormat.Multi: foreach (object item2 in enumerable) { Add(fieldNameForProperty, settings2.FormUrlEncodedParameterFormatter.Format(item2, attrib?.Format)); } break; case CollectionFormat.Csv: text = ","; goto IL_0237; case CollectionFormat.Ssv: text = " "; goto IL_0237; case CollectionFormat.Tsv: text = "\t"; goto IL_0237; case CollectionFormat.Pipes: text = "|"; goto IL_0237; default: { Add(fieldNameForProperty, settings2.FormUrlEncodedParameterFormatter.Format(value, attrib?.Format)); break; } IL_0237: text2 = text; enumerable2 = Enumerable.Select<object, string>(Enumerable.Cast<object>(enumerable), (Func<object, string>)((object v) => settings2.FormUrlEncodedParameterFormatter.Format(v, attrib?.Format))); Add(fieldNameForProperty, string.Join(text2, enumerable2)); break; } } else { Add(fieldNameForProperty, settings2.FormUrlEncodedParameterFormatter.Format(value, attrib?.Format)); } } } } private void Add(string? key, string? value) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) ((System.Collections.Generic.ICollection<KeyValuePair<string, string>>)formEntries).Add(new KeyValuePair<string, string>(key, value)); } private string GetFieldNameForProperty(PropertyInfo propertyInfo) { string name = Enumerable.FirstOrDefault<string>(Enumerable.Select<AliasAsAttribute, string>(CustomAttributeExtensions.GetCustomAttributes<AliasAsAttribute>((MemberInfo)(object)propertyInfo, true), (Func<AliasAsAttribute, string>)((AliasAsAttribute a) => a.Name))) ?? contentSerializer.GetFieldNameForProperty(propertyInfo) ?? ((MemberInfo)propertyInfo).Name; return Enumerable.FirstOrDefault<string>(Enumerable.Select<QueryAttribute, string>(CustomAttributeExtensions.GetCustomAttributes<QueryAttribute>((MemberInfo)(object)propertyInfo, true), (Func<QueryAttribute, string>)((QueryAttribute attr) => string.IsNullOrWhiteSpace(attr.Prefix) ? name : (attr.Prefix + attr.Delimiter + name)))) ?? name; } private static PropertyInfo[] GetProperties(System.Type type) { return Enumerable.ToArray<PropertyInfo>(Enumerable.Where<PropertyInfo>((System.Collections.Generic.IEnumerable<PropertyInfo>)type.GetProperties((BindingFlags)20), (Func<PropertyInfo, bool>)delegate(PropertyInfo p) { if (p.CanRead) { MethodInfo getMethod = p.GetMethod; if (getMethod == null) { return false; } return ((MethodBase)getMethod).IsPublic; } return false; })); } public System.Collections.Generic.IEnumerator<KeyValuePair<string?, string?>> GetEnumerator() { return ((System.Collections.Generic.IEnumerable<KeyValuePair<string, string>>)formEntries).GetEnumerator(); } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return (System.Collections.IEnumerator)GetEnumerator(); } } public static class HttpRequestMessageOptions { [field: CompilerGenerated] public static string InterfaceType { [CompilerGenerated] get; } = "Refit.InterfaceType"; [field: CompilerGenerated] public static string RestMethodInfo { [CompilerGenerated] get; } = "Refit.RestMethodInfo"; } [Obsolete("Use NewtonsoftJsonContentSerializer in the Refit.Newtonsoft.Json package instead", true)] public class JsonContentSerializer : IHttpContentSerializer { public HttpContent ToHttpContent<T>(T item) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotImplementedException(); } public System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(HttpContent content, CancellationToken cancellationToken = default(CancellationToken)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotImplementedException(); } public string GetFieldNameForProperty(PropertyInfo propertyInfo) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotImplementedException(); } } public abstract class MultipartItem { [field: CompilerGenerated] public string? Name { [CompilerGenerated] get; } [field: CompilerGenerated] public string? ContentType { [CompilerGenerated] get; } [field: CompilerGenerated] public string FileName { [CompilerGenerated] get; } public MultipartItem(string fileName, string? contentType) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) FileName = fileName ?? throw new ArgumentNullException("fileName"); ContentType = contentType; } public MultipartItem(string fileName, string? contentType, string? name) : this(fileName, contentType) { Name = name; } public HttpContent ToContent() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown HttpContent val = CreateContent(); if (!string.IsNullOrEmpty(ContentType)) { val.Headers.ContentType = new MediaTypeHeaderValue(ContentType); } return val; } protected abstract HttpContent CreateContent(); } public class StreamPart : MultipartItem { [field: CompilerGenerated] public Stream Value { [CompilerGenerated] get; } public StreamPart(Stream value, string fileName, string? contentType = null, string? name = null) : base(fileName, contentType, name) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) Value = value ?? throw new ArgumentNullException("value"); } protected override HttpContent CreateContent() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown return (HttpContent)new StreamContent(Value); } } public class ByteArrayPart : MultipartItem { [field: CompilerGenerated] public byte[] Value { [CompilerGenerated] get; } public ByteArrayPart(byte[] value, string fileName, string? contentType = null, string? name = null) : base(fileName, contentType, name) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) Value = value ?? throw new ArgumentNullException("value"); } protected override HttpContent CreateContent() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown return (HttpContent)new ByteArrayContent(Value); } } public class FileInfoPart : MultipartItem { [field: CompilerGenerated] public FileInfo Value { [CompilerGenerated] get; } public FileInfoPart(FileInfo value, string fileName, string? contentType = null, string? name = null) : base(fileName, contentType, name) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) Value = value ?? throw new ArgumentNullException("value"); } protected override HttpContent CreateContent() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown return (HttpContent)new StreamContent((Stream)(object)Value.OpenRead()); } } public class ProblemDetails { [field: CompilerGenerated] public Dictionary<string, string[]> Errors { [CompilerGenerated] get; [CompilerGenerated] set; } = new Dictionary<string, string[]>(); [JsonExtensionData] [field: CompilerGenerated] public IDictionary<string, object> Extensions { [CompilerGenerated] get; [CompilerGenerated] set; } = (IDictionary<string, object>)(object)new Dictionary<string, object>((IEqualityComparer<string>)(object)StringComparer.Ordinal); [field: CompilerGenerated] public string? Type { [CompilerGenerated] get; [CompilerGenerated] set; } = "about:blank"; [field: CompilerGenerated] public string? Title { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public int Status { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public string? Detail { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public string? Instance { [CompilerGenerated] get; [CompilerGenerated] set; } } public class RefitSettings { [field: CompilerGenerated] public Func<HttpRequestMessage, CancellationToken, System.Threading.Tasks.Task<string>>? AuthorizationHeaderValueGetter { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public Func<HttpMessageHandler>? HttpMessageHandlerFactory { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public Func<HttpResponseMessage, System.Threading.Tasks.Task<System.Exception?>> ExceptionFactory { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public IHttpContentSerializer ContentSerializer { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public IUrlParameterFormatter UrlParameterFormatter { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public IFormUrlEncodedParameterFormatter FormUrlEncodedParameterFormatter { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public CollectionFormat CollectionFormat { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public bool Buffered { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public Dictionary<string, object> HttpRequestMessageOptions { [CompilerGenerated] get; [CompilerGenerated] set; } public RefitSettings() { ContentSerializer = new SystemTextJsonContentSerializer(); UrlParameterFormatter = new DefaultUrlParameterFormatter(); FormUrlEncodedParameterFormatter = new DefaultFormUrlEncodedParameterFormatter(); ExceptionFactory = new DefaultApiExceptionFactory(this).CreateAsync; } public RefitSettings(IHttpContentSerializer contentSerializer, IUrlParameterFormatter? urlParameterFormatter = null, IFormUrlEncodedParameterFormatter? formUrlEncodedParameterFormatter = null) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) ContentSerializer = contentSerializer ?? throw new ArgumentNullException("contentSerializer", "The content serializer can't be null"); UrlParameterFormatter = urlParameterFormatter ?? new DefaultUrlParameterFormatter(); FormUrlEncodedParameterFormatter = formUrlEncodedParameterFormatter ?? new DefaultFormUrlEncodedParameterFormatter(); ExceptionFactory = new DefaultApiExceptionFactory(this).CreateAsync; } } public interface IHttpContentSerializer { HttpContent ToHttpContent<T>(T item); System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(HttpContent content, CancellationToken cancellationToken = default(CancellationToken)); string? GetFieldNameForProperty(PropertyInfo propertyInfo); } public interface IUrlParameterFormatter { string? Format(object? value, ICustomAttributeProvider attributeProvider, System.Type type); } public interface IFormUrlEncodedParameterFormatter { string? Format(object? value, string? formatString); } public class DefaultUrlParameterFormatter : IUrlParameterFormatter { private static readonly ConcurrentDictionary<System.Type, ConcurrentDictionary<string, EnumMemberAttribute?>> EnumMemberCache = new ConcurrentDictionary<System.Type, ConcurrentDictionary<string, EnumMemberAttribute>>(); public virtual string? Format(object? parameterValue, ICustomAttributeProvider attributeProvider, System.Type type) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (attributeProvider == null) { throw new ArgumentNullException("attributeProvider"); } string text = Enumerable.FirstOrDefault<QueryAttribute>(Enumerable.OfType<QueryAttribute>((System.Collections.IEnumerable)(object)attributeProvider.GetCustomAttributes(typeof(QueryAttribute), true)))?.Format; EnumMemberAttribute val2 = null; if (parameterValue != null) { System.Type parameterType = parameterValue.GetType(); if (parameterType.IsEnum) { val2 = EnumMemberCache.GetOrAdd(parameterType, (Func<System.Type, ConcurrentDictionary<string, EnumMemberAttribute>>)((System.Type t) => new ConcurrentDictionary<string, EnumMemberAttribute>())).GetOrAdd(parameterValue.ToString(), (Func<string, EnumMemberAttribute>)((string val) => CustomAttributeExtensions.GetCustomAttribute<EnumMemberAttribute>(Enumerable.First<MemberInfo>((System.Collections.Generic.IEnumerable<MemberInfo>)parameterType.GetMember(val))))); } } if (parameterValue != null) { return string.Format((IFormatProvider)(object)CultureInfo.InvariantCulture, string.IsNullOrWhiteSpace(text) ? "{0}" : ("{0:" + text + "}"), ((val2 != null) ? val2.Value : null) ?? parameterValue); } return null; } } public class DefaultFormUrlEncodedParameterFormatter : IFormUrlEncodedParameterFormatter { private static readonly ConcurrentDictionary<System.Type, ConcurrentDictionary<string, EnumMemberAttribute?>> EnumMemberCache = new ConcurrentDictionary<System.Type, ConcurrentDictionary<string, EnumMemberAttribute>>(); public virtual string? Format(object? parameterValue, string? formatString) { if (parameterValue == null) { return null; } System.Type parameterType = parameterValue.GetType(); EnumMemberAttribute val2 = null; if (((System.Type)(object)IntrospectionExtensions.GetTypeInfo(parameterType)).IsEnum) { val2 = EnumMemberCache.GetOrAdd(parameterType, (Func<System.Type, ConcurrentDictionary<string, EnumMemberAttribute>>)((System.Type t) => new ConcurrentDictionary<string, EnumMemberAttribute>())).GetOrAdd(parameterValue.ToString(), (Func<string, EnumMemberAttribute>)((string val) => CustomAttributeExtensions.GetCustomAttribute<EnumMemberAttribute>(Enumerable.First<MemberInfo>((System.Collections.Generic.IEnumerable<MemberInfo>)parameterType.GetMember(val))))); } return string.Format((IFormatProvider)(object)CultureInfo.InvariantCulture, string.IsNullOrWhiteSpace(formatString) ? "{0}" : ("{0:" + formatString + "}"), ((val2 != null) ? val2.Value : null) ?? parameterValue); } } public class DefaultApiExceptionFactory { [StructLayout(3)] [CompilerGenerated] private struct <CreateExceptionAsync>d__4 : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder<System.Exception> <>t__builder; public HttpResponseMessage responseMessage; public RefitSettings refitSettings; private ConfiguredTaskAwaiter<ApiException> <>u__1; private void MoveNext() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; System.Exception result; try { ConfiguredTaskAwaiter<ApiException> awaiter; if (num != 0) { HttpRequestMessage requestMessage = responseMessage.RequestMessage; HttpMethod method = requestMessage.Method; awaiter = ApiException.Create(requestMessage, method, responseMessage, refitSettings).ConfigureAwait(false).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<ApiException>, <CreateExceptionAsync>d__4>(ref awaiter, ref this); return; } } else { awaiter = <>u__1; <>u__1 = default(ConfiguredTaskAwaiter<ApiException>); num = (<>1__state = -1); } result = awaiter.GetResult(); } catch (System.Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(result); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { <>t__builder.SetStateMachine(stateMachine); } } private static readonly System.Threading.Tasks.Task<System.Exception?> NullTask = System.Threading.Tasks.Task.FromResult<System.Exception>((System.Exception)null); private readonly RefitSettings refitSettings; public DefaultApiExceptionFactory(RefitSettings refitSettings) { this.refitSettings = refitSettings; } public System.Threading.Tasks.Task<System.Exception?> CreateAsync(HttpResponseMessage responseMessage) { if (!responseMessage.IsSuccessStatusCode) { return CreateExceptionAsync(responseMessage, refitSettings); } return NullTask; } [AsyncStateMachine(typeof(<CreateExceptionAsync>d__4))] private static async System.Threading.Tasks.Task<System.Exception> CreateExceptionAsync(HttpResponseMessage responseMessage, RefitSettings refitSettings) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) HttpRequestMessage requestMessage = responseMessage.RequestMessage; HttpMethod method = requestMessage.Method; return await ApiException.Create(requestMessage, method, responseMessage, refitSettings).ConfigureAwait(false); } } public interface IRequestBuilder { Func<HttpClient, object[], object?> BuildRestResultFuncForMethod(string methodName, System.Type[]? parameterTypes = null, System.Type[]? genericArgumentTypes = null); } public interface IRequestBuilder<T> : IRequestBuilder { } public static class RequestBuilder { private static readonly IRequestBuilderFactory PlatformRequestBuilderFactory = new RequestBuilderFactory(); public static IRequestBuilder<T> ForType<T>(RefitSettings? settings) { return PlatformRequestBuilderFactory.Create<T>(settings); } public static IRequestBuilder<T> ForType<T>() { return PlatformRequestBuilderFactory.Create<T>(null); } public static IRequestBuilder ForType(System.Type refitInterfaceType, RefitSettings? settings) { return PlatformRequestBuilderFactory.Create(refitInterfaceType, settings); } public static IRequestBuilder ForType(System.Type refitInterfaceType) { return PlatformRequestBuilderFactory.Create(refitInterfaceType, null); } } internal interface IRequestBuilderFactory { IRequestBuilder<T> Create<T>(RefitSettings? settings); IRequestBuilder Create(System.Type refitInterfaceType, RefitSettings? settings); } internal class RequestBuilderFactory : IRequestBuilderFactory { public IRequestBuilder<T> Create<T>(RefitSettings? settings = null) { return new CachedRequestBuilderImplementation<T>(new RequestBuilderImplementation<T>(settings)); } public IRequestBuilder Create(System.Type refitInterfaceType, RefitSettings? settings = null) { return new CachedRequestBuilderImplementation(new RequestBuilderImplementation(refitInterfaceType, settings)); } } internal class RequestBuilderImplementation<TApi> : RequestBuilderImplementation, IRequestBuilder<TApi>, IRequestBuilder { public RequestBuilderImplementation(RefitSettings? refitSettings = null) : base(typeof(TApi), refitSettings) { } } internal class RequestBuilderImplementation : IRequestBuilder { private sealed class TaskToObservable<T> : IObservable<T?> { private readonly Func<CancellationToken, System.Threading.Tasks.Task<T?>> taskFactory; public TaskToObservable(Func<CancellationToken, System.Threading.Tasks.Task<T?>> taskFactory) { this.taskFactory = taskFactory; } public System.IDisposable Subscribe(IObserver<T?> observer) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown IObserver<T?> observer2 = observer; CancellationTokenSource cts = new CancellationTokenSource(); ((Func<CancellationToken, System.Threading.Tasks.Task<CancellationToken>>)(object)taskFactory).Invoke(cts.Token).ContinueWith((Action<System.Threading.Tasks.Task<T>>)(object)(Action<System.Threading.Tasks.Task<System.Threading.Tasks.Task<T>>>)delegate(System.Threading.Tasks.Task<T?> t) { if (!cts.IsCancellationRequested) { ToObservableDone(t, observer2); } }, TaskScheduler.Default); return new AnonymousDisposable(new Action(cts.Cancel)); } private static void ToObservableDone<TResult>(System.Threading.Tasks.Task<TResult?> task, IObserver<TResult?> subject) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected I4, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown TaskStatus status = ((System.Threading.Tasks.Task)task).Status; switch (status - 5) { case 0: subject.OnNext(task.Result); subject.OnCompleted(); break; case 2: subject.OnError(((System.Exception)(object)((System.Threading.Tasks.Task)task).Exception).InnerException); break; case 1: subject.OnError((System.Exception)new TaskCanceledException((System.Threading.Tasks.Task)task)); break; } } } [CompilerGenerated] private sealed class <>c__DisplayClass18_2 { [StructLayout(3)] private struct <<BuildRequestFactoryForMethod>b__3>d : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder <>t__builder; public Stream stream; public <>c__DisplayClass18_2 <>4__this; private Stream <>7__wrap1; private ConfiguredTaskAwaiter <>u__1; private void MoveNext() { //IL_006b: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; <>c__DisplayClass18_2 <>c__DisplayClass18_ = <>4__this; try { if (num != 0) { <>7__wrap1 = stream; } try { ConfiguredTaskAwaiter awaiter; if (num != 0) { ConfiguredTaskAwaitable val = <>c__DisplayClass18_.content.CopyToAsync(stream).ConfigureAwait(false); awaiter = ((ConfiguredTaskAwaitable)(ref val)).GetAwaiter(); if (!((ConfiguredTaskAwaiter)(ref awaiter)).IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; ((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <<BuildRequestFactoryForMethod>b__3>d>(ref awaiter, ref this); return; } } else { awaiter = <>u__1; <>u__1 = default(ConfiguredTaskAwaiter); num = (<>1__state = -1); } ((ConfiguredTaskAwaiter)(ref awaiter)).GetResult(); } finally { if (num < 0 && <>7__wrap1 != null) { ((System.IDisposable)<>7__wrap1).Dispose(); } } <>7__wrap1 = null; } catch (System.Exception exception) { <>1__state = -2; ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine); } } public HttpContent content; [AsyncStateMachine(typeof(<<BuildRequestFactoryForMethod>b__3>d))] internal System.Threading.Tasks.Task <BuildRequestFactoryForMethod>b__3(Stream stream, HttpContent _, TransportContext? __) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) <<BuildRequestFactoryForMethod>b__3>d <<BuildRequestFactoryForMethod>b__3>d = default(<<BuildRequestFactoryForMethod>b__3>d); <<BuildRequestFactoryForMethod>b__3>d.<>t__builder = AsyncTaskMethodBuilder.Create(); <<BuildRequestFactoryForMethod>b__3>d.<>4__this = this; <<BuildRequestFactoryForMethod>b__3>d.stream = stream; <<BuildRequestFactoryForMethod>b__3>d.<>1__state = -1; ((AsyncTaskMethodBuilder)(ref <<BuildRequestFactoryForMethod>b__3>d.<>t__builder)).Start<<<BuildRequestFactoryForMethod>b__3>d>(ref <<BuildRequestFactoryForMethod>b__3>d); return ((AsyncTaskMethodBuilder)(ref <<BuildRequestFactoryForMethod>b__3>d.<>t__builder)).Task; } } [CompilerGenerated] private sealed class <>c__DisplayClass20_0 { public RequestBuilderImplementation <>4__this; public ICustomAttributeProvider customAttributeProvider; public System.Type type; internal string <ParseEnumerableQueryParameterValue>b__0(object v) { return <>4__this.settings.UrlParameterFormatter.Format(v, customAttributeProvider, type); } } [CompilerGenerated] private sealed class <>c__DisplayClass23_0 { [StructLayout(3)] private struct <<BuildVoidTaskFuncForMethod>b__0>d : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder <>t__builder; public HttpClient client; public <>c__DisplayClass23_0 <>4__this; public object[] paramList; private HttpRequestMessage <rq>5__2; private CancellationToken <ct>5__3; private HttpResponseMessage <resp>5__4; private ConfiguredTaskAwaiter <>u__1; private ConfiguredTaskAwaiter<HttpResponseMessage> <>u__2; private ConfiguredTaskAwaiter<System.Exception?> <>u__3; private void MoveNext() { //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; <>c__DisplayClass23_0 <>c__DisplayClass23_ = <>4__this; try { ConfiguredTaskAwaiter awaiter2; ConfiguredTaskAwaiter<HttpResponseMessage> awaiter; HttpResponseMessage result; switch (num) { default: { if (client.BaseAddress == (Uri)null) { throw new InvalidOperationException("BaseAddress must be set on the HttpClient instance"); } Func<object[], HttpRequestMessage> val = <>c__DisplayClass23_.<>4__this.BuildRequestFactoryForMethod(<>c__DisplayClass23_.restMethod, client.BaseAddress.AbsolutePath, <>c__DisplayClass23_.restMethod.CancellationToken != null); <rq>5__2 = val.Invoke(paramList); <ct>5__3 = CancellationToken.None; if (<>c__DisplayClass23_.restMethod.CancellationToken != null) { <ct>5__3 = Enumerable.FirstOrDefault<CancellationToken>(Enumerable.OfType<CancellationToken>((System.Collections.IEnumerable)(object)paramList)); } if (IsBodyBuffered(<>c__DisplayClass23_.restMethod, <rq>5__2)) { ConfiguredTaskAwaitable val2 = <rq>5__2.Content.LoadIntoBufferAsync().ConfigureAwait(false); awaiter2 = ((ConfiguredTaskAwaitable)(ref val2)).GetAwaiter(); if (!((ConfiguredTaskAwaiter)(ref awaiter2)).IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter2; ((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <<BuildVoidTaskFuncForMethod>b__0>d>(ref awaiter2, ref this); return; } goto IL_012c; } goto IL_0133; } case 0: awaiter2 = <>u__1; <>u__1 = default(ConfiguredTaskAwaiter); num = (<>1__state = -1); goto IL_012c; case 1: awaiter = <>u__2; <>u__2 = default(ConfiguredTaskAwaiter<HttpResponseMessage>); num = (<>1__state = -1); goto IL_01a5; case 2: break; IL_01a5: result = awaiter.GetResult(); <resp>5__4 = result; break; IL_0133: awaiter = ((HttpMessageInvoker)client).SendAsync(<rq>5__2, <ct>5__3).ConfigureAwait(false).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 1); <>u__2 = awaiter; ((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<HttpResponseMessage>, <<BuildVoidTaskFuncForMethod>b__0>d>(ref awaiter, ref this); return; } goto IL_01a5; IL_012c: ((ConfiguredTaskAwaiter)(ref awaiter2)).GetResult(); goto IL_0133; } try { ConfiguredTaskAwaiter<System.Exception> awaiter3; if (num != 2) { awaiter3 = <>c__DisplayClass23_.<>4__this.settings.ExceptionFactory.Invoke(<resp>5__4).ConfigureAwait(false).GetAwaiter(); if (!awaiter3.IsCompleted) { num = (<>1__state = 2); <>u__3 = awaiter3; ((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<System.Exception>, <<BuildVoidTaskFuncForMethod>b__0>d>(ref awaiter3, ref this); return; } } else { awaiter3 = <>u__3; <>u__3 = default(ConfiguredTaskAwaiter<System.Exception>); num = (<>1__state = -1); } System.Exception result2 = awaiter3.GetResult(); if (result2 != null) { throw result2; } } finally { if (num < 0 && <resp>5__4 != null) { ((System.IDisposable)<resp>5__4).Dispose(); } } } catch (System.Exception exception) { <>1__state = -2; <rq>5__2 = null; <ct>5__3 = default(CancellationToken); <resp>5__4 = null; ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; <rq>5__2 = null; <ct>5__3 = default(CancellationToken); <resp>5__4 = null; ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine); } } public RequestBuilderImplementation <>4__this; public RestMethodInfoInternal restMethod; [AsyncStateMachine(typeof(<<BuildVoidTaskFuncForMethod>b__0>d))] internal System.Threading.Tasks.Task <BuildVoidTaskFuncForMethod>b__0(HttpClient client, object[] paramList) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) <<BuildVoidTaskFuncForMethod>b__0>d <<BuildVoidTaskFuncForMethod>b__0>d = default(<<BuildVoidTaskFuncForMethod>b__0>d); <<BuildVoidTaskFuncForMethod>b__0>d.<>t__builder = AsyncTaskMethodBuilder.Create(); <<BuildVoidTaskFuncForMethod>b__0>d.<>4__this = this; <<BuildVoidTaskFuncForMethod>b__0>d.client = client; <<BuildVoidTaskFuncForMethod>b__0>d.paramList = paramList; <<BuildVoidTaskFuncForMethod>b__0>d.<>1__state = -1; ((AsyncTaskMethodBuilder)(ref <<BuildVoidTaskFuncForMethod>b__0>d.<>t__builder)).Start<<<BuildVoidTaskFuncForMethod>b__0>d>(ref <<BuildVoidTaskFuncForMethod>b__0>d); return ((AsyncTaskMethodBuilder)(ref <<BuildVoidTaskFuncForMethod>b__0>d.<>t__builder)).Task; } } [StructLayout(3)] [CompilerGenerated] private struct <DeserializeContentAsync>d__15<T> : IAsyncStateMachine where T : notnull { public int <>1__state; public AsyncTaskMethodBuilder<T> <>t__builder; public HttpResponseMessage resp; public HttpContent content; public CancellationToken cancellationToken; public RequestBuilderImplementation <>4__this; private ConfiguredTaskAwaiter<Stream> <>u__1; private Stream <stream>5__2; private StreamReader <reader>5__3; private ConfiguredTaskAwaiter<string> <>u__2; private ConfiguredTaskAwaiter<T?> <>u__3; private void MoveNext() { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; RequestBuilderImplementation requestBuilderImplementation = <>4__this; T result2; try { T val; ConfiguredTaskAwaiter<Stream> awaiter2; ConfiguredTaskAwaiter<T> awaiter; Stream result; switch (num) { default: if (typeof(T) == typeof(HttpResponseMessage)) { val = (T)(object)resp; break; } if (typeof(T) == typeof(HttpContent)) { val = (T)(object)content; break; } if (typeof(T) == typeof(Stream)) { awaiter2 = content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false).GetAwaiter(); if (!awaiter2.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter2; <>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<Stream>, <DeserializeContentAsync>d__15<T>>(ref awaiter2, ref this); return; } goto IL_0103; } if (typeof(T) == typeof(string)) { awaiter2 = content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false).GetAwaiter(); if (!awaiter2.IsCompleted) { num = (<>1__state = 1); <>u__1 = awaiter2; <>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<Stream>, <DeserializeContentAsync>d__15<T>>(ref awaiter2, ref this); return; } goto IL_019f; } awaiter = requestBuilderImplementation.serializer.FromHttpContentAsync<T>(content, cancellationToken).ConfigureAwait(false).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 3); <>u__3 = awaiter; <>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<T>, <DeserializeContentAsync>d__15<T>>(ref awaiter, ref this); return; } goto IL_02f1; case 0: awaiter2 = <>u__1; <>u__1 = default(ConfiguredTaskAwaiter<Stream>); num = (<>1__state = -1); goto IL_0103; case 1: awaiter2 = <>u__1; <>u__1 = default(ConfiguredTaskAwaiter<Stream>); num = (<>1__state = -1); goto IL_019f; case 2: try { if (num != 2) { <reader>5__3 = new StreamReader(<stream>5__2); } try { ConfiguredTaskAwaiter<string> awaiter3; if (num != 2) { awaiter3 = ((TextReader)<reader>5__3).ReadToEndAsync().ConfigureAwait(false).GetAwaiter(); if (!awaiter3.IsCompleted) { num = (<>1__state = 2); <>u__2 = awaiter3; <>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<string>, <DeserializeContentAsync>d__15<T>>(ref awaiter3, ref this); return; } } else { awaiter3 = <>u__2; <>u__2 = default(ConfiguredTaskAwaiter<string>); num = (<>1__state = -1); } val = (T)(object)awaiter3.GetResult(); } finally { if (num < 0 && <reader>5__3 != null) { ((System.IDisposable)<reader>5__3).Dispose(); } } } finally { if (num < 0 && <stream>5__2 != null) { ((System.IDisposable)<stream>5__2).Dispose(); } } <stream>5__2 = null; <reader>5__3 = null; break; case 3: { awaiter = <>u__3; <>u__3 = default(ConfiguredTaskAwaiter<T>); num = (<>1__state = -1); goto IL_02f1; } IL_019f: result = awaiter2.GetResult(); <stream>5__2 = result; goto case 2; IL_0103: val = (T)(object)awaiter2.GetResult(); break; IL_02f1: val = awaiter.GetResult(); break; } result2 = val; } catch (System.Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(result2); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { <>t__builder.SetStateMachine(stateMachine); } } [CompilerGenerated] private sealed class <ParseEnumerableQueryParameterValue>d__20 : System.Collections.Generic.IEnumerable<string>, System.Collections.IEnumerable, System.Collections.Generic.IEnumerator<string>, System.Collections.IEnumerator, System.IDisposable { private int <>1__state; private string? <>2__current; private int <>l__initialThreadId; public RequestBuilderImplementation <>4__this; private ICustomAttributeProvider customAttributeProvider; public ICustomAttributeProvider <>3__customAttributeProvider; private System.Type type; public System.Type <>3__type; private QueryAttribute queryAttribute; public QueryAttribute <>3__queryAttribute; private System.Collections.IEnumerable paramValues; public System.Collections.IEnumerable <>3__paramValues; private <>c__DisplayClass20_0 <>8__1; private System.Collections.IEnumerator <>7__wrap1; string System.Collections.Generic.IEnumerator<string>.Current { [DebuggerHidden] get { return <>2__current; } } object System.Collections.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ParseEnumerableQueryParameterValue>d__20(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void System.IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } } private bool MoveNext() { try { int num = <>1__state; RequestBuilderImplementation requestBuilderImplementation = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; <>8__1 = new <>c__DisplayClass20_0(); <>8__1.<>4__this = <>4__this; <>8__1.customAttributeProvider = customAttributeProvider; <>8__1.type = type; CollectionFormat collectionFormat = ((queryAttribute != null && queryAttribute.IsCollectionFormatSpecified) ? queryAttribute.CollectionFormat : requestBuilderImplementation.settings.CollectionFormat); if (collectionFormat == CollectionFormat.Multi) { <>7__wrap1 = paramValues.GetEnumerator(); <>1__state = -3; goto IL_010d; } string text = collectionFormat switch { CollectionFormat.Pipes => "|", CollectionFormat.Tsv => "\t", CollectionFormat.Ssv => " ", _ => ",", }; System.Collections.Generic.IEnumerable<string> enumerable = Enumerable.Select<object, string>(Enumerable.Cast<object>(paramValues), (Func<object, string>)((object v) => <>8__1.<>4__this.settings.UrlParameterFormatter.Format(v, <>8__1.customAttributeProvider, <>8__1.type))); <>2__current = string.Join(text, enumerable); <>1__state = 2; return true;
UserData/PiShock/PiShockApi.dll
Decompiled 2 months agousing System; using System.Collections.Concurrent; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Net.Http; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.Json.Serialization; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using PiShockApi; using PiShockApi.Models; using PiShockApiRefitInternalGenerated; using Refit; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(/*Could not decode attribute arguments.*/)] [assembly: InternalsVisibleTo("PiShockApi.Tests")] [assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")] [assembly: AssemblyCompany("Tueffy")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright (c) Tueffy 2023")] [assembly: AssemblyDescription("Library to easily interact with the PiShock Api.")] [assembly: AssemblyFileVersion("1.3.2.0")] [assembly: AssemblyInformationalVersion("1.3.2+9fbae5171b5a200180b0fe30735dbff0524381bf")] [assembly: AssemblyProduct("PiShockApi")] [assembly: AssemblyTitle("PiShockApi")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/TueffyT")] [assembly: AssemblyVersion("1.3.2.0")] [module: RefSafetyRules(11)] namespace Refit.Implementation { [ExcludeFromCodeCoverage] [DebuggerNonUserCode] [Preserve] [Obfuscation(Exclude = true)] [EditorBrowsable(/*Could not decode attribute arguments.*/)] internal static class Generated { [ExcludeFromCodeCoverage] [DebuggerNonUserCode] [Preserve] [Obfuscation(Exclude = true)] [EditorBrowsable(/*Could not decode attribute arguments.*/)] private class PiShockApiIPiShockApi : IPiShockApi { private readonly IRequestBuilder requestBuilder; [field: CompilerGenerated] public HttpClient Client { [CompilerGenerated] get; } public PiShockApiIPiShockApi(HttpClient client, IRequestBuilder requestBuilder) { Client = client; this.requestBuilder = requestBuilder; } public global::System.Threading.Tasks.Task<ApiResponse<string>> SendPiShockCommandAsync(PiShockRequest request) { object[] array = new object[1] { request }; return (global::System.Threading.Tasks.Task<ApiResponse<string>>)requestBuilder.BuildRestResultFuncForMethod("SendPiShockCommandAsync", new global::System.Type[1] { typeof(PiShockRequest) }, (global::System.Type[])null).Invoke(Client, array); } public global::System.Threading.Tasks.Task<ApiResponse<PiShockInfoResult>> GetShockerInfoAsync(PiShockRequest request) { object[] array = new object[1] { request }; return (global::System.Threading.Tasks.Task<ApiResponse<PiShockInfoResult>>)requestBuilder.BuildRestResultFuncForMethod("GetShockerInfoAsync", new global::System.Type[1] { typeof(PiShockRequest) }, (global::System.Type[])null).Invoke(Client, array); } global::System.Threading.Tasks.Task<ApiResponse<string>> IPiShockApi.SendPiShockCommandAsync(PiShockRequest request) { object[] array = new object[1] { request }; return (global::System.Threading.Tasks.Task<ApiResponse<string>>)requestBuilder.BuildRestResultFuncForMethod("SendPiShockCommandAsync", new global::System.Type[1] { typeof(PiShockRequest) }, (global::System.Type[])null).Invoke(Client, array); } global::System.Threading.Tasks.Task<ApiResponse<PiShockInfoResult>> IPiShockApi.GetShockerInfoAsync(PiShockRequest request) { object[] array = new object[1] { request }; return (global::System.Threading.Tasks.Task<ApiResponse<PiShockInfoResult>>)requestBuilder.BuildRestResultFuncForMethod("GetShockerInfoAsync", new global::System.Type[1] { typeof(PiShockRequest) }, (global::System.Type[])null).Invoke(Client, array); } } } } namespace PiShockApiRefitInternalGenerated { [ExcludeFromCodeCoverage] [EditorBrowsable(/*Could not decode attribute arguments.*/)] [AttributeUsage(/*Could not decode attribute arguments.*/)] internal sealed class PreserveAttribute : global::System.Attribute { public bool AllMembers; public bool Conditional; } } namespace PiShockApi { [Headers(new string[] { "Content-Type: application/json" })] internal interface IPiShockApi { [Post("/apioperate")] global::System.Threading.Tasks.Task<ApiResponse<string>> SendPiShockCommandAsync([Body] PiShockRequest request); [Post("/GetShockerInfo")] global::System.Threading.Tasks.Task<ApiResponse<PiShockInfoResult>> GetShockerInfoAsync([Body] PiShockRequest request); } public class PiShockApiClient { [StructLayout(3)] [CompilerGenerated] private struct <GetShockerInfoAsync>d__12 : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder<PiShockInfoResult> <>t__builder; public PiShockApiClient <>4__this; public PiShockUser piShockUser; private TaskAwaiter<ApiResponse<PiShockInfoResult>> <>u__1; private void MoveNext() { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00ad: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; PiShockApiClient piShockApiClient = <>4__this; PiShockInfoResult result2; try { TaskAwaiter<ApiResponse<PiShockInfoResult>> awaiter; if (num != 0) { piShockApiClient.ValidateUserAndThrow(piShockUser); PiShockRequest piShockRequest = new PiShockRequest { Username = piShockUser.Username, ApiKey = piShockUser.ApiKey, Code = piShockUser.Code, Name = piShockApiClient.DisplayName }; ILogger logger = piShockApiClient.Logger; if (logger != null) { LoggerExtensions.LogDebug(logger, "Sending GetInfo {@Request}", new object[1] { piShockRequest }); } awaiter = piShockApiClient._piShockApi.GetShockerInfoAsync(piShockRequest).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<ApiResponse<PiShockInfoResult>>, <GetShockerInfoAsync>d__12>(ref awaiter, ref this); return; } } else { awaiter = <>u__1; <>u__1 = default(TaskAwaiter<ApiResponse<PiShockInfoResult>>); num = (<>1__state = -1); } ApiResponse<PiShockInfoResult> result = awaiter.GetResult(); result2 = ((!result.IsSuccessStatusCode) ? null : result.Content); } catch (global::System.Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(result2); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { <>t__builder.SetStateMachine(stateMachine); } } [StructLayout(3)] [CompilerGenerated] private struct <SendBeepAsync>d__11 : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder<PiShockResult> <>t__builder; public PiShockApiClient <>4__this; public PiShockUser piShockUser; public int intensity; public int duration; private TaskAwaiter<ApiResponse<string>> <>u__1; private void MoveNext() { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; PiShockApiClient piShockApiClient = <>4__this; PiShockResult result2; try { TaskAwaiter<ApiResponse<string>> awaiter; if (num != 0) { piShockApiClient.ValidateUserAndThrow(piShockUser); piShockApiClient.ValidateIntensityAndThrow(intensity); PiShockRequest piShockRequest = new PiShockRequest { Username = piShockUser.Username, ApiKey = piShockUser.ApiKey, Code = piShockUser.Code, Name = piShockApiClient.DisplayName, Operation = 2, Intensity = intensity, Duration = duration }; ILogger logger = piShockApiClient.Logger; if (logger != null) { LoggerExtensions.LogDebug(logger, "Sending Beep {@Request}", new object[1] { piShockRequest }); } awaiter = piShockApiClient._piShockApi.SendPiShockCommandAsync(piShockRequest).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<ApiResponse<string>>, <SendBeepAsync>d__11>(ref awaiter, ref this); return; } } else { awaiter = <>u__1; <>u__1 = default(TaskAwaiter<ApiResponse<string>>); num = (<>1__state = -1); } ApiResponse<string> result = awaiter.GetResult(); result2 = ((!result.IsSuccessStatusCode || (!(result.Content == "Operation Succeeded.") && !(result.Content == "Operation Attempted."))) ? new PiShockResult(isSuccessful: false, result.Content) : new PiShockResult(isSuccessful: true, result.Content)); } catch (global::System.Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(result2); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { <>t__builder.SetStateMachine(stateMachine); } } [StructLayout(3)] [CompilerGenerated] private struct <SendMiniShockAsync>d__9 : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder<PiShockResult> <>t__builder; public PiShockApiClient <>4__this; public PiShockUser piShockUser; public int intensity; private ConfiguredTaskAwaiter<ApiResponse<string>> <>u__1; private void MoveNext() { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; PiShockApiClient piShockApiClient = <>4__this; PiShockResult result2; try { ConfiguredTaskAwaiter<ApiResponse<string>> awaiter; if (num != 0) { piShockApiClient.ValidateUserAndThrow(piShockUser); piShockApiClient.ValidateIntensityAndThrow(intensity); PiShockRequest piShockRequest = new PiShockRequest { Username = piShockUser.Username, ApiKey = piShockUser.ApiKey, Code = piShockUser.Code, Name = piShockApiClient.DisplayName, Operation = 0, Intensity = intensity, Duration = 300 }; ILogger logger = piShockApiClient.Logger; if (logger != null) { LoggerExtensions.LogDebug(logger, "Sending Mini-Shock {@Request}", new object[1] { piShockRequest }); } awaiter = piShockApiClient._piShockApi.SendPiShockCommandAsync(piShockRequest).ConfigureAwait(false).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<ApiResponse<string>>, <SendMiniShockAsync>d__9>(ref awaiter, ref this); return; } } else { awaiter = <>u__1; <>u__1 = default(ConfiguredTaskAwaiter<ApiResponse<string>>); num = (<>1__state = -1); } ApiResponse<string> result = awaiter.GetResult(); result2 = ((!result.IsSuccessStatusCode || (!(result.Content == "Operation Succeeded.") && !(result.Content == "Operation Attempted."))) ? new PiShockResult(isSuccessful: false, result.Content) : new PiShockResult(isSuccessful: true, result.Content)); } catch (global::System.Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(result2); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { <>t__builder.SetStateMachine(stateMachine); } } [StructLayout(3)] [CompilerGenerated] private struct <SendShockAsync>d__8 : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder<PiShockResult> <>t__builder; public PiShockApiClient <>4__this; public PiShockUser piShockUser; public int intensity; public int duration; private ConfiguredTaskAwaiter<ApiResponse<string>> <>u__1; private void MoveNext() { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; PiShockApiClient piShockApiClient = <>4__this; PiShockResult result2; try { ConfiguredTaskAwaiter<ApiResponse<string>> awaiter; if (num != 0) { piShockApiClient.ValidateUserAndThrow(piShockUser); piShockApiClient.ValidateIntensityAndThrow(intensity); PiShockRequest piShockRequest = new PiShockRequest { Username = piShockUser.Username, ApiKey = piShockUser.ApiKey, Code = piShockUser.Code, Name = piShockApiClient.DisplayName, Operation = 0, Intensity = intensity, Duration = duration }; ILogger logger = piShockApiClient.Logger; if (logger != null) { LoggerExtensions.LogDebug(logger, "Sending Shock {@Request}", new object[1] { piShockRequest }); } awaiter = piShockApiClient._piShockApi.SendPiShockCommandAsync(piShockRequest).ConfigureAwait(false).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<ApiResponse<string>>, <SendShockAsync>d__8>(ref awaiter, ref this); return; } } else { awaiter = <>u__1; <>u__1 = default(ConfiguredTaskAwaiter<ApiResponse<string>>); num = (<>1__state = -1); } ApiResponse<string> result = awaiter.GetResult(); result2 = ((!result.IsSuccessStatusCode || (!(result.Content == "Operation Succeeded.") && !(result.Content == "Operation Attempted."))) ? new PiShockResult(isSuccessful: false, result.Content) : new PiShockResult(isSuccessful: true, result.Content)); } catch (global::System.Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(result2); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { <>t__builder.SetStateMachine(stateMachine); } } [StructLayout(3)] [CompilerGenerated] private struct <SendVibrationAsync>d__10 : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder<PiShockResult> <>t__builder; public PiShockApiClient <>4__this; public PiShockUser piShockUser; public int intensity; public int duration; private ConfiguredTaskAwaiter<ApiResponse<string>> <>u__1; private void MoveNext() { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; PiShockApiClient piShockApiClient = <>4__this; PiShockResult result2; try { ConfiguredTaskAwaiter<ApiResponse<string>> awaiter; if (num != 0) { piShockApiClient.ValidateUserAndThrow(piShockUser); piShockApiClient.ValidateIntensityAndThrow(intensity); PiShockRequest piShockRequest = new PiShockRequest { Username = piShockUser.Username, ApiKey = piShockUser.ApiKey, Code = piShockUser.Code, Name = piShockApiClient.DisplayName, Operation = 1, Intensity = intensity, Duration = duration }; ILogger logger = piShockApiClient.Logger; if (logger != null) { LoggerExtensions.LogDebug(logger, "Sending Vibration {@Request}", new object[1] { piShockRequest }); } awaiter = piShockApiClient._piShockApi.SendPiShockCommandAsync(piShockRequest).ConfigureAwait(false).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<ApiResponse<string>>, <SendVibrationAsync>d__10>(ref awaiter, ref this); return; } } else { awaiter = <>u__1; <>u__1 = default(ConfiguredTaskAwaiter<ApiResponse<string>>); num = (<>1__state = -1); } ApiResponse<string> result = awaiter.GetResult(); result2 = ((!result.IsSuccessStatusCode || (!(result.Content == "Operation Succeeded.") && !(result.Content == "Operation Attempted."))) ? new PiShockResult(isSuccessful: false, result.Content) : new PiShockResult(isSuccessful: true, result.Content)); } catch (global::System.Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(result2); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { <>t__builder.SetStateMachine(stateMachine); } } private readonly IPiShockApi _piShockApi; private ILogger Logger => PiShockLogger.GetStaticLogger<PiShockApiClient>(); [field: CompilerGenerated] public string DisplayName { [CompilerGenerated] get; [CompilerGenerated] set; } = "PiShockControl"; public PiShockApiClient() { _piShockApi = RestService.For<IPiShockApi>("https://do.pishock.com/api/"); } [AsyncStateMachine(typeof(<SendShockAsync>d__8))] public async global::System.Threading.Tasks.Task<PiShockResult> SendShockAsync(PiShockUser piShockUser, int intensity, int duration) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) ValidateUserAndThrow(piShockUser); ValidateIntensityAndThrow(intensity); PiShockRequest piShockRequest = new PiShockRequest { Username = piShockUser.Username, ApiKey = piShockUser.ApiKey, Code = piShockUser.Code, Name = DisplayName, Operation = 0, Intensity = intensity, Duration = duration }; ILogger logger = Logger; if (logger != null) { LoggerExtensions.LogDebug(logger, "Sending Shock {@Request}", new object[1] { piShockRequest }); } ApiResponse<string> val = await _piShockApi.SendPiShockCommandAsync(piShockRequest).ConfigureAwait(false); if (val.IsSuccessStatusCode && (val.Content == "Operation Succeeded." || val.Content == "Operation Attempted.")) { return new PiShockResult(isSuccessful: true, val.Content); } return new PiShockResult(isSuccessful: false, val.Content); } [AsyncStateMachine(typeof(<SendMiniShockAsync>d__9))] public async global::System.Threading.Tasks.Task<PiShockResult> SendMiniShockAsync(PiShockUser piShockUser, int intensity) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) ValidateUserAndThrow(piShockUser); ValidateIntensityAndThrow(intensity); PiShockRequest piShockRequest = new PiShockRequest { Username = piShockUser.Username, ApiKey = piShockUser.ApiKey, Code = piShockUser.Code, Name = DisplayName, Operation = 0, Intensity = intensity, Duration = 300 }; ILogger logger = Logger; if (logger != null) { LoggerExtensions.LogDebug(logger, "Sending Mini-Shock {@Request}", new object[1] { piShockRequest }); } ApiResponse<string> val = await _piShockApi.SendPiShockCommandAsync(piShockRequest).ConfigureAwait(false); if (val.IsSuccessStatusCode && (val.Content == "Operation Succeeded." || val.Content == "Operation Attempted.")) { return new PiShockResult(isSuccessful: true, val.Content); } return new PiShockResult(isSuccessful: false, val.Content); } [AsyncStateMachine(typeof(<SendVibrationAsync>d__10))] public async global::System.Threading.Tasks.Task<PiShockResult> SendVibrationAsync(PiShockUser piShockUser, int intensity, int duration) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) ValidateUserAndThrow(piShockUser); ValidateIntensityAndThrow(intensity); PiShockRequest piShockRequest = new PiShockRequest { Username = piShockUser.Username, ApiKey = piShockUser.ApiKey, Code = piShockUser.Code, Name = DisplayName, Operation = 1, Intensity = intensity, Duration = duration }; ILogger logger = Logger; if (logger != null) { LoggerExtensions.LogDebug(logger, "Sending Vibration {@Request}", new object[1] { piShockRequest }); } ApiResponse<string> val = await _piShockApi.SendPiShockCommandAsync(piShockRequest).ConfigureAwait(false); if (val.IsSuccessStatusCode && (val.Content == "Operation Succeeded." || val.Content == "Operation Attempted.")) { return new PiShockResult(isSuccessful: true, val.Content); } return new PiShockResult(isSuccessful: false, val.Content); } [AsyncStateMachine(typeof(<SendBeepAsync>d__11))] public async global::System.Threading.Tasks.Task<PiShockResult> SendBeepAsync(PiShockUser piShockUser, int intensity, int duration) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) ValidateUserAndThrow(piShockUser); ValidateIntensityAndThrow(intensity); PiShockRequest piShockRequest = new PiShockRequest { Username = piShockUser.Username, ApiKey = piShockUser.ApiKey, Code = piShockUser.Code, Name = DisplayName, Operation = 2, Intensity = intensity, Duration = duration }; ILogger logger = Logger; if (logger != null) { LoggerExtensions.LogDebug(logger, "Sending Beep {@Request}", new object[1] { piShockRequest }); } ApiResponse<string> val = await _piShockApi.SendPiShockCommandAsync(piShockRequest); if (val.IsSuccessStatusCode && (val.Content == "Operation Succeeded." || val.Content == "Operation Attempted.")) { return new PiShockResult(isSuccessful: true, val.Content); } return new PiShockResult(isSuccessful: false, val.Content); } [AsyncStateMachine(typeof(<GetShockerInfoAsync>d__12))] public async global::System.Threading.Tasks.Task<PiShockInfoResult> GetShockerInfoAsync(PiShockUser piShockUser) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) ValidateUserAndThrow(piShockUser); PiShockRequest piShockRequest = new PiShockRequest { Username = piShockUser.Username, ApiKey = piShockUser.ApiKey, Code = piShockUser.Code, Name = DisplayName }; ILogger logger = Logger; if (logger != null) { LoggerExtensions.LogDebug(logger, "Sending GetInfo {@Request}", new object[1] { piShockRequest }); } ApiResponse<PiShockInfoResult> val = await _piShockApi.GetShockerInfoAsync(piShockRequest); if (val.IsSuccessStatusCode) { return val.Content; } return null; } internal void ValidateUserAndThrow(PiShockUser piShockUser) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (piShockUser == null) { throw new ArgumentNullException("piShockUser", "PiShockUser can not be null."); } if (string.IsNullOrEmpty(piShockUser.Username)) { throw new ArgumentException("PiShockUser.Username can not be null or empty.", "piShockUser"); } if (string.IsNullOrEmpty(piShockUser.ApiKey)) { throw new ArgumentException("PiShockUser.ApiKey can not be null or empty.", "piShockUser"); } if (string.IsNullOrEmpty(piShockUser.Code)) { throw new ArgumentException("PiShockUser.Code can not be null or empty.", "piShockUser"); } } internal void ValidateIntensityAndThrow(int intensity) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (intensity < 0 || intensity > 100) { throw new ArgumentOutOfRangeException("intensity", (object)intensity, "Intensity must be between 0 and 100"); } } } public static class PiShockLogger { private static ILoggerFactory _loggerFactory; private static readonly ConcurrentDictionary<global::System.Type, ILogger> _loggerByType = new ConcurrentDictionary<global::System.Type, ILogger>(); public static void Initialize(ILoggerFactory loggerFactory) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (_loggerFactory != null) { throw new InvalidOperationException("StaticLogger already initialized!"); } _loggerFactory = loggerFactory ?? throw new ArgumentNullException("loggerFactory"); } public static ILogger GetStaticLogger<T>() { ConcurrentDictionary<global::System.Type, ILogger> loggerByType = _loggerByType; global::System.Type typeFromHandle = typeof(T); ILoggerFactory loggerFactory = _loggerFactory; return loggerByType.GetOrAdd(typeFromHandle, (ILogger)(object)((loggerFactory != null) ? LoggerFactoryExtensions.CreateLogger<T>(loggerFactory) : null)); } } } namespace PiShockApi.Models { public class PiShockInfoResult { [field: CompilerGenerated] public int Id { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public int ClientId { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public string Name { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public bool Paused { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public int MaxIntensity { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public int MaxDuration { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public bool Online { [CompilerGenerated] get; [CompilerGenerated] set; } public PiShockInfoResult(int id, int clientId, string name, bool paused, int maxIntensity, int maxDuration, bool online) { Id = id; ClientId = clientId; Name = name; Paused = paused; MaxIntensity = maxIntensity; MaxDuration = maxDuration; Online = online; } } public class PiShockRequest { [field: CompilerGenerated] public string Username { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public string ApiKey { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public string Code { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public string Name { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonPropertyName("Op")] [field: CompilerGenerated] public int Operation { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public int Duration { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public int Intensity { [CompilerGenerated] get; [CompilerGenerated] set; } } public static class PiShockResponseMessages { public const string Success = "Operation Succeeded."; public const string Attempt = "Operation Attempted."; } public class PiShockResult { [field: CompilerGenerated] public bool IsSuccessful { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } public PiShockResult(bool isSuccessful, string message) { IsSuccessful = isSuccessful; Message = message; } public void Deconstruct(out bool IsSuccessful, out string Message) { IsSuccessful = this.IsSuccessful; Message = this.Message; } } public class PiShockUser { [field: CompilerGenerated] public string Username { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public string ApiKey { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] public string Code { [CompilerGenerated] get; [CompilerGenerated] set; } public virtual string ToString() { return Username; } } } namespace PiShockApi.Enums { public enum PiShockOperation { Shock, Vibrate, Beep } }
UserData/PiShock/PiShocker.dll
Decompiled 2 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Net.Http; using System.Net.Http.Json; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.Json; using System.Threading; using System.Threading.Tasks; using PiShockApi; using PiShockApi.Models; using PiShocker.PiShock; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(/*Could not decode attribute arguments.*/)] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3a3420b5-b655-490c-85a0-d89c5da300c5")] [assembly: TargetFramework(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace PiShocker { public class PiShockInfo { public string UserName; public string APIKey; public string ShareCode; public PiShockInfo(string userName, string apiKey, string shareCode) { UserName = userName; APIKey = apiKey; ShareCode = shareCode; } } internal class Program { [CompilerGenerated] private sealed class <RunShocker>d__6 : IAsyncStateMachine { public int <>1__state; public AsyncVoidMethodBuilder <>t__builder; public int duration; public int intensity; public PiShockMode mode; private PiShockResponse <test>5__1; private PiShockResponse <>s__2; private TaskAwaiter<PiShockResponse> <>u__1; private void MoveNext() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; try { TaskAwaiter<PiShockResponse> awaiter; if (num != 0) { provider = new PiShockProvider(); awaiter = provider.Execute(user.Username, user.ApiKey, user.Code, mode, duration, intensity).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <RunShocker>d__6 <RunShocker>d__ = this; ((AsyncVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter<PiShockResponse>, <RunShocker>d__6>(ref awaiter, ref <RunShocker>d__); return; } } else { awaiter = <>u__1; <>u__1 = default(TaskAwaiter<PiShockResponse>); num = (<>1__state = -1); } <>s__2 = awaiter.GetResult(); <test>5__1 = <>s__2; <>s__2 = null; success = <test>5__1.Success; } catch (global::System.Exception exception) { <>1__state = -2; <test>5__1 = null; ((AsyncVoidMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; <test>5__1 = null; ((AsyncVoidMethodBuilder)(ref <>t__builder)).SetResult(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { } } private static string FILENAME = "UserData\\PiShock\\UserInfo.txt"; private static PiShockProvider provider; private static PiShockApiClient client; private static PiShockUser user; private static bool success; private static int Main(string[] args) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown string[] array = args[0].Split("|", (StringSplitOptions)0); string text = array[0]; string text2 = text; PiShockMode mode = ((!(text2 == "0")) ? ((text2 == "1") ? PiShockMode.Vibrate : PiShockMode.Beep) : PiShockMode.Shock); int duration = int.Parse(array[1]); int intensity = int.Parse(array[2]); client = new PiShockApiClient(); client.DisplayName = "RumblePiShock"; user = new PiShockUser(); if (File.Exists(FILENAME)) { string[] array2 = ReadFileText(FILENAME); user.Username = array2[2]; user.ApiKey = array2[0]; user.Code = array2[1]; client = new PiShockApiClient(); RunShocker(duration, intensity, mode); return (!success) ? (-1) : 0; } Console.WriteLine("File Not Found: " + FILENAME); return -1; } [AsyncStateMachine(typeof(<RunShocker>d__6))] [DebuggerStepThrough] public static void RunShocker(int duration, int intensity, PiShockMode mode) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) <RunShocker>d__6 <RunShocker>d__ = new <RunShocker>d__6(); <RunShocker>d__.<>t__builder = AsyncVoidMethodBuilder.Create(); <RunShocker>d__.duration = duration; <RunShocker>d__.intensity = intensity; <RunShocker>d__.mode = mode; <RunShocker>d__.<>1__state = -1; ((AsyncVoidMethodBuilder)(ref <RunShocker>d__.<>t__builder)).Start<<RunShocker>d__6>(ref <RunShocker>d__); } public static string[] ReadFileText(string fileName) { try { return File.ReadAllLines(fileName); } catch (global::System.Exception ex) { Console.WriteLine(ex.Message); } return null; } } } namespace PiShocker.PiShock { public class PiShockProvider { [CompilerGenerated] private sealed class <Execute>d__5 : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder<PiShockResponse> <>t__builder; public string username; public string apiKey; public string sharecode; public PiShockMode mode; public int duration; public int intensity; public PiShockProvider <>4__this; private PiShockShocker <shocker>5__1; private string <responseString>5__2; private PiShockShocker <>s__3; private BeepPiShockRequest <request>5__4; private global::System.Threading.Tasks.Task<HttpResponseMessage> <response>5__5; private string <>s__6; private ShockPiShockRequest <request>5__7; private global::System.Threading.Tasks.Task<HttpResponseMessage> <response>5__8; private string <>s__9; private VibratePiShockRequest <request>5__10; private global::System.Threading.Tasks.Task<HttpResponseMessage> <response>5__11; private string <>s__12; private TaskAwaiter<PiShockShocker?> <>u__1; private TaskAwaiter<string> <>u__2; private void MoveNext() { //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; PiShockResponse result; try { TaskAwaiter<PiShockShocker> awaiter4; TaskAwaiter<string> awaiter3; TaskAwaiter<string> awaiter2; TaskAwaiter<string> awaiter; switch (num) { default: if (string.IsNullOrEmpty(username)) { result = new PiShockResponse(Success: false, "Invalid username"); } else if (string.IsNullOrEmpty(apiKey)) { result = new PiShockResponse(Success: false, "Invalid API key"); } else if ((duration < 1 || duration > 15) ? true : false) { result = new PiShockResponse(Success: false, "Duration must be between 1 and 15"); } else { if ((intensity >= 1 && intensity <= 100) || 1 == 0) { awaiter4 = <>4__this.retrieveShockerInfo(username, apiKey, sharecode).GetAwaiter(); if (!awaiter4.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter4; <Execute>d__5 <Execute>d__ = this; <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<PiShockShocker>, <Execute>d__5>(ref awaiter4, ref <Execute>d__); return; } goto IL_015b; } result = new PiShockResponse(Success: false, "Intensity must be between 1 and 100"); } goto end_IL_0007; case 0: awaiter4 = <>u__1; <>u__1 = default(TaskAwaiter<PiShockShocker>); num = (<>1__state = -1); goto IL_015b; case 1: awaiter3 = <>u__2; <>u__2 = default(TaskAwaiter<string>); num = (<>1__state = -1); goto IL_02e0; case 2: awaiter2 = <>u__2; <>u__2 = default(TaskAwaiter<string>); num = (<>1__state = -1); goto IL_0432; case 3: { awaiter = <>u__2; <>u__2 = default(TaskAwaiter<string>); num = (<>1__state = -1); goto IL_0578; } IL_0432: <>s__9 = awaiter2.GetResult(); <responseString>5__2 = <>s__9; <>s__9 = null; <request>5__7 = null; <response>5__8 = null; break; IL_015b: <>s__3 = awaiter4.GetResult(); <shocker>5__1 = <>s__3; <>s__3 = null; if (<shocker>5__1 != null) { duration = Math.Min(duration, <shocker>5__1.maxDuration); intensity = Math.Min(intensity, <shocker>5__1.maxIntensity); <responseString>5__2 = ""; if (mode == PiShockMode.Beep) { <request>5__4 = new BeepPiShockRequest { Username = username, Apikey = apiKey, Code = sharecode, Duration = duration.ToString(), Name = <shocker>5__1.name }; <response>5__5 = HttpClientJsonExtensions.PostAsJsonAsync<BeepPiShockRequest>(<>4__this.client, "https://do.pishock.com/api/apioperate", <request>5__4, (JsonSerializerOptions)null, default(CancellationToken)); awaiter3 = <response>5__5.Result.Content.ReadAsStringAsync().GetAwaiter(); if (!awaiter3.IsCompleted) { num = (<>1__state = 1); <>u__2 = awaiter3; <Execute>d__5 <Execute>d__ = this; <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<string>, <Execute>d__5>(ref awaiter3, ref <Execute>d__); return; } goto IL_02e0; } if (mode == PiShockMode.Shock) { <request>5__7 = new ShockPiShockRequest { Username = username, Apikey = apiKey, Code = sharecode, Duration = duration.ToString(), Intensity = intensity.ToString(), Name = <shocker>5__1.name }; <response>5__8 = HttpClientJsonExtensions.PostAsJsonAsync<ShockPiShockRequest>(<>4__this.client, "https://do.pishock.com/api/apioperate", <request>5__7, (JsonSerializerOptions)null, default(CancellationToken)); awaiter2 = <response>5__8.Result.Content.ReadAsStringAsync().GetAwaiter(); if (!awaiter2.IsCompleted) { num = (<>1__state = 2); <>u__2 = awaiter2; <Execute>d__5 <Execute>d__ = this; <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<string>, <Execute>d__5>(ref awaiter2, ref <Execute>d__); return; } goto IL_0432; } if (mode != PiShockMode.Vibrate) { break; } <request>5__10 = new VibratePiShockRequest { Username = username, Apikey = apiKey, Code = sharecode, Duration = duration.ToString(), Intensity = intensity.ToString(), Name = <shocker>5__1.name }; <response>5__11 = HttpClientJsonExtensions.PostAsJsonAsync<VibratePiShockRequest>(<>4__this.client, "https://do.pishock.com/api/apioperate", <request>5__10, (JsonSerializerOptions)null, default(CancellationToken)); awaiter = <response>5__11.Result.Content.ReadAsStringAsync().GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 3); <>u__2 = awaiter; <Execute>d__5 <Execute>d__ = this; <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<string>, <Execute>d__5>(ref awaiter, ref <Execute>d__); return; } goto IL_0578; } result = new PiShockResponse(Success: false, "Shocker does not exist"); goto end_IL_0007; IL_0578: <>s__12 = awaiter.GetResult(); <responseString>5__2 = <>s__12; <>s__12 = null; <request>5__10 = null; <response>5__11 = null; break; IL_02e0: <>s__6 = awaiter3.GetResult(); <responseString>5__2 = <>s__6; <>s__6 = null; Console.WriteLine(<responseString>5__2); <request>5__4 = null; <response>5__5 = null; break; } string text = <responseString>5__2; bool success = ((text == "Operation Succeeded." || text == "Operation Attempted.") ? true : false); result = new PiShockResponse(success, <responseString>5__2, duration, intensity); end_IL_0007:; } catch (global::System.Exception exception) { <>1__state = -2; <shocker>5__1 = null; <responseString>5__2 = null; <>t__builder.SetException(exception); return; } <>1__state = -2; <shocker>5__1 = null; <responseString>5__2 = null; <>t__builder.SetResult(result); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { } } [CompilerGenerated] private sealed class <retrieveShockerInfo>d__6 : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder<PiShockShocker> <>t__builder; public string username; public string apiKey; public string sharecode; public PiShockProvider <>4__this; private ShockerInfoPiShockRequest <request>5__1; private global::System.Threading.Tasks.Task<HttpResponseMessage> <response>5__2; private PiShockShocker <pishock>5__3; private string <>s__4; private TaskAwaiter<string> <>u__1; private void MoveNext() { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00a7: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; PiShockShocker result; try { if (num != 0) { } try { TaskAwaiter<string> awaiter; if (num != 0) { <request>5__1 = new ShockerInfoPiShockRequest { Username = username, Apikey = apiKey, Code = sharecode }; <response>5__2 = HttpClientJsonExtensions.PostAsJsonAsync<ShockerInfoPiShockRequest>(<>4__this.client, "https://do.pishock.com/api/GetShockerInfo", <request>5__1, (JsonSerializerOptions)null, default(CancellationToken)); awaiter = <response>5__2.Result.Content.ReadAsStringAsync().GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <retrieveShockerInfo>d__6 <retrieveShockerInfo>d__ = this; <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<string>, <retrieveShockerInfo>d__6>(ref awaiter, ref <retrieveShockerInfo>d__); return; } } else { awaiter = <>u__1; <>u__1 = default(TaskAwaiter<string>); num = (<>1__state = -1); } <>s__4 = awaiter.GetResult(); <pishock>5__3 = JsonSerializer.Deserialize<PiShockShocker>(<>s__4, (JsonSerializerOptions)null); <>s__4 = null; result = <pishock>5__3; } catch (global::System.Exception) { result = null; } } catch (global::System.Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(result); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { } } private const string app_name = "RumblePiShock"; private const string baseapiurl = "https://do.pishock.com/api"; private const string actionapiurl = "https://do.pishock.com/api/apioperate"; private const string infoapiurl = "https://do.pishock.com/api/GetShockerInfo"; private readonly HttpClient client = new HttpClient(); [AsyncStateMachine(typeof(<Execute>d__5))] [DebuggerStepThrough] public async global::System.Threading.Tasks.Task<PiShockResponse> Execute(string username, string apiKey, string sharecode, PiShockMode mode, int duration, int intensity) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(username)) { return new PiShockResponse(Success: false, "Invalid username"); } if (string.IsNullOrEmpty(apiKey)) { return new PiShockResponse(Success: false, "Invalid API key"); } if ((duration < 1 || duration > 15) ? true : false) { return new PiShockResponse(Success: false, "Duration must be between 1 and 15"); } if ((intensity < 1 || intensity > 100) ? true : false) { return new PiShockResponse(Success: false, "Intensity must be between 1 and 100"); } PiShockShocker shocker = await retrieveShockerInfo(username, apiKey, sharecode); if (shocker == null) { return new PiShockResponse(Success: false, "Shocker does not exist"); } duration = Math.Min(duration, shocker.maxDuration); intensity = Math.Min(intensity, shocker.maxIntensity); string responseString = ""; switch (mode) { case PiShockMode.Beep: { BeepPiShockRequest request3 = new BeepPiShockRequest { Username = username, Apikey = apiKey, Code = sharecode, Duration = duration.ToString(), Name = shocker.name }; global::System.Threading.Tasks.Task<HttpResponseMessage> response3 = HttpClientJsonExtensions.PostAsJsonAsync<BeepPiShockRequest>(client, "https://do.pishock.com/api/apioperate", request3, (JsonSerializerOptions)null, default(CancellationToken)); responseString = await response3.Result.Content.ReadAsStringAsync(); Console.WriteLine(responseString); break; } case PiShockMode.Shock: { ShockPiShockRequest request2 = new ShockPiShockRequest { Username = username, Apikey = apiKey, Code = sharecode, Duration = duration.ToString(), Intensity = intensity.ToString(), Name = shocker.name }; global::System.Threading.Tasks.Task<HttpResponseMessage> response2 = HttpClientJsonExtensions.PostAsJsonAsync<ShockPiShockRequest>(client, "https://do.pishock.com/api/apioperate", request2, (JsonSerializerOptions)null, default(CancellationToken)); responseString = await response2.Result.Content.ReadAsStringAsync(); break; } case PiShockMode.Vibrate: { VibratePiShockRequest request = new VibratePiShockRequest { Username = username, Apikey = apiKey, Code = sharecode, Duration = duration.ToString(), Intensity = intensity.ToString(), Name = shocker.name }; global::System.Threading.Tasks.Task<HttpResponseMessage> response = HttpClientJsonExtensions.PostAsJsonAsync<VibratePiShockRequest>(client, "https://do.pishock.com/api/apioperate", request, (JsonSerializerOptions)null, default(CancellationToken)); responseString = await response.Result.Content.ReadAsStringAsync(); break; } } string text = responseString; bool success = ((text == "Operation Succeeded." || text == "Operation Attempted.") ? true : false); return new PiShockResponse(success, responseString, duration, intensity); } [AsyncStateMachine(typeof(<retrieveShockerInfo>d__6))] [DebuggerStepThrough] private async global::System.Threading.Tasks.Task<PiShockShocker?> retrieveShockerInfo(string username, string apiKey, string sharecode) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) try { ShockerInfoPiShockRequest request = new ShockerInfoPiShockRequest { Username = username, Apikey = apiKey, Code = sharecode }; global::System.Threading.Tasks.Task<HttpResponseMessage> response = HttpClientJsonExtensions.PostAsJsonAsync<ShockerInfoPiShockRequest>(client, "https://do.pishock.com/api/GetShockerInfo", request, (JsonSerializerOptions)null, default(CancellationToken)); return JsonSerializer.Deserialize<PiShockShocker>(await response.Result.Content.ReadAsStringAsync(), (JsonSerializerOptions)null); } catch (global::System.Exception) { return null; } } private static ActionPiShockRequest getRequestForMode(PiShockMode mode, int duration, int intensity) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (1 == 0) { } ActionPiShockRequest result = mode switch { PiShockMode.Shock => new ShockPiShockRequest { Duration = duration.ToString(), Intensity = intensity.ToString() }, PiShockMode.Vibrate => new VibratePiShockRequest { Duration = duration.ToString(), Intensity = intensity.ToString() }, PiShockMode.Beep => new BeepPiShockRequest { Duration = duration.ToString() }, _ => throw new ArgumentOutOfRangeException("mode", (object)mode, (string)null), }; if (1 == 0) { } return result; } } public record PiShockResponse(bool Success, string Message, int FinalDuration = -1, int FinalIntensity = -1) { [CompilerGenerated] protected virtual global::System.Type EqualityContract { [CompilerGenerated] get { return typeof(PiShockResponse); } } [CompilerGenerated] public override string ToString() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown StringBuilder val = new StringBuilder(); val.Append("PiShockResponse"); val.Append(" { "); if (PrintMembers(val)) { val.Append(' '); } val.Append('}'); return ((object)val).ToString(); } [CompilerGenerated] protected virtual bool PrintMembers(StringBuilder builder) { RuntimeHelpers.EnsureSufficientExecutionStack(); builder.Append("Success = "); builder.Append(((object)Success).ToString()); builder.Append(", Message = "); builder.Append((object)Message); builder.Append(", FinalDuration = "); builder.Append(((object)FinalDuration).ToString()); builder.Append(", FinalIntensity = "); builder.Append(((object)FinalIntensity).ToString()); return true; } [CompilerGenerated] public virtual bool Equals(PiShockResponse? other) { return (object)this == other || ((object)other != null && EqualityContract == other.EqualityContract && EqualityComparer<bool>.Default.Equals(Success, other.Success) && EqualityComparer<string>.Default.Equals(Message, other.Message) && EqualityComparer<int>.Default.Equals(FinalDuration, other.FinalDuration) && EqualityComparer<int>.Default.Equals(FinalIntensity, other.FinalIntensity)); } } public class PiShockShocker { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int clientId { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int id { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string name { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool paused { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int maxIntensity { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int maxDuration { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool online { [CompilerGenerated] get; [CompilerGenerated] set; } } public enum PiShockMode { Shock, Vibrate, Beep } public abstract class BasePiShockRequest { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Username { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Code { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Apikey { [CompilerGenerated] get; [CompilerGenerated] set; } } public abstract class ActionPiShockRequest : BasePiShockRequest { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Name { [CompilerGenerated] get; [CompilerGenerated] set; } public string Op => ((int)Mode).ToString(); protected virtual PiShockMode Mode => PiShockMode.Shock; } public class ShockerInfoPiShockRequest : BasePiShockRequest { } public class ShockPiShockRequest : ActionPiShockRequest { protected override PiShockMode Mode => PiShockMode.Shock; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Duration { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Intensity { [CompilerGenerated] get; [CompilerGenerated] set; } } public class VibratePiShockRequest : ActionPiShockRequest { protected override PiShockMode Mode => PiShockMode.Vibrate; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Duration { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Intensity { [CompilerGenerated] get; [CompilerGenerated] set; } } public class BeepPiShockRequest : ActionPiShockRequest { protected override PiShockMode Mode => PiShockMode.Beep; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Duration { [CompilerGenerated] get; [CompilerGenerated] set; } } }