當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。