Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
 internal IRAssembly(IRAppDomain pAppDomain, CLIFile pCLIFile, bool pCORLibrary)
 {
     AppDomain = pAppDomain;
     File = pCLIFile;
     CORLibrary = pCORLibrary;
 }