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


C# BinaryReader.ReadFourCC方法代码示例

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


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

示例1: Ubershader

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="rs"></param>
		/// <param name="path"></param>
		/// <param name="combinerEnum"></param>
		public Ubershader ( GraphicsDevice device, Stream stream ) : base(device)
		{
			database.Clear();

			using ( var br = new BinaryReader( stream ) ) {

				var foucCC = br.ReadFourCC();

				if (foucCC!=UbershaderSignature) {
					throw new IOException("Bad ubershader signature");
				}


				var count = br.ReadInt32();

				for (int i=0; i<count; i++) {
					var defines		=	br.ReadString();
					int length;

					br.ExpectFourCC("PSBC", "ubershader");
					length	=	br.ReadInt32();
					var ps	=	br.ReadBytes( length );

					br.ExpectFourCC("VSBC", "ubershader");
					length	=	br.ReadInt32();
					var vs	=	br.ReadBytes( length );

					br.ExpectFourCC("GSBC", "ubershader");
					length	=	br.ReadInt32();
					var gs	=	br.ReadBytes( length );

					br.ExpectFourCC("HSBC", "ubershader");
					length	=	br.ReadInt32();
					var hs	=	br.ReadBytes( length );

					br.ExpectFourCC("DSBC", "ubershader");
					length	=	br.ReadInt32();
					var ds	=	br.ReadBytes( length );

					br.ExpectFourCC("CSBC", "ubershader");
					length	=	br.ReadInt32();
					var cs	=	br.ReadBytes( length );

					//Log.Message("{0}", profile );
					//PrintSignature( bytecode, "ISGN" );
					//PrintSignature( bytecode, "OSGN" );
					//PrintSignature( bytecode, "OSG5" );
					if (database.ContainsKey(defines)) {
						Log.Warning("Duplicate definitions: {0}", defines );
						continue;
					}

					database.Add( defines, new UsdbEntry( defines, ps, vs, gs, hs, ds, cs ) );
				}
			}

			Log.Debug("Ubershader: {0} shaders", database.Count );
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:64,代码来源:UberShader.cs

示例2: Read

        protected override void Read(BinaryReader reader)
        {
            Magic = reader.ReadFourCC();
            Version = reader.ReadInt32();
            PermutationCount = reader.ReadInt32();

            for (var i = 0; i < PermutationCount; i++)
                Chunks.Add(new BLSChunk(reader));
        }
开发者ID:madbroths,项目名称:Encore,代码行数:9,代码来源:BLSReader.cs

示例3: Read

        protected override void Read(BinaryReader reader)
        {
            Magic = reader.ReadFourCC();
            Load = reader.ReadInt32();
            LastModified = reader.ReadInt32();
            Build = reader.ReadInt32();

            while (!reader.BaseStream.IsRead())
                Records.Add(new TBLRecord(reader));
        }
开发者ID:chosenmangos,项目名称:Encore,代码行数:10,代码来源:TBLReader.cs

示例4: Read

        protected override void Read(BinaryReader reader)
        {
            Magic = reader.ReadFourCC(); // TODO: Magic check.
            Load = reader.ReadInt32(); // TODO: What's this do?
            LastModified = reader.ReadInt32();
            Build = reader.ReadInt32();

            if (Build < 0)
                throw new InvalidDataException("Negative build was encountered.");

            while (!reader.BaseStream.IsRead())
                Records.Add(new TBLRecord(reader));
        }
开发者ID:hanson-huang,项目名称:Encore,代码行数:13,代码来源:TBLReader.cs

示例5: Read

        protected override void Read(BinaryReader reader)
        {
            Magic = reader.ReadFourCC(); // TODO: Magic check.
            Version = reader.ReadInt32();

            if (Version < 0)
                throw new InvalidDataException("Negative version encountered.");

            PermutationCount = reader.ReadInt32();

            if (PermutationCount < 0)
                throw new InvalidDataException("Negative permutation count encountered.");

            for (var i = 0; i < PermutationCount; i++)
                Chunks.Add(new BLSChunk(reader));
        }
开发者ID:hanson-huang,项目名称:Encore,代码行数:16,代码来源:BLSReader.cs

示例6: XFRMChunk

            public XFRMChunk(BinaryReader reader)
            {
                Contract.Requires(reader != null);

                Magic = reader.ReadFourCC(); // TODO: Magic check.
                BlockSize = reader.ReadInt32();

                if (BlockSize < 0)
                    throw new InvalidDataException("Negative block size encountered.");

                Type = reader.ReadFourCC();
            }
开发者ID:hanson-huang,项目名称:Encore,代码行数:12,代码来源:PTCHReader.cs

示例7: MD5Chunk

            public const int HashLength = 16; // Size of MD5 digest. No framework constant...

            public MD5Chunk(BinaryReader reader)
            {
                Contract.Requires(reader != null);

                Magic = reader.ReadFourCC(); // TODO: Magic check.
                BlockSize = reader.ReadInt32();

                if (BlockSize < 0)
                    throw new InvalidDataException("Negative block size encountered.");

                OldHash = reader.ReadBytes(HashLength);
                NewHash = reader.ReadBytes(HashLength);
            }
开发者ID:hanson-huang,项目名称:Encore,代码行数:15,代码来源:PTCHReader.cs

示例8: PTCHChunk

            public PTCHChunk(BinaryReader reader)
            {
                Contract.Requires(reader != null);

                Magic = reader.ReadFourCC(); // TODO: Magic check.
                PatchSize = reader.ReadInt32();

                if (PatchSize < 0)
                    throw new InvalidDataException("Negative patch size encountered.");

                OldSize = reader.ReadInt32();

                if (OldSize < 0)
                    throw new InvalidDataException("Negative old size encountered.");

                NewSize = reader.ReadInt32();

                if (NewSize < 0)
                    throw new InvalidDataException("Negative new size encountered.");
            }
开发者ID:hanson-huang,项目名称:Encore,代码行数:20,代码来源:PTCHReader.cs

示例9: XFRMChunk

            public XFRMChunk(BinaryReader reader)
            {
                Contract.Requires(reader != null);

                Magic = reader.ReadFourCC();
                BlockSize = reader.ReadInt32();
                Type = reader.ReadFourCC();

                Contract.Assert(BlockSize >= 0);
                Contract.Assert(!string.IsNullOrEmpty(Type));
                Contract.Assert(Type.Length == 4);
            }
开发者ID:chosenmangos,项目名称:Encore,代码行数:12,代码来源:PTCHReader.cs

示例10: PTCHChunk

            public PTCHChunk(BinaryReader reader)
            {
                Contract.Requires(reader != null);

                Magic = reader.ReadFourCC();
                PatchSize = reader.ReadInt32();
                SizeBefore = reader.ReadInt32();
                SizeAfter = reader.ReadInt32();

                Contract.Assert(PatchSize >= 0);
                Contract.Assert(SizeBefore >= 0);
                Contract.Assert(SizeAfter >= 0);
            }
开发者ID:chosenmangos,项目名称:Encore,代码行数:13,代码来源:PTCHReader.cs

示例11: MD5Chunk

            public MD5Chunk(BinaryReader reader)
            {
                Contract.Requires(reader != null);

                Magic = reader.ReadFourCC();
                BlockSize = reader.ReadInt32();
                HashBefore = reader.ReadBytes(HashLength);
                HashAfter = reader.ReadBytes(HashLength);

                Contract.Assert(BlockSize >= 0);
            }
开发者ID:chosenmangos,项目名称:Encore,代码行数:11,代码来源:PTCHReader.cs

示例12: BSDIFF40Chunk

            public BSDIFF40Chunk(byte[] data)
            {
                Contract.Requires(data != null);

                using (var reader = new BinaryReader(new MemoryStream(data)))
                {
                    Magic = reader.ReadFourCC() + reader.ReadFourCC();
                    ControlBlockSize = reader.ReadInt64();
                    DiffBlockSize = reader.ReadInt64();
                    SizeAfter = reader.ReadInt64();

                    ControlBlock = reader.ReadBytes((int)ControlBlockSize);
                    DiffBlock = reader.ReadBytes((int)DiffBlockSize);
                    var stream = reader.BaseStream;
                    ExtraBlock = reader.ReadBytes((int)(stream.Length - stream.Position));
                }
            }
开发者ID:chosenmangos,项目名称:Encore,代码行数:17,代码来源:PTCHReader.cs

示例13: Read

		/// <summary>
		/// Reads collection using binary reader.
		/// </summary>
		/// <param name="reader"></param>
		internal void Read ( BinaryReader reader )
		{
			if (reader.ReadFourCC()!="ATOM") {
				throw new IOException("Bad FourCC. ATOM is expected.");
			}

			//	count:
			int count	=	reader.ReadInt32();

			for ( short i=0; i<count; i++) {
				short idA = reader.ReadInt16();

				short idB = Add( reader.ReadString() );

				if (idA!=idB) {
					throw new IOException("Bad ATOM table.");
				}
			}
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:23,代码来源:AtomCollection.cs


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