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


C# Writer.Flush方法代码示例

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


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

示例1: Save

        private void Save(object sender, RoutedEventArgs e)
        {
            using (var writer = new Writer(buffer))
            {
                foreach (Slot slot in Slots.Where(slot => slot.SlotRead))
                {
                    int id = slot.SlotID;

                    SetStatus("Writing Slot# " + (id + 1));
                    _offset = (0x44 + (0x79400 * id));
                    try
                    {
                        //Name
                        SetStatus("Writing Name");
                        writer.Position = _offset + 4;
                        writer.WriteString(slot.Name, StringType.Ascii, 16);

                        //Money
                        SetStatus("Writing Money");
                        writer.Position = _offset + 64;
                        writer.WriteUInt32(slot.Money);

                        ////Inventory
                        //Weapons
                        if (weapons.IsChecked == true)
                        {
                            writer.Position = _offset + 107;
                            writer.WriteHexString(
                                "636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363")
                                ;
                        }
                        //Headgear
                        if (headgear.IsChecked == true)
                        {
                            writer.Position = _offset + 362;
                            writer.WriteHexString(
                                "63636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363")
                                ;
                        }

                        if (bodywear.IsChecked == true)
                        {
                            writer.Position = _offset + 411;
                            writer.WriteHexString(
                                "6363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363")
                                ;
                        }
                        if (armwear.IsChecked == true)
                        {
                            writer.Position = _offset + 473;
                            writer.WriteHexString(
                                "6363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363")
                                ;
                        }
                        if (legwear.IsChecked == true)
                        {
                            writer.Position = _offset + 535;
                            writer.WriteHexString(
                                "6363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363")
                                ;
                        }
                        if (pennon.IsChecked == true)
                        {
                            writer.Position = _offset + 597;
                            writer.WriteHexString(
                                "6363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363")
                                ;
                        }

                        //Squad Writes
                        int counter = 0;
                        foreach (Squad squad in slot.Squads)
                        {
                            SetStatus("Writing " + (Squaddies)counter);
                            writer.Position = _offset + squad.Adjust;
                            writer.WriteUInt16(squad.Level);
                            writer.Position += 4;
                            writer.WriteUInt32(squad.Points);
                            counter++;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        SetStatus("ERROR!");
                        return;
                    }
                    SetStatus("Saved!");
                    writer.Flush();
                }
            }
            _stfs.Replace(buffer, 0);
            //Device ID
            _stfs.HeaderData.DeviceID = DID.Text;

            //Profile ID
            _stfs.HeaderData.ProfileID = PID.Text;

            //Console ID
            _stfs.HeaderData.ConsoleID = CID.Text;
//.........这里部分代码省略.........
开发者ID:8Ball360Haven,项目名称:BladestormSaveEditor,代码行数:101,代码来源:MainWindow.xaml.cs


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