当前位置: 首页>>代码示例>>C#>>正文


C# ByteReader.ReadUInt16方法代码示例

本文整理汇总了C#中IKVM.Reflection.Reader.ByteReader.ReadUInt16方法的典型用法代码示例。如果您正苦于以下问题:C# ByteReader.ReadUInt16方法的具体用法?C# ByteReader.ReadUInt16怎么用?C# ByteReader.ReadUInt16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IKVM.Reflection.Reader.ByteReader的用法示例。


在下文中一共展示了ByteReader.ReadUInt16方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CustomAttributeData

		internal CustomAttributeData(Assembly asm, ConstructorInfo constructor, ByteReader br)
		{
			this.lazyConstructor = constructor;
			if (br.Length == 0)
			{
				// it's legal to have an empty blob
				lazyConstructorArguments = Empty<CustomAttributeTypedArgument>.Array;
				lazyNamedArguments = Empty<CustomAttributeNamedArgument>.Array;
			}
			else
			{
				if (br.ReadUInt16() != 1)
				{
					throw new BadImageFormatException();
				}
				lazyConstructorArguments = ReadConstructorArguments(asm, br, constructor);
				lazyNamedArguments = ReadNamedArguments(asm, br, br.ReadUInt16(), constructor.DeclaringType);
			}
		}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例2: ReadFixedArg

 void ReadFixedArg(StringBuilder sb, ByteReader br, Type type, bool arrayElement = false)
 {
     if (type.IsArray)
     {
         int length = br.ReadInt32();
         if (length == -1 && compat == CompatLevel.None)
         {
             sb.Append("nullref");
         }
         else if (length == 0 && compat != CompatLevel.None)
         {
             throw new IKVM.Reflection.BadImageFormatException();
         }
         else
         {
             Type elementType = type.GetElementType();
             AppendCATypeName(sb, elementType, null);
             sb.AppendFormat("[{0}](", length);
             for (int i = 0; i < length; i++)
             {
                 if (i != 0)
                 {
                     sb.Append(' ');
                 }
                 if (elementType == typeofSystemObject)
                 {
                     string typeName;
                     ReadFixedArg(sb, br, ReadFieldOrPropType(sb, br, out typeName), false);
                 }
                 else
                 {
                     ReadFixedArg(sb, br, elementType, true);
                 }
             }
             sb.Append(')');
         }
     }
     else if (type.FullName == "System.Type" && type.Assembly.GetName().Name == "mscorlib")
     {
         if (!arrayElement)
         {
             AppendCATypeName(sb, type, null);
             sb.Append('(');
         }
         string typeName;
         var type1 = ReadType(br, out typeName);
         if (type1 == null)
         {
             if (typeName == null)
             {
                 sb.Append("nullref");
             }
             else
             {
                 sb.Append("class ").Append(QuoteIdentifier(typeName, true));
             }
         }
         else
         {
             AppendTypeName(sb, type1, typeName, compat != CompatLevel.None && IsNestedTypeWithNamespace(type1));
         }
         if (!arrayElement)
         {
             sb.Append(')');
         }
     }
     else if (type.Assembly == mscorlib)
     {
         if (!arrayElement)
         {
             AppendCATypeName(sb, type, null);
             sb.Append('(');
         }
         if (type == typeofSystemBoolean)
         {
             sb.Append(br.ReadByte() == 0 ? "false" : "true");
         }
         else if (type == typeofSystemByte)
         {
             sb.Append(br.ReadByte());
         }
         else if (type == typeofSystemSByte)
         {
             sb.Append(br.ReadSByte());
         }
         else if (type == typeofSystemChar)
         {
             sb.AppendFormat("0x{0:X4}", (int)br.ReadChar());
         }
         else if (type == typeofSystemInt16)
         {
             sb.Append(br.ReadInt16());
         }
         else if (type == typeofSystemUInt16)
         {
             sb.Append(br.ReadUInt16());
         }
         else if (type == typeofSystemInt32)
         {
             sb.Append(br.ReadInt32());
//.........这里部分代码省略.........
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:101,代码来源:CABlob.cs

示例3: DecodeCABlob

 bool DecodeCABlob(StringBuilder sb, ConstructorInfo constructor, byte[] blob, int level)
 {
     try
     {
         // CustomAttribute
         var br = new ByteReader(blob, 2, blob.Length - 4);
         ReadConstructorArguments(sb, br, constructor, level);
         br = new ByteReader(blob, blob.Length - (br.Length + 2), br.Length + 2);
         int named = br.ReadUInt16();
         if (constructor.GetParameters().Length != 0 && named != 0)
         {
             AppendNewLine(sb, level);
         }
         ReadNamedArguments(sb, br, named, level, false);
         return true;
     }
     catch (IKVM.Reflection.BadImageFormatException) { }
     catch (ArgumentOutOfRangeException) { }
     return false;
 }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:20,代码来源:CABlob.cs

示例4: ReadOrdinalOrName

		private static OrdinalOrName ReadOrdinalOrName(ByteReader br)
		{
			char c = br.ReadChar();
			if (c == 0xFFFF)
			{
				return new OrdinalOrName(br.ReadUInt16());
			}
			else
			{
				StringBuilder sb = new StringBuilder();
				while (c != 0)
				{
					sb.Append(c);
					c = br.ReadChar();
				}
				return new OrdinalOrName(sb.ToString());
			}
		}
开发者ID:koush,项目名称:mono,代码行数:18,代码来源:ResourceSection.cs

示例5: RESOURCEHEADER

		internal RESOURCEHEADER(ByteReader br)
		{
			DataSize = br.ReadInt32();
			HeaderSize = br.ReadInt32();
			TYPE = ReadOrdinalOrName(br);
			NAME = ReadOrdinalOrName(br);
			br.Align(4);
			DataVersion = br.ReadInt32();
			MemoryFlags = br.ReadUInt16();
			LanguageId = br.ReadUInt16();
			Version = br.ReadInt32();
			Characteristics = br.ReadInt32();
		}
开发者ID:koush,项目名称:mono,代码行数:13,代码来源:ResourceSection.cs

示例6: ReadFixedArg

		private static CustomAttributeTypedArgument ReadFixedArg(Module context, ByteReader br, Type type)
		{
			Universe u = context.universe;
			if (type == u.System_String)
			{
				return new CustomAttributeTypedArgument(type, br.ReadString());
			}
			else if (type == u.System_Boolean)
			{
				return new CustomAttributeTypedArgument(type, br.ReadByte() != 0);
			}
			else if (type == u.System_Char)
			{
				return new CustomAttributeTypedArgument(type, br.ReadChar());
			}
			else if (type == u.System_Single)
			{
				return new CustomAttributeTypedArgument(type, br.ReadSingle());
			}
			else if (type == u.System_Double)
			{
				return new CustomAttributeTypedArgument(type, br.ReadDouble());
			}
			else if (type == u.System_SByte)
			{
				return new CustomAttributeTypedArgument(type, br.ReadSByte());
			}
			else if (type == u.System_Int16)
			{
				return new CustomAttributeTypedArgument(type, br.ReadInt16());
			}
			else if (type == u.System_Int32)
			{
				return new CustomAttributeTypedArgument(type, br.ReadInt32());
			}
			else if (type == u.System_Int64)
			{
				return new CustomAttributeTypedArgument(type, br.ReadInt64());
			}
			else if (type == u.System_Byte)
			{
				return new CustomAttributeTypedArgument(type, br.ReadByte());
			}
			else if (type == u.System_UInt16)
			{
				return new CustomAttributeTypedArgument(type, br.ReadUInt16());
			}
			else if (type == u.System_UInt32)
			{
				return new CustomAttributeTypedArgument(type, br.ReadUInt32());
			}
			else if (type == u.System_UInt64)
			{
				return new CustomAttributeTypedArgument(type, br.ReadUInt64());
			}
			else if (type == u.System_Type)
			{
				return new CustomAttributeTypedArgument(type, ReadType(context, br));
			}
			else if (type == u.System_Object)
			{
				return ReadFixedArg(context, br, ReadFieldOrPropType(context, br));
			}
			else if (type.IsArray)
			{
				int length = br.ReadInt32();
				if (length == -1)
				{
					return new CustomAttributeTypedArgument(type, null);
				}
				Type elementType = type.GetElementType();
				CustomAttributeTypedArgument[] array = new CustomAttributeTypedArgument[length];
				for (int i = 0; i < length; i++)
				{
					array[i] = ReadFixedArg(context, br, elementType);
				}
				return new CustomAttributeTypedArgument(type, array);
			}
			else if (type.IsEnum)
			{
				return new CustomAttributeTypedArgument(type, ReadFixedArg(context, br, type.GetEnumUnderlyingTypeImpl()).Value);
			}
			else
			{
				throw new InvalidOperationException();
			}
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:87,代码来源:CustomAttributeData.cs

示例7: ReadFixedArg

		private static CustomAttributeTypedArgument ReadFixedArg(Assembly asm, ByteReader br, Type type)
		{
			Universe u = asm.universe;
			if (type == u.System_String)
			{
				return new CustomAttributeTypedArgument(type, br.ReadString());
			}
			else if (type == u.System_Type)
			{
				return new CustomAttributeTypedArgument(type, ReadType(asm, br));
			}
			else if (type == u.System_Object)
			{
				return ReadFixedArg(asm, br, ReadFieldOrPropType(asm, br));
			}
			else if (type.IsArray)
			{
				int length = br.ReadInt32();
				if (length == -1)
				{
					return new CustomAttributeTypedArgument(type, null);
				}
				Type elementType = type.GetElementType();
				CustomAttributeTypedArgument[] array = new CustomAttributeTypedArgument[length];
				for (int i = 0; i < length; i++)
				{
					array[i] = ReadFixedArg(asm, br, elementType);
				}
				return new CustomAttributeTypedArgument(type, array);
			}
			else if (type.IsEnum)
			{
				return new CustomAttributeTypedArgument(type, ReadFixedArg(asm, br, type.GetEnumUnderlyingTypeImpl()).Value);
			}
			else
			{
				switch (Type.GetTypeCode(type))
				{
					case TypeCode.Boolean:
						return new CustomAttributeTypedArgument(type, br.ReadByte() != 0);
					case TypeCode.Char:
						return new CustomAttributeTypedArgument(type, br.ReadChar());
					case TypeCode.Single:
						return new CustomAttributeTypedArgument(type, br.ReadSingle());
					case TypeCode.Double:
						return new CustomAttributeTypedArgument(type, br.ReadDouble());
					case TypeCode.SByte:
						return new CustomAttributeTypedArgument(type, br.ReadSByte());
					case TypeCode.Int16:
						return new CustomAttributeTypedArgument(type, br.ReadInt16());
					case TypeCode.Int32:
						return new CustomAttributeTypedArgument(type, br.ReadInt32());
					case TypeCode.Int64:
						return new CustomAttributeTypedArgument(type, br.ReadInt64());
					case TypeCode.Byte:
						return new CustomAttributeTypedArgument(type, br.ReadByte());
					case TypeCode.UInt16:
						return new CustomAttributeTypedArgument(type, br.ReadUInt16());
					case TypeCode.UInt32:
						return new CustomAttributeTypedArgument(type, br.ReadUInt32());
					case TypeCode.UInt64:
						return new CustomAttributeTypedArgument(type, br.ReadUInt64());
					default:
						throw new InvalidOperationException();
				}
			}
		}
开发者ID:,项目名称:,代码行数:67,代码来源:


注:本文中的IKVM.Reflection.Reader.ByteReader.ReadUInt16方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。