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


C# Stream.ReadASCII方法代码示例

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


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

示例1: VxlReader

        public VxlReader(Stream s)
        {
            if (!s.ReadASCII(16).StartsWith("Voxel Animation"))
                throw new InvalidDataException("Invalid vxl header");

            s.ReadUInt32();
            LimbCount = s.ReadUInt32();
            s.ReadUInt32();
            BodySize = s.ReadUInt32();
            s.Seek(770, SeekOrigin.Current);

            // Read Limb headers
            Limbs = new VxlLimb[LimbCount];
            for (var i = 0; i < LimbCount; i++)
            {
                Limbs[i] = new VxlLimb();
                Limbs[i].Name = s.ReadASCII(16);
                s.Seek(12, SeekOrigin.Current);
            }

            // Skip to the Limb footers
            s.Seek(802 + 28*LimbCount + BodySize, SeekOrigin.Begin);

            var LimbDataOffset = new uint[LimbCount];
            for (var i = 0; i < LimbCount; i++)
            {
                LimbDataOffset[i] = s.ReadUInt32();
                s.Seek(8, SeekOrigin.Current);
                Limbs[i].Scale = s.ReadFloat();
                s.Seek(48, SeekOrigin.Current);

                Limbs[i].Bounds = new float[6];
                for (var j = 0; j < 6; j++)
                    Limbs[i].Bounds[j] = s.ReadFloat();
                Limbs[i].Size = s.ReadBytes(3);
                Limbs[i].Type = (NormalType)s.ReadByte();
            }

            for (var i = 0; i < LimbCount; i++)
            {
                s.Seek(802 + 28*LimbCount + LimbDataOffset[i], SeekOrigin.Begin);
                ReadVoxelData(s, Limbs[i]);
            }
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:44,代码来源:VxlReader.cs

示例2: IdxEntry

        public IdxEntry(Stream s)
        {
            var name = s.ReadASCII(16);
            var pos = name.IndexOf('\0');
            if (pos != 0)
                name = name.Substring(0, pos);

            Filename = string.Concat(name, ".wav");
            Offset = s.ReadUInt32();
            Length = s.ReadUInt32();
            SampleRate = s.ReadUInt32();
            Flags = s.ReadUInt32();
            ChunkSize = s.ReadUInt32();
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:14,代码来源:IdxEntry.cs

示例3: IdxEntry

		public IdxEntry(Stream s)
		{
			var asciiname = s.ReadASCII(16);

			var pos = asciiname.IndexOf('\0');
			if (pos != 0)
				asciiname = asciiname.Substring(0, pos);

			Name = asciiname;
			Extension = DefaultExtension;
			Offset = s.ReadUInt32();
			Length = s.ReadUInt32();
			SampleRate = s.ReadUInt32();
			Flags = s.ReadUInt32();
			ChunkSize = s.ReadUInt32();
			Hash = HashFilename(string.Concat(Name, ".", Extension), PackageHashType.CRC32);
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:17,代码来源:IdxEntry.cs

示例4: IdxReader

        public IdxReader(Stream s)
        {
            s.Seek(0, SeekOrigin.Begin);

            var id = s.ReadASCII(4);

            if (id != "GABA")
                throw new InvalidDataException("Unable to load Idx file, did not find magic id, found {0} instead".F(id));

            var two = s.ReadInt32();

            if (two != 2)
                throw new InvalidDataException("Unable to load Idx file, did not find magic number 2, found {0} instead".F(two));

            SoundCount = s.ReadInt32();

            Entries = new List<IdxEntry>();

            for (var i = 0; i < SoundCount; i++)
                Entries.Add(new IdxEntry(s));
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:21,代码来源:IdxReader.cs

示例5: IsIcnD2

        bool IsIcnD2(Stream s)
        {
            if (s.Length < 0x20)
                return false;

            var start = s.Position;

            s.Position = 0x18;
            if (s.ReadASCII(4) != "SSET")
            {
                s.Position = start;
                return false;
            }

            ssetLength = int2.Swap(s.ReadUInt32()) - 8;
            s.Position += 3;
            ssetOffset = 0x18 + 16;
            if (s.Length < ssetOffset + ssetLength)
            {
                s.Position = start;
                return false;
            }

            s.Position = ssetOffset + ssetLength;
            if (s.ReadASCII(4) != "RPAL")
            {
                s.Position = start;
                return false;
            }

            rpalLength = int2.Swap(s.ReadUInt32());
            rpalOffset = ssetOffset + ssetLength + 8;
            if (s.Length < rpalOffset + rpalLength)
            {
                s.Position = start;
                return false;
            }

            s.Position = rpalOffset + rpalLength;
            if (s.ReadASCII(4) != "RTBL")
            {
                s.Position = start;
                return false;
            }

            rtblLength = int2.Swap(s.ReadUInt32());
            rtblOffset = rpalOffset + rpalLength + 8;

            if (s.Length < rtblOffset + rtblLength)
            {
                s.Position = start;
                return false;
            }

            numTiles = ssetLength / TileSize;

            if (rtblLength < numTiles)
            {
                s.Position = start;
                return false;
            }

            s.Position = start;
            return true;
        }
开发者ID:Comanche93,项目名称:d2,代码行数:65,代码来源:IcnD2Loader.cs


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