Пример #1
0
        public bool pc_to_xbox360()
        {
            STFS xstfs;
            string pcfilename, xfilename;
            byte[] pcfiledata;

            // open the pc save file
            OpenFileDialog odlg = new OpenFileDialog { Filter = "FalloutNV (*.fos)|*.fos|" + "All files (*.*)|*.*", Title = "Select your PC save game..." };

            if (odlg.ShowDialog() == DialogResult.OK)
                pcfilename = odlg.FileName;
            else
                return false;

            FileStream fs = new FileStream(pcfilename, FileMode.Open, FileAccess.Read);
            fs.Read((pcfiledata = new byte[fs.Length]), 0, (int)fs.Length);
            fs.Close();

            // open the xbox save file
            OpenFileDialog odlg2 = new OpenFileDialog { Filter = "FalloutNV (*.fxs)|*.fxs|" + "All files (*.*)|*.*", Title = "Select your XBOX save game..." };
            if (odlg2.ShowDialog() == DialogResult.OK)
                xfilename = odlg2.FileName;
            else
                return false;

            xstfs = new STFS(xfilename);
            byte[] wodata = xstfs.updateFile(pcfiledata);

            // backup the old fxs file & write out the new file
            File.Copy(xfilename, xfilename + ".bak");
            FileStream fs2 = new FileStream(xfilename, FileMode.Create, FileAccess.Write);
            fs2.Write(wodata, 0, wodata.Length);
            fs2.Close();

            XtraMessageBox.Show("Success", "File has been successfully saved.\nNOTE: Do NOT resigh/rehash this file! If you do it will NOT work!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

            return true;
        }
Пример #2
0
        public bool xbox360_to_pc()
        {
            STFS xstfs;
            byte[] xfiledata;
            byte[] rawdata;
            List<byte> cleanname;
            string filen;

            // open the 360 save file
            OpenFileDialog odlg = new OpenFileDialog { Filter = "FalloutNV (*.fxs)|*.fxs|" + "All files (*.*)|*.*", Title = "Select your XBOX 360 save game..." };
            if (odlg.ShowDialog() == DialogResult.OK)
            {
                filen = odlg.FileName;
            }
            else
            {
                return false;
            }

            xstfs = new STFS(odlg.FileName);
            xfiledata = xstfs.extractFile();
            rawdata = xstfs.rawFile();

            // get the file name
            int endfn = ByteFunctions.ByteSearchFirst(rawdata, new byte[] { 0x00, 0x00, 0x00, 0x00 }, 0x412);

            byte[] fname = ByteFunctions.BytePeice(rawdata, 0x412, (endfn - 0x412));
            cleanname = new List<byte>();

            // remove all 00's
            for (int i = 0; i < fname.Length; i++)
            {
                if (fname[i] != 0x00)
                    cleanname.Add(fname[i]);
            }

            // write out the save file
            FolderBrowserDialog fdlg = new FolderBrowserDialog { Description = "Select save destination..." };
            if (fdlg.ShowDialog() == DialogResult.OK)
            {
                FileStream fs = new FileStream(fdlg.SelectedPath + "\\" + Encoding.Default.GetString(cleanname.ToArray()) + ".fos", FileMode.Create, FileAccess.Write);
                fs.Write(xfiledata, 0, xfiledata.Length);
                fs.Close();
            }
            else
            {
                return false;
            }

            XtraMessageBox.Show("File Saved!");

            return true;
        }
Пример #3
0
        public bool load_file(string filename)
        {
            _form.barStatus.Caption = "Status: Reading...";
            _form.pBar.Properties.Maximum = 5;

            // setup file and tempfile
            tmpfile = Path.GetTempFileName();
            file = filename;

            _form.progressbar_inc();

            FileStream fsOut = new FileStream(tmpfile, FileMode.Create, FileAccess.Write);

            // get & witeout clean file data
            xpack = new STFS(filename);

            byte[] cleanbuffer = xpack.extractFile();
            _form.progressbar_inc();

            fsOut.Write(cleanbuffer, 0, cleanbuffer.Length);
            fsOut.Close();
            _form.progressbar_inc();

            offsets = new OffsetsClass(tmpfile);
            _form.progressbar_inc();

            savegame = new Savegame(tmpfile, offsets);
            _form.progressbar_inc();

            _form.barStatus.Caption = "Status: Done";

            return true;
        }