當前位置: 首頁>>代碼示例>>C#>>正文


C# BinaryWriter.WriteBigEndian方法代碼示例

本文整理匯總了C#中System.IO.BinaryWriter.WriteBigEndian方法的典型用法代碼示例。如果您正苦於以下問題:C# BinaryWriter.WriteBigEndian方法的具體用法?C# BinaryWriter.WriteBigEndian怎麽用?C# BinaryWriter.WriteBigEndian使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.IO.BinaryWriter的用法示例。


在下文中一共展示了BinaryWriter.WriteBigEndian方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Write

 public override void Write(BinaryWriter file, int positionOffset)
 {
     file.Write(Encoding.ASCII.GetBytes("REGN"));
     file.WriteBigEndian(this.Size);
     file.WriteBigEndian(this.Position + positionOffset);
     file.WriteBigEndian(this.Length);
 }
開發者ID:JeremyAnsel,項目名稱:JeremyAnsel.Xwa.Imc,代碼行數:7,代碼來源:ImcRegnBlock.cs

示例2: Write

 public override void Write(BinaryWriter file, int positionOffset)
 {
     file.Write(Encoding.ASCII.GetBytes("TEXT"));
     file.WriteBigEndian(this.Size);
     file.WriteBigEndian(this.Position + positionOffset);
     file.Write(Encoding.ASCII.GetBytes(this.Text));
     file.Write((byte)0);
 }
開發者ID:JeremyAnsel,項目名稱:JeremyAnsel.Xwa.Imc,代碼行數:8,代碼來源:ImcTextBlock.cs

示例3: Write

 public override void Write(BinaryWriter file, int positionOffset)
 {
     file.Write(Encoding.ASCII.GetBytes("JUMP"));
     file.WriteBigEndian(this.Size);
     file.WriteBigEndian(this.Position + positionOffset);
     file.WriteBigEndian(this.Destination + positionOffset);
     file.WriteBigEndian(this.HookId);
     file.WriteBigEndian(this.Delay);
 }
開發者ID:JeremyAnsel,項目名稱:JeremyAnsel.Xwa.Imc,代碼行數:9,代碼來源:ImcJumpBlock.cs

示例4: WriteMap

        private static void WriteMap(ImcFile imc, BinaryWriter file, List<ImcBlock> blocks, int mapSize)
        {
            file.Write(Encoding.ASCII.GetBytes("MAP "));
            file.WriteBigEndian(mapSize);

            file.Write(Encoding.ASCII.GetBytes("FRMT"));
            file.WriteBigEndian(20);
            file.WriteBigEndian(mapSize + 24);
            file.WriteBigEndian(1);
            file.WriteBigEndian(imc.BitsPerSample);
            file.WriteBigEndian(imc.SampleRate);
            file.WriteBigEndian(imc.Channels);

            foreach (var block in blocks)
            {
                block.Write(file, mapSize + 24);
            }

            file.Write(Encoding.ASCII.GetBytes("STOP"));
            file.WriteBigEndian(4);
            file.WriteBigEndian(imc.DataRawSize + mapSize + 24);
        }
開發者ID:JeremyAnsel,項目名稱:JeremyAnsel.Xwa.Imc,代碼行數:22,代碼來源:ImcFile.cs

示例5: Save

        public void Save(string fileName)
        {
            FileStream filestream = null;

            try
            {
                filestream = new FileStream(fileName, FileMode.Create, FileAccess.Write);

                using (BinaryWriter file = new BinaryWriter(filestream))
                {
                    filestream = null;

                    int mapSize;
                    var blocks = this.BuildMapBlocks(out mapSize);

                    file.Write(Encoding.ASCII.GetBytes("MCMP"));

                    file.WriteBigEndian((short)(this.Entries.Count + 1));

                    file.Write((byte)0);
                    file.WriteBigEndian(mapSize + 24);
                    file.WriteBigEndian(mapSize + 24);

                    foreach (var entry in this.Entries)
                    {
                        file.Write(entry.Codec);
                        file.WriteBigEndian(entry.RawSize);
                        file.WriteBigEndian(entry.CompressedSize);
                    }

                    file.WriteBigEndian((short)(this.Codecs.Count * 5));

                    foreach (var codec in this.Codecs)
                    {
                        file.Write(Encoding.ASCII.GetBytes(codec));
                        file.Write((byte)0);
                    }

                    file.Write(Encoding.ASCII.GetBytes("iMUS"));
                    file.Write(this.DataRawSize + mapSize + 16);

                    ImcFile.WriteMap(this, file, blocks, mapSize);

                    file.Write(Encoding.ASCII.GetBytes("DATA"));
                    file.WriteBigEndian(this.DataRawSize);

                    foreach (var entry in this.Entries)
                    {
                        file.Write(entry.Data);
                    }

                    this.FileName = fileName;
                }
            }
            finally
            {
                if (filestream != null)
                {
                    filestream.Dispose();
                }
            }
        }
開發者ID:JeremyAnsel,項目名稱:JeremyAnsel.Xwa.Imc,代碼行數:62,代碼來源:ImcFile.cs


注:本文中的System.IO.BinaryWriter.WriteBigEndian方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。