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


C# BinaryReader.ReadSByte方法代码示例

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


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

示例1: Button1_Click

        protected void Button1_Click(object sender, EventArgs e)
        {
            //byte[] buffer = new Buffer[512];

            using (FileStream fs = File.Open(@"Z:\20121204.SVD", FileMode.Open, FileAccess.Read))
            {
                using (BinaryReader br = new BinaryReader(fs))
                {
                    FileHead fh = new FileHead();

                    fh.Name = br.ReadSByte().ToChar().ToString() + br.ReadSByte().ToChar().ToString() + br.ReadSByte().ToChar().ToString();
                    fh.Ver = br.ReadSByte().ToString();
                    fh.Size = br.ReadInt16().ToString();

                    byte[] temp = new byte[8];
                    br.Read(temp, 0, 8);

                    //fh.MachineSN = br.ReadSByte().ToString() + br.ReadSByte().ToString() + br.ReadSByte().ToString() + br.ReadSByte().ToString() + br.ReadSByte().ToString() + br.ReadSByte().ToString() + br.ReadSByte().ToString() + br.ReadSByte().ToString();
                    fh.MachineSN = temp.ToHexString();
                    fh.BootVer = br.ReadSByte().ToString() + br.ReadSByte().ToString() + br.ReadSByte().ToString();
                    fh.SoftVer = br.ReadSByte().ToString() + br.ReadSByte().ToString() + br.ReadSByte().ToString();
                    fh.SumRecord = br.ReadInt32().ToString();
                    fh.UploadRecord = br.ReadInt32().ToString();
                    fh.NextUploadFPtr = br.ReadInt32().ToString();

                    Response.Write(fh.ToString());
                }
            }
        }
开发者ID:kainhong,项目名称:CurrencyStore,代码行数:29,代码来源:UploadTest.aspx.cs

示例2: readSector

		public static FacetSector readSector(BinaryReader r) {
			FacetSector fs = new FacetSector();
			fs.facetID = r.ReadByte();
			fs.sectorID = r.ReadUInt16();

			for (int x = 0; x < 64; ++x) {
				fs.tiles[x] = new facetTile_t[64];
				for (int y = 0; y < 64; ++y) {
					fs.tiles[x][y].z = r.ReadSByte();
					fs.tiles[x][y].landtileGraphic = r.ReadUInt16();
					fs.tiles[x][y].delimitersCount = r.ReadByte();
					if (fs.tiles[x][y].delimitersCount > 0) {
						fs.tiles[x][y].delimiters = new facetDelimiter_t[fs.tiles[x][y].delimitersCount];
						for (int i = 0; i < fs.tiles[x][y].delimitersCount; ++i) {
							fs.tiles[x][y].delimiters[i].direction = r.ReadByte();
							if (fs.tiles[x][y].delimiters[i].direction < 8) {
								fs.tiles[x][y].delimiters[i].z = r.ReadSByte();
								fs.tiles[x][y].delimiters[i].graphic = r.ReadUInt32();
							}
						}
					}
					fs.tiles[x][y].staticsCount = r.ReadByte();
					if (fs.tiles[x][y].staticsCount > 0) {
						fs.tiles[x][y].statics = new facetStatic_t[fs.tiles[x][y].staticsCount];
						for (int i = 0; i < fs.tiles[x][y].staticsCount; ++i) {
							fs.tiles[x][y].statics[i].graphic = r.ReadUInt32();
							fs.tiles[x][y].statics[i].z = r.ReadSByte();
							fs.tiles[x][y].statics[i].color = r.ReadUInt32();
						}
					}
				}
			}

			return fs;
		}
开发者ID:Utilitron,项目名称:kprojects,代码行数:35,代码来源:FacetSector.cs

示例3: InstrumentChunk

 //--Methods
 public InstrumentChunk(string id, int size, BinaryReader reader)
     : base(id, size)
 {
     instNote = reader.ReadByte();
     instFineTune = reader.ReadSByte();
     instGain = reader.ReadSByte();
     instLowNote = reader.ReadByte();
     instHighNote = reader.ReadByte();
     instLowVelocity = reader.ReadByte();
     instHighVelocity = reader.ReadByte();
     reader.ReadByte(); //always read pad
 }
开发者ID:eriser,项目名称:Cross-Platform-Csharp-Synth-with-OpenAL,代码行数:13,代码来源:InstrumentChunk.cs

示例4: Metric

	public Metric(BinaryReader br)
	{
		advance = br.ReadSingle();
		u = br.ReadInt16();
		v = br.ReadInt16();
		bearingX = br.ReadSByte();
		bearingY = br.ReadSByte();
		width = br.ReadByte();
		height = br.ReadByte();
		first = br.ReadByte();
		second = br.ReadByte();
		prevNum = br.ReadByte();
		nextNum = br.ReadByte();
	}
开发者ID:pravusjif,项目名称:PravusUnityTests,代码行数:14,代码来源:bitmapfont_loader.cs

示例5: ClientData

 private void ClientData(BinaryReader source)
 {
     var mask = source.ReadUInt16();
     var view_ofs_z = (0!=(mask & 0x0001))?source.ReadSByte():22;
     var ang_ofs_1 = (0 != (mask & 0x0002)) ? (float)source.ReadSByte() : 0.0;
     var angles_0 = (0 != (mask & 0x0004)) ? source.ReadSByte() : 0;
     var vel_0 = (0 != (mask & 0x0020)) ? (source.ReadSByte()) : 0;
     var angles_1 = (0 != (mask & 0x0008)) ? (source.ReadSByte()) : 0;
     var vel_1 = (0 != (mask & 0x0040)) ? source.ReadSByte() : 0;
     var angles_2 = (0 != (mask & 0x0010)) ? source.ReadSByte() : 0;
     var vel_2 = (0 != (mask & 0x0080)) ? source.ReadSByte() : 0;
     var items = (0 != (mask & 0x0200)) ? source.ReadInt32() : 0x4001;
     var uk_bit_b10 = (0 != (mask & 0x0400)) ? 1 : 0; // bit 10
     var uk_bit_b11 = (0 != (mask & 0x0800)) ? 1 : 0; // bit 11
     var weaponframe = (0 != (mask & 0x1000)) ? source.ReadByte() : 0;
     var armorvalue = (0 != (mask & 0x2000)) ? source.ReadByte() : 0;
     var weaponmodel = (0 != (mask & 0x4000)) ? source.ReadByte() : 0;
     var health = source.ReadInt16();
     var currentammo = source.ReadByte();
     var ammo_shells = source.ReadByte();
     var ammo_nails = source.ReadByte();
     var ammo_rockets = source.ReadByte();
     var ammo_cells = source.ReadByte();
     var weapon = source.ReadByte();
 }
开发者ID:marmalade,项目名称:bsp4Airplay,代码行数:25,代码来源:Quake1DemoReader.cs

示例6: DeserializeToString

 public static string DeserializeToString(byte[] data)
 {
     MemoryStream stream = new MemoryStream(data);
     BinaryReader reader = new BinaryReader(stream);
     reader.ReadSByte();      //取出第一个null字符
     StringBuilder builder = new StringBuilder();
     int count = reader.ReadInt32();
     for (int i = 0; i < count; ++i)
     {
         sbyte flag = reader.ReadSByte();
         if (flag == LineFlag)
         {
             int line = reader.ReadInt32();
             flag = reader.ReadSByte();
             int sourceLine = builder.ToString().Split('\n').Length;
             for (int j = sourceLine; j < line; ++j)
                 builder.Append('\n');
         }
         TokenType type = (TokenType)flag;
         object value = null;
         switch (type)
         {
             case TokenType.Boolean:
                 value = (reader.ReadSByte() == 1);
                 break;
             case TokenType.String:
                 value = "\"" + Util.ReadString(reader).Replace("\n", "\\n") + "\"";
                 break;
             case TokenType.SimpleString:
                 value = "@\"" + Util.ReadString(reader) + "\"";
                 break;
             case TokenType.Identifier:
                 value = Util.ReadString(reader);
                 break;
             case TokenType.Number:
                 if (reader.ReadSByte() == 1)
                     value = reader.ReadDouble();
                 else
                     value = reader.ReadInt64() + "L";
                 break;
             default:
                 value = GetTokenString(type);
                 break;
         }
         builder.Append(value + " ");
     }
     return builder.ToString();
 }
开发者ID:Githubxplabs,项目名称:Scorpio-CSharp,代码行数:48,代码来源:ScorpioMaker.cs

示例7: Read

			public void Read(BinaryReader reader, MDStream stream)
			{	
				offs = reader.ReadUInt32 ();
				size = reader.ReadUInt32 ();

				StringBuilder name_builder = new StringBuilder ();
				while (true) {
					sbyte c = reader.ReadSByte();
					if (c == 0) 
						break;
					name_builder.Append ((char) c);
				}

				name = name_builder.ToString ();
				if (name.Length == 0)
					throw new BadImageException("Invalid stream name.");

				// Round up to dword boundary.
				long pos = reader.BaseStream.Position;
				if (stream != null) 
					pos -= stream.Root.filePos;
				pos += 3;
				pos &= ~3;
				if (stream != null) 
					pos += stream.Root.filePos;
				
				// Advance file pointer.
				reader.BaseStream.Position = pos;
			}
开发者ID:emtees,项目名称:old-code,代码行数:29,代码来源:MDStream.cs

示例8: Read

        public static HighEnumLiteral Read(CatalogReader catalog, BinaryReader reader, uint literalSize, bool isSigned)
        {
            string name = catalog.GetString(reader.ReadUInt32());

            long value;
            switch (literalSize)
            {
                case 8:
                    value = reader.ReadInt64();
                    break;
                case 4:
                    if (isSigned)
                        value = reader.ReadInt32();
                    else
                        value = reader.ReadUInt32();
                    break;
                case 2:
                    if (isSigned)
                        value = reader.ReadInt16();
                    else
                        value = reader.ReadUInt16();
                    break;
                case 1:
                    if (isSigned)
                        value = reader.ReadSByte();
                    else
                        value = reader.ReadByte();
                    break;
                default:
                    throw new ArgumentException();
            }

            return new HighEnumLiteral(name, value);
        }
开发者ID:elasota,项目名称:clarity,代码行数:34,代码来源:HighEnumLiteral.cs

示例9: Read

 public override object Read(BinaryReader buffer, Type resultType, TypeDescription typeDescriptor, byte code, BinaryJSONReader binaryJsonReader)
 {
     switch (code)
     {
         case BinaryValue.BYTE:
             return Convert.ChangeType(buffer.ReadByte(), resultType);
         case BinaryValue.SBYTE:
             return Convert.ChangeType(buffer.ReadSByte(), resultType);
         case BinaryValue.INT16:
             return Convert.ChangeType(buffer.ReadInt16(), resultType);
         case BinaryValue.UINT16:
             return Convert.ChangeType(buffer.ReadUInt16(), resultType);
         case BinaryValue.INT32:
             return Convert.ChangeType(buffer.ReadInt32(), resultType);
         case BinaryValue.UINT32:
             return Convert.ChangeType(buffer.ReadUInt32(), resultType);
         case BinaryValue.INT64:
             return Convert.ChangeType(buffer.ReadInt64(), resultType);
         case BinaryValue.UINT64:
             return Convert.ChangeType(buffer.ReadUInt64(), resultType);
         case BinaryValue.FLOAT:
             return Convert.ChangeType(buffer.ReadSingle(), resultType);
         case BinaryValue.BOOLEAN:
             return Convert.ChangeType(buffer.ReadBoolean(), resultType);
         case BinaryValue.DOUBLE:
             return Convert.ChangeType(buffer.ReadDouble(), resultType);
         case BinaryValue.DECIMAL:
             return Convert.ChangeType(buffer.ReadDecimal(), resultType);
         case BinaryValue.CHAR:
             return Convert.ChangeType(buffer.ReadChar(), resultType);
     }
     return null;
 }
开发者ID:dorofiykolya,项目名称:csharp-bjson,代码行数:33,代码来源:PrimitiveSerialization.cs

示例10: Deserialize

 public override void Deserialize(BinaryReader reader)
 {
     base.Deserialize(reader);
     Interaction = reader.ReadUInt16();
     x = reader.ReadInt16();
     y = reader.ReadInt16();
     level = reader.ReadSByte();
 }
开发者ID:RHY3756547,项目名称:FreeSO,代码行数:8,代码来源:VMNetGotoCmd.cs

示例11: DecodePackedFile

 public static void DecodePackedFile(BinaryReader reader)
 {
     reader.ReadSByte();
     List<string> dictionary = PS.readDictionary(reader);
     XmlNode xmlroot = xDoc.CreateNode(XmlNodeType.Element, FileName, "");
     PS.readElement(reader, xmlroot, xDoc, dictionary);
     xDoc.AppendChild(xmlroot);
 }
开发者ID:kblw,项目名称:wottools-console,代码行数:8,代码来源:Program.cs

示例12: Deserialize

 public override void Deserialize(BinaryReader reader)
 {
     Interaction = reader.ReadUInt16();
     CallerID = reader.ReadInt16();
     x = reader.ReadInt16();
     y = reader.ReadInt16();
     level = reader.ReadSByte();
 }
开发者ID:Daribon,项目名称:FreeSO,代码行数:8,代码来源:VMNetGotoCmd.cs

示例13: Deserialize

 public override void Deserialize(BinaryReader reader)
 {
     GUID = reader.ReadUInt32();
     x = reader.ReadInt16();
     y = reader.ReadInt16();
     level = reader.ReadSByte();
     dir = (Direction)reader.ReadByte();
 }
开发者ID:Daribon,项目名称:FreeSO,代码行数:8,代码来源:VMNetBuyObjectCmd.cs

示例14: readBase64

 public string readBase64(BinaryReader reader, int lengthInBytes)
 {
     sbyte[] bytes = new sbyte[lengthInBytes];
     for (int i = 0; i < lengthInBytes; i++)
     {
         bytes[i] = reader.ReadSByte();
     }
     return byteArrayToBase64(bytes);
 }
开发者ID:Kuitsi,项目名称:WotMiniMapMaker,代码行数:9,代码来源:Packed_Section.cs

示例15: ReadUInt16FromSbytes

 public static uint ReadUInt16FromSbytes(BinaryReader br)
 {
     sbyte[] b = new sbyte[2];
     for (int i = 0; i < 2; i++)
     {
         b[i] = br.ReadSByte();
     }
     return (ushort)(((b[0] & 0xff) << 8) | (b[1] & 0xff));
 }
开发者ID:WangMoYing,项目名称:MobileCoverage_proj,代码行数:9,代码来源:JavaBinaryToCS.cs


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