Imports System
Imports System.Collections.Generic
Imports System.IO
Imports System.Reflection
Imports System.Reflection.Emit
Imports System.Text
Namespace A
Friend NotInheritable Class
' Methods
Private Shared Function (ByVal base1 As MethodBase) As Type()
Dim typeArray As Type()
Dim num3 As Integer
Dim infoArray As ParameterInfo() = base1.GetParameters
Dim length As Integer = infoArray.Length
If base1.IsStatic Then
goto Label_002E
End If
Label_0017:
Select Case 6
Case 0
goto Label_0017
Case Else
If (1 = 0) Then
End If
length += 1
Exit Select
End Select
Label_002E:
typeArray = New Type(length - 1) {}
Dim index As Integer = 0
If base1.IsStatic Then
goto Label_0089
End If
Label_0041:
Select Case 5
Case 0
goto Label_0041
Case Else
Dim declaringType As Type = base1.DeclaringType
If Not declaringType.IsValueType Then
Dim type9 As Type = base1.DeclaringType
typeArray(0) = type9
goto Label_0085
End If
Exit Select
End Select
Label_005C:
Select Case 7
Case 0
goto Label_005C
Case Else
Dim type8 As Type = base1.DeclaringType.MakeByRefType
typeArray(0) = type8
Exit Select
End Select
Label_0085:
index += 1
Label_0089:
num3 = 0
Do While (num3 < infoArray.Length)
typeArray(index) = infoArray(num3).ParameterType
num3 += 1
index += 1
Loop
Label_00AD:
Select Case 2
Case 0
goto Label_00AD
End Select
Return typeArray
End Function
Private Shared Sub (ByRef numRef1 As Integer, ByVal info1 As DynamicILInfo)
Dim count As Integer = BitConverter.ToInt32(., numRef1)
numRef1 = (numRef1 + 4)
If (count <> 0) Then
Dim dst As Byte() = New Byte(count - 1) {}
Buffer.BlockCopy(., numRef1, dst, 0, count)
Dim startIndex As Integer = 4
Dim num3 As Integer = ((count - 4) / &H18)
Dim i As Integer
For i = 0 To num3 - 1
Dim num10 As Integer = BitConverter.ToInt32(dst, startIndex)
Dim options As ExceptionHandlingClauseOptions = DirectCast(num10, ExceptionHandlingClauseOptions)
startIndex = (startIndex + 20)
Select Case options
Case ExceptionHandlingClauseOptions.Clause
Dim typeToken As Integer = BitConverter.ToInt32(dst, startIndex)
Dim type As RuntimeTypeHandle = ..ResolveTypeHandle(typeToken)
Dim num5 As Integer = info1.GetTokenFor(type)
.(num5, startIndex, dst)
Exit Select
Case ExceptionHandlingClauseOptions.Fault
Throw New NotSupportedException("dynamic method does not support fault clause")
End Select
startIndex = (startIndex + 4)
Next i
Label_00CD:
Select Case 7
Case 0
goto Label_00CD
End Select
info1.SetExceptions(dst)
Return
End If
Label_0018:
Select Case 5
Case 0
goto Label_0018
End Select
If (1 = 0) Then
End If
End Sub
Private Shared Sub (ByVal body1 As MethodBody, ByVal info1 As DynamicILInfo)
Dim helper As SignatureHelper = SignatureHelper.GetLocalVarSigHelper
Dim enumerator As IEnumerator(Of LocalVariableInfo) = body1.LocalVariables.GetEnumerator
Try
Do While enumerator.MoveNext
Dim info As LocalVariableInfo = enumerator.Current
Dim localType As Type = info.LocalType
Dim isPinned As Boolean = info.IsPinned
helper.AddArgument(localType, isPinned)
Loop
Label_0043:
Select Case 5
Case 0
goto Label_0043
End Select
If (1 = 0) Then
End If
Finally
If (enumerator Is Nothing) Then
goto Label_006B
End If
Label_005B:
Select Case 6
Case 0
goto Label_005B
Case Else
enumerator.Dispose
Exit Select
End Select
Label_006B:
End Try
Dim signature As Byte() = helper.GetSignature
info1.SetLocalSignature(signature)
End Sub
Public Shared Sub (ByVal num2 As Integer, ByVal num1 As Integer, ByVal buffer1 As Byte())
buffer1(num1++) = CByte(num2)
buffer1(num1++) = CByte((num2 >> 8))
buffer1(num1++) = CByte((num2 >> &H10))
buffer1(num1++) = CByte((num2 >> &H18))
End Sub
Private Shared Sub (ByRef numRef1 As Integer, ByVal base1 As MethodBase, ByVal info1 As DynamicILInfo)
Dim maxStackSize As Integer = BitConverter.ToInt32(., numRef1)
numRef1 = (numRef1 + 4)
Dim count As Integer = BitConverter.ToInt32(., numRef1)
numRef1 = (numRef1 + 4)
Dim dst As Byte() = New Byte(count - 1) {}
Buffer.BlockCopy(., numRef1, dst, 0, count)
New (base1, dst, info1).
info1.SetCode(dst, maxStackSize)
numRef1 = (numRef1 + count)
End Sub
Friend Shared Sub (ByVal num1 As Integer, ByVal num3 As Integer, ByVal num4 As Integer)
Dim type As Type
Dim base2 As MethodBase
Try
Dim handle As RuntimeTypeHandle = ..ResolveTypeHandle(num1)
type = Type.GetTypeFromHandle(handle)
Dim handle7 As RuntimeMethodHandle = ..ResolveMethodHandle(num3)
Dim declaringType As RuntimeTypeHandle = ..ResolveTypeHandle(num4)
Dim methodFromHandle As MethodBase = MethodBase.GetMethodFromHandle(handle7, declaringType)
Dim obj2 As Object = methodFromHandle
base2 = DirectCast(obj2, MethodBase)
Catch exception3 As Exception
Throw
End Try
Dim fields As FieldInfo() = type.GetFields((BindingFlags.GetField Or (BindingFlags.NonPublic Or BindingFlags.Static)))
Dim info As FieldInfo
For Each info In fields
Try
Dim type8 As Type
Dim num As Integer
Dim expressionStack_D5_0 As String
Dim expressionStack_B3_0 As String
Dim expressionStack_D6_0 As Object
Dim expressionStack_D6_1 As String
Dim expressionStack_C6_0 As String
Dim method As DynamicMethod = Nothing
Dim body As MethodBody = base2.GetMethodBody
Dim parameterTypes As Type() = .(base2)
Dim type6 As Type = base2.DeclaringType
Dim fullName As String = type6.FullName
Dim name As String = base2.Name
Dim text6 As String = (fullName & "." & name & "_Encrypted$")
If TypeOf base2 Is ConstructorInfo Then
expressionStack_D5_0 = text6
goto Label_00D5
Else
expressionStack_B3_0 = text6
End If
Label_00B3:
Select Case 6
Case 0
goto Label_00B3
Case Else
Dim expressionStack_C0_0 As String
Dim expressionStack_BD_0 As String = expressionStack_B3_0
If (1 <> 0) Then
expressionStack_C6_0 = expressionStack_BD_0
Exit Select
Else
expressionStack_C0_0 = expressionStack_BD_0
End If
expressionStack_C6_0 = expressionStack_C0_0
Exit Select
End Select
Dim returnType As Type = DirectCast(base2, MethodInfo).ReturnType
If (returnType OrElse True) Then
expressionStack_D6_1 = expressionStack_C6_0
expressionStack_D6_0 = returnType
goto Label_00D6
Else
expressionStack_D5_0 = CStr(returnType)
End If
expressionStack_D5_0 = expressionStack_C6_0
Label_00D5:
expressionStack_D6_1 = expressionStack_D5_0
expressionStack_D6_0 = Nothing
Label_00D6:
type8 = base2.DeclaringType
method = New DynamicMethod(expressionStack_D6_1, DirectCast(expressionStack_D6_0, Type), parameterTypes, type8, True)
Dim flag2 As Boolean = ..TryGetValue(num1, num)
Dim info2 As DynamicILInfo = method.GetDynamicILInfo
.(body, info2)
.(num, base2, info2)
.(num, info2)
Dim delegate2 As Delegate = method.CreateDelegate(type)
info.SetValue(Nothing, delegate2)
Catch exception4 As Exception
End Try
Next
Label_014A:
Select Case 6
Case 0
goto Label_014A
End Select
End Sub
Shared Sub New()
Dim type2 As Type
If (Not . Is Nothing) Then
goto Label_00D8
End If
Label_000A:
Select Case 5
Case 0
goto Label_000A
Case Else
If (1 = 0) Then
End If
Dim s As String = "SW52ZXJzZSBUcm9sbGVyKg=="
Dim bytes As Byte() = Convert.FromBase64String(s)
s = Encoding.UTF8.GetString(bytes, 0, bytes.Length)
Dim stream As Stream = Assembly.GetExecutingAssembly.GetManifestResourceStream(s)
Dim buffer4 As Byte() = .(&H61, stream)
. = buffer4
Dim reader As New BinaryReader(New MemoryStream(., False))
Try
Dim num As Integer = reader.ReadInt32
Dim i As Integer
For i = 0 To num - 1
Dim num3 As Integer = reader.ReadInt32
Dim num4 As Integer = reader.ReadInt32
..Item(num3) = num4
Next i
Label_00B8:
Select Case 5
Case 0
goto Label_00B8
End Select
Finally
If (reader Is Nothing) Then
goto Label_00D7
End If
Label_00C7:
Select Case 4
Case 0
goto Label_00C7
Case Else
reader.Dispose
Exit Select
End Select
Label_00D7:
End Try
Exit Select
End Select
Label_00D8:
type2 = GetType(MulticastDelegate)
If (type2 Is Nothing) Then
Return
End If
Label_00E6:
Select Case 5
Case 0
goto Label_00E6
Case Else
Dim modules As Module() = Assembly.GetExecutingAssembly.GetModules
Dim moduleHandle As ModuleHandle = modules(0).ModuleHandle
. = moduleHandle
Exit Select
End Select
End Sub
' Fields
Friend Shared ReadOnly As Byte()
Friend Shared ReadOnly As Dictionary(Of Integer,
Integer) Private Shared ReadOnly As ModuleHandle
' Nested Types
Public NotInheritable Class
' Methods
Private Function () As Byte
Return Me.(Me.++)
End Function
Private Function () As Integer
Dim startIndex As Integer = Me.
Me. = (Me. + 4)
Return BitConverter.ToInt32(Me., startIndex)
End Function
Private Function () As Object
Dim num48 As Integer
Dim info2 As MemberInfo
Dim base3 As MethodBase
Dim num As Integer = Me.
Dim nop As OpCode = OpCodes.Nop
Dim metadataToken As Integer = 0
Dim index As Byte = Me.
If (index = &HFE) Then
index = Me.
nop = .(index)
goto Label_0060
End If
Label_0020:
Select Case 6
Case 0
goto Label_0020
Case Else
If (1 = 0) Then
End If
nop = .(index)
Exit Select
End Select
Label_0060:
Select Case nop.OperandType
Case OperandType.InlineBrTarget
Me.(4)
Return Nothing
Case OperandType.InlineField
metadataToken = Me.
Dim info As FieldInfo = Me..ResolveField(metadataToken, Me., Me.)
Dim fieldHandle As RuntimeFieldHandle = info.FieldHandle
Dim num39 As Integer = Me..GetTokenFor(fieldHandle)
Dim size As Integer = nop.Size
Me.(num39, (num + size))
Return Nothing
Case OperandType.InlineI
Me.(4)
Return Nothing
Case OperandType.InlineI8
Me.(8)
Return Nothing
Case OperandType.InlineMethod
metadataToken = Me.
Dim base2 As MethodBase = Me..ResolveMethod(metadataToken, Me., Me.)
Dim method As RuntimeMethodHandle = base2.MethodHandle
Dim type9 As Type = base2.DeclaringType
Dim handle10 As RuntimeTypeHandle = type9.TypeHandle
Dim num36 As Integer = Me..GetTokenFor(method, handle10)
Dim num37 As Integer = nop.Size
Me.(num36, (num + num37))
Return Nothing
Case OperandType.InlineNone
Return Nothing
Case OperandType.InlineR
Me.(8)
Return Nothing
Case OperandType.InlineSig
metadataToken = Me.
Dim signature As Byte() = Me..ResolveSignature(metadataToken)
Dim num33 As Integer = Me..GetTokenFor(signature)
Dim num34 As Integer = nop.Size
Me.(num33, (num + num34))
Return Nothing
Case OperandType.InlineString
metadataToken = Me.
Dim literal As String = Me..ResolveString(metadataToken)
Dim num30 As Integer = Me..GetTokenFor(literal)
Dim num31 As Integer = nop.Size
Me.(num30, (num + num31))
Return Nothing
Case OperandType.InlineSwitch
Dim num4 As Integer = Me.
Me.((num4 * 4))
Return Nothing
Case OperandType.InlineTok
metadataToken = Me.
info2 = Me..ResolveMember(metadataToken, Me., Me.)
If (info2.MemberType = MemberTypes.TypeInfo) Then
Exit Select
End If
Label_02B0:
Select Case 6
Case 0
goto Label_02B0
Case Else
If (info2.MemberType <> MemberTypes.NestedType) Then
If (info2.MemberType = MemberTypes.Method) Then
goto Label_0325
End If
Label_0305:
Select Case 7
Case 0
goto Label_0305
Case Else
If (info2.MemberType <> MemberTypes.Constructor) Then
If (info2.MemberType <> MemberTypes.Field) Then
goto Label_038D
End If
Label_0363:
Select Case 4
Case 0
goto Label_0363
End Select
Dim info3 As FieldInfo = TryCast(info2,FieldInfo)
Dim field As RuntimeFieldHandle = info3.FieldHandle
metadataToken = Me..GetTokenFor(field)
goto Label_038D
End If
Exit Select
End Select
Label_031B:
Select Case 3
Case 0
goto Label_031B
End Select
goto Label_0325
End If
Exit Select
End Select
Label_02CA:
Select Case 7
Case 0
goto Label_02CA
End Select
Exit Select
Case OperandType.InlineType
metadataToken = Me.
Dim type As Type = Me..ResolveType(metadataToken, Me., Me.)
Dim handle12 As RuntimeTypeHandle = type.TypeHandle
Dim num42 As Integer = Me..GetTokenFor(handle12)
Dim num43 As Integer = nop.Size
Me.(num42, (num + num43))
Return Nothing
Case OperandType.InlineVar
Me.(2)
Return Nothing
Case OperandType.ShortInlineBrTarget
Me.(1)
Return Nothing
Case OperandType.ShortInlineI
Me.(1)
Return Nothing
Case OperandType.ShortInlineR
Me.(4)
Return Nothing
Case OperandType.ShortInlineVar
Me.(1)
Return Nothing
Case Else
Dim operandType As OperandType = nop.OperandType
Dim message As String = ("unexpected OperandType " & operandType)
Throw New BadImageFormatException(message)
End Select
Dim type2 As Type = TryCast(info2,Type)
Dim typeHandle As RuntimeTypeHandle = type2.TypeHandle
metadataToken = Me..GetTokenFor(typeHandle)
goto Label_038D
Label_0325:
base3 = TryCast(info2,MethodBase)
Dim methodHandle As RuntimeMethodHandle = base3.MethodHandle
Dim declaringType As Type = base3.DeclaringType
Dim contextType As RuntimeTypeHandle = declaringType.TypeHandle
metadataToken = Me..GetTokenFor(methodHandle, contextType)
Label_038D:
num48 = nop.Size
Me.(metadataToken, (num + num48))
Return Nothing
End Function
Friend Sub ()
Do While (Me. < Me..Length)
Dim obj2 As Object = Me.
Loop
Label_001B:
Select Case 6
Case 0
goto Label_001B
End Select
If (1 = 0) Then
End If
End Sub
Private Sub (ByVal num1 As Integer)
Me. = (Me. + num1)
End Sub
Private Sub (ByVal num2 As Integer, ByVal num1 As Integer)
Me.(num1++) = CByte(num2)
Me.(num1++) = CByte((num2 >> 8))
Me.(num1++) = CByte((num2 >> &H10))
Me.(num1++) = CByte((num2 >> &H18))
End Sub
Shared Sub New()
Dim fields As FieldInfo() = GetType(OpCodes).GetFields((BindingFlags.Public Or BindingFlags.Static))
Dim info As FieldInfo
For Each info In fields
Dim obj2 As Object = info.GetValue(Nothing)
Dim code As OpCode = DirectCast(obj2, OpCode)
Dim num3 As Short = code.Value
Dim index As UInt16 = CUShort(num3)
If (index >= &H100) Then
goto Label_0089
End If
Label_0063:
Select Case 3
Case 0
goto Label_0063
Case Else
If (1 = 0) Then
End If
.(index) = code
Continue
End Select
Label_0089:
If ((index And &HFF00) <> &HFE00) Then
Continue For
End If
Label_0097:
Select Case 7
Case 0
goto Label_0097
Case Else
.((index And &HFF)) = code
Exit Select
End Select
Next
Label_00C8:
Select Case 3
Case 0
goto Label_00C8
End Select
End Sub
Public Sub New(ByVal base1 As MethodBase, ByVal buffer1 As Byte(), ByVal info1 As DynamicILInfo)
' This item is obfuscated and can not be translated.
Dim typeArray2 As Type()
Dim genericArguments As Type()
Me. = info1
Me. = buffer1
Me. = 0
Dim module As Module = base1.Module
Me. = [module]
If TypeOf base1 Is ConstructorInfo Then
goto Label_0050
End If
Label_0032:
Select Case 4
Case 0
goto Label_0032
Case Else
If (1 <> 0) Then
goto Label_0045
End If
genericArguments = base1.GetGenericArguments
If (genericArguments OrElse True) Then
End If
Exit Select
End Select
Label_0050:
genericArguments. = Nothing
If (base1.DeclaringType Is Nothing) Then
goto Label_007C
End If
Label_0060:
Select Case 7
Case 0
goto Label_0060
Case Else
typeArray2 = base1.DeclaringType.GetGenericArguments
If (typeArray2 OrElse True) Then
End If
Exit Select
End Select
Label_007C:
typeArray2. = Nothing
End Sub
' Fields
Private As Byte()
Private As Integer
Private As DynamicILInfo
Private As Module
Private Shared As OpCode() = New OpCode(&H100 - 1) {}
Private As Type()
Private Shared As OpCode() = New OpCode(&H100 - 1) {}
Private As Type()
End Class
End Class
End Namespace