Instantly share code, notes, and snippets.

@shoter /Program.cs Secret
Created Sep 2, 2018

Embed
What would you like to do?
Decompilled Program.cs
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
namespace ConsoleApp1
{
// Token: 0x02000002 RID: 2
public class Program
{
// Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
public static Task task()
{
Program.<task>d__0 <task>d__;
<task>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
<task>d__.<>1__state = -1;
AsyncTaskMethodBuilder <>t__builder = <task>d__.<>t__builder;
<>t__builder.Start<Program.<task>d__0>(ref <task>d__);
return <task>d__.<>t__builder.Task;
}
// Token: 0x06000002 RID: 2 RVA: 0x00002090 File Offset: 0x00000290
public static Task Main()
{
Program.<Main>d__1 <Main>d__;
<Main>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
<Main>d__.<>1__state = -1;
AsyncTaskMethodBuilder <>t__builder = <Main>d__.<>t__builder;
<>t__builder.Start<Program.<Main>d__1>(ref <Main>d__);
return <Main>d__.<>t__builder.Task;
}
// Token: 0x06000003 RID: 3 RVA: 0x000020CD File Offset: 0x000002CD
public Program()
{
}
// Token: 0x06000004 RID: 4 RVA: 0x000020D8 File Offset: 0x000002D8
private static void <Main>()
{
Program.Main().GetAwaiter().GetResult();
}
// Token: 0x02000003 RID: 3
[CompilerGenerated]
[StructLayout(LayoutKind.Auto)]
private struct <task>d__0 : IAsyncStateMachine
{
// Token: 0x06000005 RID: 5 RVA: 0x000020F8 File Offset: 0x000002F8
void IAsyncStateMachine.MoveNext()
{
int num = this.<>1__state;
try
{
TaskAwaiter awaiter;
switch (num)
{
case 0:
awaiter = this.<>u__1;
this.<>u__1 = default(TaskAwaiter);
this.<>1__state = -1;
break;
case 1:
awaiter = this.<>u__1;
this.<>u__1 = default(TaskAwaiter);
this.<>1__state = -1;
goto IL_E4;
case 2:
awaiter = this.<>u__1;
this.<>u__1 = default(TaskAwaiter);
this.<>1__state = -1;
goto IL_14A;
default:
Console.WriteLine("task:before first delay");
awaiter = Task.Delay(1500).GetAwaiter();
if (!awaiter.IsCompleted)
{
this.<>1__state = 0;
this.<>u__1 = awaiter;
this.<>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter, Program.<task>d__0>(ref awaiter, ref this);
return;
}
break;
}
awaiter.GetResult();
Console.WriteLine("task:after first delay");
awaiter = Task.Delay(500).GetAwaiter();
if (!awaiter.IsCompleted)
{
this.<>1__state = 1;
this.<>u__1 = awaiter;
this.<>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter, Program.<task>d__0>(ref awaiter, ref this);
return;
}
IL_E4:
awaiter.GetResult();
Console.WriteLine("task:after second delay");
awaiter = Task.Delay(1500).GetAwaiter();
if (!awaiter.IsCompleted)
{
this.<>1__state = 2;
this.<>u__1 = awaiter;
this.<>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter, Program.<task>d__0>(ref awaiter, ref this);
return;
}
IL_14A:
awaiter.GetResult();
Console.WriteLine("task:after third delay");
}
catch (Exception exception)
{
this.<>1__state = -2;
this.<>t__builder.SetException(exception);
return;
}
this.<>1__state = -2;
this.<>t__builder.SetResult();
}
// Token: 0x06000006 RID: 6 RVA: 0x000022A8 File Offset: 0x000004A8
[DebuggerHidden]
void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine)
{
this.<>t__builder.SetStateMachine(stateMachine);
}
// Token: 0x04000001 RID: 1
public int <>1__state;
// Token: 0x04000002 RID: 2
public AsyncTaskMethodBuilder <>t__builder;
// Token: 0x04000003 RID: 3
private TaskAwaiter <>u__1;
}
// Token: 0x02000004 RID: 4
[CompilerGenerated]
[StructLayout(LayoutKind.Auto)]
private struct <Main>d__1 : IAsyncStateMachine
{
// Token: 0x06000007 RID: 7 RVA: 0x000022B8 File Offset: 0x000004B8
void IAsyncStateMachine.MoveNext()
{
int num = this.<>1__state;
try
{
TaskAwaiter awaiter;
switch (num)
{
case 0:
awaiter = this.<>u__1;
this.<>u__1 = default(TaskAwaiter);
this.<>1__state = -1;
break;
case 1:
awaiter = this.<>u__1;
this.<>u__1 = default(TaskAwaiter);
this.<>1__state = -1;
goto IL_DA;
case 2:
awaiter = this.<>u__1;
this.<>u__1 = default(TaskAwaiter);
this.<>1__state = -1;
goto IL_13B;
default:
Console.WriteLine("main:before first delay");
awaiter = Program.task().GetAwaiter();
if (!awaiter.IsCompleted)
{
this.<>1__state = 0;
this.<>u__1 = awaiter;
this.<>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter, Program.<Main>d__1>(ref awaiter, ref this);
return;
}
break;
}
awaiter.GetResult();
Console.WriteLine("main:after first delay");
awaiter = Program.task().GetAwaiter();
if (!awaiter.IsCompleted)
{
this.<>1__state = 1;
this.<>u__1 = awaiter;
this.<>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter, Program.<Main>d__1>(ref awaiter, ref this);
return;
}
IL_DA:
awaiter.GetResult();
Console.WriteLine("main:after second delay");
awaiter = Program.task().GetAwaiter();
if (!awaiter.IsCompleted)
{
this.<>1__state = 2;
this.<>u__1 = awaiter;
this.<>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter, Program.<Main>d__1>(ref awaiter, ref this);
return;
}
IL_13B:
awaiter.GetResult();
Console.WriteLine("main:after third delay");
}
catch (Exception exception)
{
this.<>1__state = -2;
this.<>t__builder.SetException(exception);
return;
}
this.<>1__state = -2;
this.<>t__builder.SetResult();
}
// Token: 0x06000008 RID: 8 RVA: 0x0000245C File Offset: 0x0000065C
[DebuggerHidden]
void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine)
{
this.<>t__builder.SetStateMachine(stateMachine);
}
// Token: 0x04000004 RID: 4
public int <>1__state;
// Token: 0x04000005 RID: 5
public AsyncTaskMethodBuilder <>t__builder;
// Token: 0x04000006 RID: 6
private TaskAwaiter <>u__1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment