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


C# DJsIO.ReadHexString方法代码示例

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


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

示例1: importfromprofile

        public void importfromprofile()
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Title = "Open a xbox 360 profile";
            dialog.Filter = "Xbox 360 profile|*.*";
            DialogResult result = dialog.ShowDialog();
            if (result == DialogResult.OK) // Test result.
            {

                try
                {
                    DJsIO io = new DJsIO(dialog.FileName, DJFileMode.Open, true);


                    io.Position = 0x371;
                    this.Profileid = io.ReadHexString(8);
                    io.Close();

                    //xPackage3.STFS.Package sts = new xPackage3.STFS.Package(dialog.FileName);

                    STFSPackage stfs = new STFSPackage(dialog.FileName, null);
                    ProfilePackage xFile = new ProfilePackage(ref stfs);
                    string gamertag = xFile.UserFile.GetGamertag();
                    this.ProfileName = gamertag;
                    xFile.CloseIO();
                    stfs.CloseIO();
                    //this.Profileid = stfs.Header.Title_Package;
                }
                catch (Exception e) { }
            }
        }
开发者ID:XxRaPiDK3LLERxX,项目名称:nucleuscoop,代码行数:31,代码来源:GeneralViewModel.cs

示例2: ReadSave

        public IEnumerable<IResult> ReadSave()
        {
            string fileName = null;

            MyOpenFileResult ofr;

            ofr = new MyOpenFileResult()
                .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;
            }

            ///////////////////////////////////////////
            //SPITFIRE1337 MODS
            ///////////////////////////////////////////

            string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            //using (FileStream fs = File.Create(path)) { }
            File.Delete(path + "/mytempsave.sav");
            File.Delete(path + "/savegame.sav");
            File.Copy(fileName, path + "/mytempsave.sav");
            string profileid = "";
            string deviceid = "";
            string consoleid = "";


            Stream input1 = new FileStream(fileName, FileMode.Open);

            // Ensure that the target does not exist.



            //Stream input = new Stream(fs);
            var check = input1.ReadValueU32(Endian.Big);

            input1.Close();

            if (check == 0x434F4E20)
            {
                //MessageBox.Show("This is a xbox save");

                yield return new DelegateResult(() =>
                {
                    DJsIO io = new DJsIO(fileName, DJFileMode.Open, true);

                    io.Position = 0x371;
                    profileid = io.ReadHexString(8); //Profile ID
                    io.Close();
                })
    .Rescue().Execute(
        x =>
        new MyMessageBox("An exception was thrown (press Ctrl+C to copy):\n\n" + x.ToString(),
                         "Error")
            .WithIcon(MessageBoxImage.Error).AsCoroutine());


                STFSPackage xPackage = new STFSPackage(fileName, null);
                FileEntry xent = (FileEntry)xPackage.GetFile("savegame.sav");

                if (!xent.Extract(path + "/savegame.sav"))
                {
                    //MessageBoxEx.Show("Extraction Failed!", "Failed!", MessageBoxButtons.OK, MessageBoxIcon.[Error])
                    //xboxextract.ReportProgress(200, "Extraction Failed");
                    //Thread.Sleep(2000);
                    //Return
                    MessageBox.Show("Could not extract savegame.sav. Please use a program like modio or horizon to extract your savegame.sav");
                }
                else
                {


                    fileName = path + "/savegame.sav";
                    //MessageBox.Show("File extracted");
                    //Thread.Sleep(2000);
                    //MessageBoxEx.Show("Extraction Complete!", "Complete!", MessageBoxButtons.OK, MessageBoxIcon.Information)
                }

            }
            else
            {
                profileid = "0";
                deviceid = "0";
                consoleid = "0";
            }

            yield return new DelegateResult(() =>
            {
//.........这里部分代码省略.........
开发者ID:spitfire1337,项目名称:Borderlands-2-Save-Editor,代码行数:101,代码来源:ShellViewModel.cs


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