Ejemplo n.º 1
0
		public SigRetType(CLIFile pCLIFile, byte[] pSignature, ref int pCursor)
		{
			CLIFile = pCLIFile;

			while (pSignature[pCursor] == (byte)SigElementType.CustomModifier_Required ||
				   pSignature[pCursor] == (byte)SigElementType.CustomModifier_Optional)
			{
				Mods.Add(new SigCustomMod(CLIFile, pSignature, ref pCursor));
			}
			if (pSignature[pCursor] == (byte)SigElementType.TypedByReference)
			{
				TypedByRef = true;
				++pCursor;
				return;
			}
			if (pSignature[pCursor] == (byte)SigElementType.Void)
			{
				Void = true;
				++pCursor;
				return;
			}
			if (pSignature[pCursor] == (byte)SigElementType.ByReference)
			{
				ByRef = true;
				++pCursor;
			}
			Type = new SigType(CLIFile, pSignature, ref pCursor);
		}
Ejemplo n.º 2
0
		public SigLocalVar(CLIFile pCLIFile, byte[] pSignature, ref int pCursor)
		{
			CLIFile = pCLIFile;

			if (pSignature[pCursor] == (byte)SigElementType.TypedByReference)
			{
				TypedByRef = true;
				++pCursor;
			}
			else
			{
				while (pSignature[pCursor] == (byte)SigElementType.CustomModifier_Required ||
					   pSignature[pCursor] == (byte)SigElementType.CustomModifier_Optional)
				{
					Mods.Add(new SigCustomMod(CLIFile, pSignature, ref pCursor));
				}
				if (pSignature[pCursor] == (byte)SigElementType.Pinned)
				{
					IsPinned = true;
					++pCursor;
				}
				if (pSignature[pCursor] == (byte)SigElementType.ByReference)
				{
					ByRef = true;
					++pCursor;
				}
				Type = new SigType(CLIFile, pSignature, ref pCursor);
			}
		}
Ejemplo n.º 3
0
		public FieldSig(CLIFile pCLIFile, byte[] pSignature, ref int pCursor)
		{
			CLIFile = pCLIFile;
			++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);
		}
Ejemplo n.º 4
0
		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));
		}
Ejemplo n.º 5
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.º 6
0
		private void LinkData(CLIFile pFile)
		{
			int cursor = 0;
			ExpandedSignature = new SigType(pFile, Signature, ref cursor);
		}