public MethodSig(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; byte callingConvention = pSignature[pCursor++]; HasThis = (callingConvention & CallingConvention.HasThis) != 0; ExplicitThis = (callingConvention & CallingConvention.ExplicitThis) != 0; if ((callingConvention & CallingConvention.HasThis) != 0) callingConvention ^= CallingConvention.HasThis; if ((callingConvention & CallingConvention.ExplicitThis) != 0) callingConvention ^= CallingConvention.ExplicitThis; Default = callingConvention == CallingConvention.Default; CCall = callingConvention == CallingConvention.CCall; STDCall = callingConvention == CallingConvention.STDCall; ThisCall = callingConvention == CallingConvention.ThisCall; FastCall = callingConvention == CallingConvention.FastCall; VarArg = callingConvention == CallingConvention.VarArgs; Generic = callingConvention == CallingConvention.Generic; if (Generic) GenParamCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); uint paramCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); Params = new List<SigParam>((int)paramCount); RetType = new SigRetType(CLIFile, pSignature, ref pCursor); if (paramCount > 0) { for (uint paramIndex = 0; paramIndex < paramCount; ++paramIndex) { if (pSignature[pCursor] == (byte)SigElementType.Sentinel) { HasSentinel = true; SentinelIndex = paramIndex; ++pCursor; } Params.Add(new SigParam(CLIFile, pSignature, ref pCursor)); } } }
public SigArrayShape(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; Rank = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); uint sizeCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); Sizes = new List<uint>((int)sizeCount); for (uint sizeIndex = 0; sizeIndex < sizeCount; ++sizeIndex) Sizes.Add(CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor)); uint lowBoundCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); LowBounds = new List<int>((int)lowBoundCount); for (uint lowBoundIndex = 0; lowBoundIndex < lowBoundCount; ++lowBoundIndex) LowBounds.Add(CLIFile.ReadCompressedSigned(pSignature, ref pCursor)); }
public SigCustomMod(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; Optional = pSignature[pCursor++] == (byte)SigElementType.CustomModifier_Optional; TypeDefOrRefOrSpecToken = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); }
public SigCustomMod(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; Optional = pSignature[pCursor++] == (byte)SigElementType.CustomModifier_Optional; TypeDefOrRefOrSpecToken = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); }
public MethodSig(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; byte callingConvention = pSignature[pCursor++]; HasThis = (callingConvention & CallingConvention.HasThis) != 0; ExplicitThis = (callingConvention & CallingConvention.ExplicitThis) != 0; if ((callingConvention & CallingConvention.HasThis) != 0) { callingConvention ^= CallingConvention.HasThis; } if ((callingConvention & CallingConvention.ExplicitThis) != 0) { callingConvention ^= CallingConvention.ExplicitThis; } Default = callingConvention == CallingConvention.Default; CCall = callingConvention == CallingConvention.CCall; STDCall = callingConvention == CallingConvention.STDCall; ThisCall = callingConvention == CallingConvention.ThisCall; FastCall = callingConvention == CallingConvention.FastCall; VarArg = callingConvention == CallingConvention.VarArgs; Generic = callingConvention == CallingConvention.Generic; if (Generic) { GenParamCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); } uint paramCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); Params = new List <SigParam>((int)paramCount); RetType = new SigRetType(CLIFile, pSignature, ref pCursor); if (paramCount > 0) { for (uint paramIndex = 0; paramIndex < paramCount; ++paramIndex) { if (pSignature[pCursor] == (byte)SigElementType.Sentinel) { HasSentinel = true; SentinelIndex = paramIndex; ++pCursor; } Params.Add(new SigParam(CLIFile, pSignature, ref pCursor)); } } }
public MethodSpecSig(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; ++pCursor; uint genArgsCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); GenArgs = new List<SigType>((int)genArgsCount); for (uint genArgsIndex = 0; genArgsIndex < genArgsCount; ++genArgsIndex) GenArgs.Add(new SigType(CLIFile, pSignature, ref pCursor)); }
public LocalVarSig(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; ++pCursor; uint localVarCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); LocalVars = new List<SigLocalVar>((int)localVarCount); for (uint localVarIndex = 0; localVarIndex < localVarCount; ++localVarIndex) LocalVars.Add(new SigLocalVar(CLIFile, pSignature, ref pCursor)); }
public SigArrayShape(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; Rank = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); uint sizeCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); Sizes = new List <uint>((int)sizeCount); for (uint sizeIndex = 0; sizeIndex < sizeCount; ++sizeIndex) { Sizes.Add(CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor)); } uint lowBoundCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); LowBounds = new List <int>((int)lowBoundCount); for (uint lowBoundIndex = 0; lowBoundIndex < lowBoundCount; ++lowBoundIndex) { LowBounds.Add(CLIFile.ReadCompressedSigned(pSignature, ref pCursor)); } }
public LocalVarSig(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; ++pCursor; uint localVarCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); LocalVars = new List <SigLocalVar>((int)localVarCount); for (uint localVarIndex = 0; localVarIndex < localVarCount; ++localVarIndex) { LocalVars.Add(new SigLocalVar(CLIFile, pSignature, ref pCursor)); } }
public MethodSpecSig(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; ++pCursor; uint genArgsCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); GenArgs = new List <SigType>((int)genArgsCount); for (uint genArgsIndex = 0; genArgsIndex < genArgsCount; ++genArgsIndex) { GenArgs.Add(new SigType(CLIFile, pSignature, ref pCursor)); } }
public PropertySig(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; HasThis = (pSignature[pCursor++] & CallingConvention.HasThis) != 0; uint paramCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); while (pSignature[pCursor] == (byte)SigElementType.CustomModifier_Required || pSignature[pCursor] == (byte)SigElementType.CustomModifier_Optional) { Mods.Add(new SigCustomMod(CLIFile, pSignature, ref pCursor)); } Type = new SigType(CLIFile, pSignature, ref pCursor); Params = new List<SigParam>((int)paramCount); for (uint paramIndex = 0; paramIndex < paramCount; ++paramIndex) Params.Add(new SigParam(CLIFile, pSignature, ref pCursor)); }
public PropertySig(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; HasThis = (pSignature[pCursor++] & CallingConvention.HasThis) != 0; uint paramCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); while (pSignature[pCursor] == (byte)SigElementType.CustomModifier_Required || pSignature[pCursor] == (byte)SigElementType.CustomModifier_Optional) { Mods.Add(new SigCustomMod(CLIFile, pSignature, ref pCursor)); } Type = new SigType(CLIFile, pSignature, ref pCursor); Params = new List <SigParam>((int)paramCount); for (uint paramIndex = 0; paramIndex < paramCount; ++paramIndex) { Params.Add(new SigParam(CLIFile, pSignature, ref pCursor)); } }
public SigType(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; ElementType = (SigElementType)pSignature[pCursor++]; switch (ElementType) { case SigElementType.Array: ArrayType = new SigType(CLIFile, pSignature, ref pCursor); ArrayShape = new SigArrayShape(CLIFile, pSignature, ref pCursor); break; case SigElementType.Class: ClassTypeDefOrRefOrSpecToken = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); break; case SigElementType.FunctionPointer: FnPtrMethodSig = new MethodSig(CLIFile, pSignature, ref pCursor); break; case SigElementType.GenericInstantiation: { GenericInstClass = pSignature[pCursor] == (byte)SigElementType.Class; GenericInstValueType = pSignature[pCursor] == (byte)SigElementType.ValueType; ++pCursor; GenericInstTypeDefOrRefOrSpecToken = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); uint genericInstGenArgCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); GenericInstGenArgs = new List<SigType>((int)genericInstGenArgCount); for (uint genericInstGenArgIndex = 0; genericInstGenArgIndex < genericInstGenArgCount; ++genericInstGenArgIndex) GenericInstGenArgs.Add(new SigType(CLIFile, pSignature, ref pCursor)); break; } case SigElementType.MethodVar: MVarNumber = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); break; case SigElementType.Pointer: while (pSignature[pCursor] == (byte)SigElementType.CustomModifier_Required || pSignature[pCursor] == (byte)SigElementType.CustomModifier_Optional) { PtrMods.Add(new SigCustomMod(CLIFile, pSignature, ref pCursor)); } if (pSignature[pCursor] == (byte)SigElementType.Void) { PtrVoid = true; ++pCursor; } else PtrType = new SigType(CLIFile, pSignature, ref pCursor); break; case SigElementType.SingleDimensionArray: while (pSignature[pCursor] == (byte)SigElementType.CustomModifier_Required || pSignature[pCursor] == (byte)SigElementType.CustomModifier_Optional) { SZArrayMods.Add(new SigCustomMod(CLIFile, pSignature, ref pCursor)); } SZArrayType = new SigType(CLIFile, pSignature, ref pCursor); break; case SigElementType.ValueType: ValueTypeDefOrRefOrSpecToken = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); break; case SigElementType.Var: VarNumber = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); break; default: break; } }
public SigType(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; ElementType = (SigElementType)pSignature[pCursor++]; switch (ElementType) { case SigElementType.Array: ArrayType = new SigType(CLIFile, pSignature, ref pCursor); ArrayShape = new SigArrayShape(CLIFile, pSignature, ref pCursor); break; case SigElementType.Class: ClassTypeDefOrRefOrSpecToken = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); break; case SigElementType.FunctionPointer: FnPtrMethodSig = new MethodSig(CLIFile, pSignature, ref pCursor); break; case SigElementType.GenericInstantiation: { GenericInstClass = pSignature[pCursor] == (byte)SigElementType.Class; GenericInstValueType = pSignature[pCursor] == (byte)SigElementType.ValueType; ++pCursor; GenericInstTypeDefOrRefOrSpecToken = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); uint genericInstGenArgCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); GenericInstGenArgs = new List <SigType>((int)genericInstGenArgCount); for (uint genericInstGenArgIndex = 0; genericInstGenArgIndex < genericInstGenArgCount; ++genericInstGenArgIndex) { GenericInstGenArgs.Add(new SigType(CLIFile, pSignature, ref pCursor)); } break; } case SigElementType.MethodVar: MVarNumber = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); break; case SigElementType.Pointer: while (pSignature[pCursor] == (byte)SigElementType.CustomModifier_Required || pSignature[pCursor] == (byte)SigElementType.CustomModifier_Optional) { PtrMods.Add(new SigCustomMod(CLIFile, pSignature, ref pCursor)); } if (pSignature[pCursor] == (byte)SigElementType.Void) { PtrVoid = true; ++pCursor; } else { PtrType = new SigType(CLIFile, pSignature, ref pCursor); } break; case SigElementType.SingleDimensionArray: while (pSignature[pCursor] == (byte)SigElementType.CustomModifier_Required || pSignature[pCursor] == (byte)SigElementType.CustomModifier_Optional) { SZArrayMods.Add(new SigCustomMod(CLIFile, pSignature, ref pCursor)); } SZArrayType = new SigType(CLIFile, pSignature, ref pCursor); break; case SigElementType.ValueType: ValueTypeDefOrRefOrSpecToken = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); break; case SigElementType.Var: VarNumber = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); break; default: break; } }