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


C# DJsIO.WriteHexString方法代码示例

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


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

示例1: WriteSaveXbox

        ///////////////////////////////////////////
        //SPITFIRE1337 MODS
        ///////////////////////////////////////////
        public IEnumerable<IResult> WriteSaveXbox()
        {
            if (this.SaveFile == null)
            {
                yield break;
            }

            string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            File.Delete(path + "/savegame.sav");

            //MessageBox.Show("A save file box will now appear, please select a EXISTING XBOX SAVE to overwrite. I can not emphasize this enough, ALWAYS KEEP A WORKING BACKUP. Once you have a backup press ok to continue");

            var saveFile = this.SaveFile;

            yield return new DelegateResult(() =>
            {
                Endian endian;
                this.General.ExportData(saveFile.SaveGame, out endian);
                this.CurrencyOnHand.ExportData(saveFile.SaveGame);
                this.Backpack.ExportData(saveFile.SaveGame);
                this.Bank.ExportData(saveFile.SaveGame);


                using (var output = File.Create(path + "/savegame.sav"))
                {
                    saveFile.Endian = endian;
                    saveFile.Serialize(output);
                }
            }).Rescue().Execute(
    x =>
    new MyMessageBox("An exception was thrown (press Ctrl+C to copy this text):\n\n" + x.ToString(), "Error")
        .WithIcon(MessageBoxImage.Error).AsCoroutine());

            string fileName = null;

            MySaveFileResult ofr;

            ofr = new MySaveFileResult()
                .PromptForOverwrite()
                .FilterFiles(
                    ffc => ffc.AddFilter("sav", true)
                               .WithDescription("Borderlands 2 Save Files")
                               .AddAllFilesFilter())
                .WithFileDo(s => fileName = s);

            if (string.IsNullOrEmpty(this._SavePath) == false &&
                Directory.Exists(this._SavePath) == true)
            {
                ofr = ofr.In(this._SavePath);
            }

            yield return ofr;

            if (fileName == null)
            {
                yield break;
            }
            if (File.Exists(fileName))
            {

                File.WriteAllBytes(fileName, Properties.Resources.Save0001);
            }
            else
            {
                File.Delete(fileName);
                File.WriteAllBytes(fileName, Properties.Resources.Save0001);
            }
            yield return new DelegateResult(() =>
            {


                string profileid = this.General.Profileid;
                DJsIO io = new DJsIO(fileName, DJFileMode.Open, true);

                io.Position = 0x371;
                io.WriteHexString(profileid);
                io.Close();
            }).Rescue().Execute(
                x =>
                new MyMessageBox("An exception was thrown (press Ctrl+C to copy this text):\n\n" + x.ToString(), "Error")
                    .WithIcon(MessageBoxImage.Error).AsCoroutine());
            yield return new DelegateResult(() =>
            {

                STFSPackage stfs = new STFSPackage(fileName, null);
                FileEntry item = stfs.GetFile("savegame.sav"); //Get's the account file



                if (!item.Replace(path + "\\savegame.sav"))
                {
                    //If Not xent.Extract(Application.StartupPath + "\" + "savegame.sav") Then
                    //MessageBoxEx.Show("Extraction Failed!", "Failed!", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                    throw new Exception("Failed to insert save file to xbox save. Please use a program like modio or horizon to insert your save");

                }
                else
//.........这里部分代码省略.........
开发者ID:spitfire1337,项目名称:Borderlands-2-Save-Editor,代码行数:101,代码来源:ShellViewModel.cs


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