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


C# EndianBinaryWriter.Flush方法代码示例

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


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

示例1: sendCommand

    /**
         * Send the XML request string
         */
    public String sendCommand(string command)
    {
        try {
                bw = new EndianBinaryWriter(new BigEndianBitConverter(), tcS);
                System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
                byte[] bytes = encoding.GetBytes(command);
                bw.Write(bytes.Length);
                bw.Write(bytes);

                bw.Flush();
                br = new EndianBinaryReader(new BigEndianBitConverter(), tcS);
                int i = br.ReadInt32();

                byte[] bytess = new byte[i];
                br.Read(bytess, 0, i);
                String response = encoding.GetString(bytess, 0, i);
                Console.WriteLine(response);
                return response;
            } catch (Exception) {
                return "";
            }
    }
开发者ID:RaviChimmalgi,项目名称:fishbowl-shopify,代码行数:25,代码来源:ConnectionObject.cs

示例2: SaveFiles

        private void SaveFiles()
        {
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string savePath = saveFileDialog1.FileName;

                FileStream originalArc = new FileStream(ArcFilePath, FileMode.Open);

                EndianBinaryReader reader = new EndianBinaryReader(originalArc, GameFormatReader.Common.Endian.Big);

                List<byte> testList = reader.ReadBytes((int)reader.BaseStream.Length).ToList();

                reader.Close();

                List<Message> exportList = new List<Message>();

                foreach (Message mes in MessageList)
                {
                    mes.ProofReadTagstoCodes();

                    Message temp = mes.Copy();

                    exportList.Add(temp);
                }

                byte[] newBMGFile = TextBankClass.ExportBMGFromPath(exportList);

                testList.RemoveRange(1344, testList.Count - 1344);

                testList.AddRange(newBMGFile);

                byte[] newBMCFile = ColorClass.BMCExporter(ColorList);

                testList.RemoveRange(256, newBMCFile.Length);

                testList.InsertRange(256, newBMCFile);

                FileStream testStream = new FileStream(savePath, FileMode.Create);

                EndianBinaryWriter writer = new EndianBinaryWriter(testStream, Endian.Big);

                writer.Write(testList.ToArray());

                writer.BaseStream.Position = 128;

                writer.Write((int)newBMGFile.Length);

                writer.BaseStream.Position = 4;

                writer.Write((int)testList.Count);

                writer.Flush();

                writer.Close();
            }
        }
开发者ID:Sage-of-Mirrors,项目名称:TheWindWaker_Text_Editor,代码行数:56,代码来源:MainUI.cs

示例3: LoadFromArc

        public void LoadFromArc(string fileName)
        {
            string tempFileName = "";

            using (FileStream yaz0TestStream = new FileStream(fileName, FileMode.Open))
            {

                EndianBinaryReader yaz0TestReader = new EndianBinaryReader(yaz0TestStream, Endian.Big);

                string yaz0Test = yaz0TestReader.ReadString(4);

                if (yaz0Test == "Yaz0")
                {
                    byte[] uncompressedArc = DecodeYaz0(yaz0TestReader);

                    yaz0TestReader.Close();

                    fileName = Path.GetTempFileName();

                    tempFileName = fileName;

                    FileInfo info = new FileInfo(fileName);

                    info.Attributes = FileAttributes.Temporary;

                    using (FileStream tempStream = new FileStream(fileName, FileMode.Open))
                    {
                        EndianBinaryWriter tempWriter = new EndianBinaryWriter(tempStream, Endian.Big);

                        tempWriter.Write(uncompressedArc);

                        tempWriter.Flush();

                        tempWriter.Close();
                    }
                }
            }

            RARC loadedArc = new RARC(fileName);

            if (File.Exists(tempFileName))
            {
                File.Delete(tempFileName);
            }

            FilesFromArc = new List<FileData>();

            for (int i = 0; i < loadedArc.Nodes.Count(); i++)
            {
                for (int j = 0; j < loadedArc.Nodes[i].Entries.Count(); j++)
                {
                    if (loadedArc.Nodes[i].Entries[j].Data != null)
                    {
                        FileData file = new FileData();

                        file.Name = loadedArc.Nodes[i].Entries[j].Name;

                        file.Data = loadedArc.Nodes[i].Entries[j].Data;

                        FilesFromArc.Add(file);
                    }
                }
            }

            foreach (FileData file in FilesFromArc)
            {
                if (file.Name.Contains(".dzb"))
                {
                    using (EndianBinaryReader reader = new EndianBinaryReader(file.Data, Endian.Big))
                    {

                        Collision = new CollisionMesh();

                        Collision.Load(reader);
                    }
                }

                if (file.Name.Contains(".dzs") || file.Name.Contains(".dzr"))
                {
                    using (EndianBinaryReader reader = new EndianBinaryReader(file.Data, Endian.Big))
                    {
                        Read(reader);
                    }
                }

                if (file.Name.Contains(".bdl") || file.Name.Contains(".bmd"))
                {
                    //Not implemented
                }
            }
        }
开发者ID:Sage-of-Mirrors,项目名称:DZxEditor-TWW-Entity-Editor,代码行数:91,代码来源:Main.cs


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