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


C# Stream.ReadString方法代码示例

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


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

示例1: LoadFrom

 public virtual bool LoadFrom(Stream stream)
 {
     uint count = stream.ReadUInt();
     for (int i = 0; i < count; i++)
     {
         var key = stream.ReadString();
         var val = stream.ReadString();
         KeyValues.Add(key, val);
     }
     return true;
 }
开发者ID:fjz13,项目名称:Medusa,代码行数:11,代码来源:BaseSirenAttribute.cs

示例2: ParseRiff

		private void ParseRiff(Stream Stream)
		{
			if (Stream.ReadString(4) != "WAVE") throw (new InvalidDataException("Not a RIFF.WAVE File"));
			while (!Stream.Eof())
			{
				var ChunkType = Stream.ReadString(4);
				var ChunkSize = new BinaryReader(Stream).ReadUInt32();
				var ChunkStream = Stream.ReadStream(ChunkSize);
				HandleChunkInternal(ChunkType, ChunkStream);
			}
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:11,代码来源:RiffWaveReader.cs

示例3: Check

 /* Check to see if this is a GIM */
 public override bool Check(ref Stream input, string filename)
 {
     try
     {
         return (input.ReadString(0x0, 12, false) == GraphicHeader.MIG ||
             input.ReadString(0x0, 12, false) == GraphicHeader.GIM);
     }
     catch
     {
         return false;
     }
 }
开发者ID:memerdot,项目名称:puyotools,代码行数:13,代码来源:gim.cs

示例4: Check

 /* Checks to see if the input stream is a SNT archive */
 public override bool Check(ref Stream input, string filename)
 {
     try
     {
         return ((input.ReadString(0x0, 4) == ArchiveHeader.NSIF &&
             input.ReadString(0x20, 4) == ArchiveHeader.NSTL) ||
             (input.ReadString(0x0, 4) == ArchiveHeader.NUIF &&
             input.ReadString(0x20, 4) == ArchiveHeader.NUTL));
     }
     catch
     {
         return false;
     }
 }
开发者ID:memerdot,项目名称:puyotools,代码行数:15,代码来源:snt.cs

示例5: ReadBody

 public static ForwardedSubscriptionRequest ReadBody(Stream stream)
 {
     var clientId = stream.ReadInt32();
     var topic = stream.ReadString();
     var isAdd = stream.ReadBoolean();
     return new ForwardedSubscriptionRequest(clientId, topic, isAdd);
 }
开发者ID:rob-blackbourn,项目名称:TopicBus,代码行数:7,代码来源:ForwardedSubscriptionRequest.cs

示例6: GetFileList

        /* Get the offsets, lengths, and filenames of all the files */
        public override ArchiveFileList GetFileList(ref Stream data)
        {
            try
            {
                /* Get the number of files */
                uint files = data.ReadUInt(0x0);

                /* Create the array of files now */
                ArchiveFileList fileList = new ArchiveFileList(files);

                /* Now we can get the file offsets, lengths, and filenames */
                for (uint i = 0; i < files; i++)
                {
                    fileList.Entries[i] = new ArchiveFileList.Entry(
                        data.ReadUInt(0x4 + (i * 0x2C)), // Offset
                        data.ReadUInt(0x8 + (i * 0x2C)), // Length
                        data.ReadString(0xC + (i * 0x2C), 36) // Filename
                    );
                }

                return fileList;
            }
            catch
            {
                return null;
            }
        }
开发者ID:memerdot,项目名称:puyotools,代码行数:28,代码来源:sba.cs

示例7: Deserialize

        public void Deserialize(Stream input)
        {
            var magic = input.ReadValueU32(this.LittleEndian);

            if (magic != 0x54414653)
                throw new NotSupportedException("Bad magic number");

            this.Unknown04 = input.ReadValueU32(this.LittleEndian);
            this.NumberOfFiles = input.ReadValueU32(this.LittleEndian);

            var count = input.ReadValueU32(this.LittleEndian);

            this.Unknown10 = input.ReadValueU32(this.LittleEndian);

            this.BasePath = input.ReadString(32, true, Encoding.ASCII);

            this.Entries.Clear();
            for (uint i = 0; i < count; i++)
            {
                var entry = new Big.EntryV2();
                entry.NameHash = input.ReadValueU32(this.LittleEndian);
                entry.Locale = input.ReadValueU32(this.LittleEndian);
                entry.Size = input.ReadValueU32(this.LittleEndian);
                var offset = input.ReadValueU32(this.LittleEndian);
                entry.Offset = offset & 0xFFFFFF00;
                entry.File = offset & 0xFF;
                this.Entries.Add(entry);
            }
        }
开发者ID:shizacat,项目名称:gibbedtr,代码行数:29,代码来源:BigFileV3.cs

示例8: ReadChunk

        public static BodyChunk ReadChunk(string RawBody, Stream ResponseStream)
        {
            if (RawBody == "0\r\n\r\n")
                return new BodyChunk("", true);

            var bodyIndex = RawBody.IndexOf("\r\n");

            var chunkLength = int.Parse(RawBody.Remove(bodyIndex), System.Globalization.NumberStyles.HexNumber);

            var bodyLength = RawBody.Length - bodyIndex + 2;

            while (bodyLength <= chunkLength)
            {
                var resp = ResponseStream.ReadString(8192 * 4);

                bodyLength += resp.Length;

                RawBody += resp;
            }

            var body = RawBody.Substring(bodyIndex + 2, chunkLength);

            var end = bodyIndex + 2 + chunkLength;

            var tail = RawBody.Substring(end);

            return new BodyChunk(body, tail.Contains("0"));
        }
开发者ID:Prokochalov77,项目名称:php-vulnerability-hunter,代码行数:28,代码来源:BodyChunk.cs

示例9: ReadFrom

        public void ReadFrom(Stream stream)
        {
            int numMaterials = stream.ReadInt32();
            Layers = new MyMaterialLayer[numMaterials];
            for (int i = 0; i < numMaterials; ++i)
            {
                Layers[i] = new MyMaterialLayer();
                Layers[i].StartHeight = stream.ReadFloat();
                Layers[i].EndHeight = stream.ReadFloat();
                Layers[i].StartAngle = stream.ReadFloat();
                Layers[i].EndAngle = stream.ReadFloat();
                Layers[i].HeightStartDeviation = stream.ReadFloat();
                Layers[i].AngleStartDeviation = stream.ReadFloat();
                Layers[i].HeightEndDeviation = stream.ReadFloat();
                Layers[i].AngleEndDeviation = stream.ReadFloat();
                Layers[i].MaterialDefinition = MyDefinitionManager.Static.GetVoxelMaterialDefinition(stream.ReadString());
            }

            int numOreProbabilities = stream.ReadInt32();
            OreProbabilities = new MyOreProbability[numOreProbabilities];
            for (int i = 0; i < numOreProbabilities; ++i)
            {
                OreProbabilities[i] = new MyOreProbability();
                OreProbabilities[i].CummulativeProbability = stream.ReadFloat();
                OreProbabilities[i].OreName = stream.ReadString();
            }

            OreStartDepth = stream.ReadFloat();
            OreEndDepth = stream.ReadFloat();
        }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:30,代码来源:MyCsgShapePlanet.cs

示例10: Read

		public static PlainTextExtension Read(Stream stream)
		{
			var blockSize = stream.ReadByte();
			if (blockSize != BlockSize)
			{
				throw new GifException("Plain text extension data format error");
			}

			var result = new PlainTextExtension
				{
					TextGridLeftPosition = stream.ReadShort(),
					TextGridTopPosition = stream.ReadShort(),
					TextGridWidth = stream.ReadShort(),
					TextGridHeight = stream.ReadShort(),
					CharacterCellWidth = (byte) stream.ReadByte(),
					CharacterCellHeight = (byte) stream.ReadByte(),
					TextForegroundColorIndex = (byte) stream.ReadByte(),
					TextBackgroundColorIndex = (byte) stream.ReadByte(),
					PlainTextData = new List<string>()
				};

			blockSize = stream.ReadByte();
			while (blockSize > 0)
			{
				var plainTextData = stream.ReadString(blockSize);
				result.PlainTextData.Add(plainTextData);

				blockSize = stream.ReadByte();
			}

			return result;
		}
开发者ID:krabishe,项目名称:GIF89a.Transformation,代码行数:32,代码来源:PlainTextExtension.cs

示例11: ParseFile

		private void ParseFile(Stream Stream)
		{
			if (Stream.ReadString(4) != "RIFF") throw (new InvalidDataException("Not a RIFF File"));
			var RiffSize = new BinaryReader(Stream).ReadUInt32();
			var RiffStream = Stream.ReadStream(RiffSize);
			ParseRiff(RiffStream);
		}
开发者ID:shin527,项目名称:cspspemu,代码行数:7,代码来源:RiffWaveReader.cs

示例12: ReadString

 private static string ReadString(Stream input)
 {
     var length = input.ReadValueU32();
     if (length >= 1024)
     {
         throw new InvalidOperationException();
     }
     return input.ReadString(length, true, Encoding.ASCII);
 }
开发者ID:dhk-room101,项目名称:da2_toolset,代码行数:9,代码来源:BMAT.cs

示例13: Check

 /* Checks to see if the input stream is a MRG archive */
 public override bool Check(ref Stream input, string filename)
 {
     try
     {
         return (input.ReadString(0x0, 4) == ArchiveHeader.MRG);
     }
     catch
     {
         return false;
     }
 }
开发者ID:memerdot,项目名称:puyotools,代码行数:12,代码来源:mrg.cs

示例14: Deserialize

		public object Deserialize(Stream stream){
			int count = (int)ZigZag.DeserializeUInt32 (stream);
			var types = new TypeMap ();
			while(count-- != 0) {
				uint tag = ZigZag.DeserializeUInt32 (stream);
				var typeName = stream.ReadString ();
				var type = this.typeNames.GetType (typeName);
				types.Add(tag, typeName, type);
			}	
			return types;
		}
开发者ID:stangelandcl,项目名称:Cls.ObjectSerializer,代码行数:11,代码来源:TypeMapSerializer.cs

示例15: Check

 // Check
 public override bool Check(ref Stream data, string filename)
 {
     try
     {
         return (data.ReadString(0x0, 4) == "LZ01");
     }
     catch
     {
         return false;
     }
 }
开发者ID:memerdot,项目名称:puyotools,代码行数:12,代码来源:lz01.cs


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