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