Exemplo n.º 1
0
        public void loadSave(SaveFile saveFile)
        {
            addOverviewItem("Signature", saveFile.header.getSignatureString());
            addOverviewItem("Save version", saveFile.header.saveVersion);
            addOverviewItem("Save number", saveFile.header.saveNumber.ToString());
            addOverviewItem("Player name", saveFile.header.playerName);
            addOverviewItem("Player level", saveFile.header.playerLevel.ToString());
            addOverviewItem("Location", saveFile.header.locationName);
            addOverviewItem("Play duration", saveFile.header.playDurationString);
            addOverviewItem("Player race", saveFile.header.playerRaceString);
            addOverviewItem("Player sex", saveFile.header.playerSex.ToString());
            addOverviewItem("Player XP", saveFile.header.playerExp);
            addOverviewItem("Player required XP", saveFile.header.playerRequiredExp);
            addOverviewItem("Save date/time", saveFile.header.saveDateTime.ToString());
            addOverviewItem("Screenshot width", saveFile.header.screenshotWidth.ToString());
            addOverviewItem("Screenshot height", saveFile.header.screenshotHeight.ToString());

            addOverviewItem("Form version", saveFile.applicationInfo.formVersion);
            addOverviewItem("Application version", saveFile.applicationInfo.applicationVersion);
            addOverviewItem("Data files length", saveFile.applicationInfo.dataFilesLength);
            addOverviewItem("Data files count", saveFile.applicationInfo.dataFilesCount);

            for(var i = 0; i < saveFile.applicationInfo.dataFiles.Count; i++) {
                var name = String.Format("Data file #{0}", i);
                addOverviewItem(name, saveFile.applicationInfo.dataFiles[i]);
            }

            addOverviewItem("Offset 1", saveFile.index.offset1);
            addOverviewItem("Offset 2", saveFile.index.offset2);
            addOverviewItem("Offset 3", saveFile.index.offset3);
            addOverviewItem("Offset 4", saveFile.index.offset4);
            addOverviewItem("Offset 5", saveFile.index.offset5);
            addOverviewItem("Offset 6", saveFile.index.offset6);

            addOverviewItem("Block count 1", saveFile.index.blockCount1);
            addOverviewItem("Block count 2", saveFile.index.blockCount2);
            addOverviewItem("Block count 3", saveFile.index.blockCount3);
            addOverviewItem("Block count 4", saveFile.index.blockCount4);

            overviewListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
        }
        public void loadSave(SaveFile saveFile)
        {
            formBlocksList.SetObjects(saveFile.formBlocks.Values);

            formBlocksList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
Exemplo n.º 3
0
        private void compareMenuItem_Click(object sender, EventArgs e)
        {
            var ofd = new OpenFileDialog() {
                Filter = "Fallout 4 Save Files (*.fos)|*.fos|All Files|*"
            };

            if (ofd.ShowDialog() != DialogResult.OK) {
                return;
            }

            var fbd = new FolderBrowserDialog();

            if(fbd.ShowDialog() != DialogResult.OK) {
                return;
            }

            var targetDirA = String.Format("{0}\\A", fbd.SelectedPath);
            var targetDirB = String.Format("{0}\\B", fbd.SelectedPath);

            if(!Directory.Exists(targetDirA)) {
                Directory.CreateDirectory(targetDirA);
            }

            if (!Directory.Exists(targetDirB)) {
                Directory.CreateDirectory(targetDirB);
            }

            using (var stream = File.OpenRead(ofd.FileName)) {
                var compareSaveFile = new SaveFile(stream);

                compareSaveFile.read();

                string targetFile = null;

                foreach (var block in saveFile.idBlocks.Values) {
                    if(!compareSaveFile.idBlocks.ContainsKey(block.id)) {
                        targetFile = String.Format("{0}\\{1:X8}.bin", targetDirA, block.id);
                        File.WriteAllBytes(targetFile, block.data);
                    }
                    else {
                        var otherBlock = compareSaveFile.idBlocks[block.id];

                        if (!block.Equals(otherBlock)) {
                            targetFile = String.Format("{0}\\{1:X8}.bin", targetDirA, block.id);
                            File.WriteAllBytes(targetFile, block.data);

                            targetFile = String.Format("{0}\\{1:X8}.bin", targetDirB, block.id);
                            File.WriteAllBytes(targetFile, otherBlock.data);
                        }
                    }
                }

                foreach(var block in saveFile.formBlocks.Values) {
                    if(!compareSaveFile.formBlocks.ContainsKey(block.id)) {
                        targetFile = String.Format("{0}\\{2}_{1:X8}.bin", targetDirA, block.id, block.getTypeName());
                        File.WriteAllBytes(targetFile, block.inflateData());
                    }
                    else {
                        var otherBlock = compareSaveFile.formBlocks[block.id];

                        if (!block.Equals(otherBlock)) {
                            targetFile = String.Format("{0}\\{2}_{1:X8}.bin", targetDirA, block.id, block.getTypeName());
                            File.WriteAllBytes(targetFile, block.inflateData());

                            targetFile = String.Format("{0}\\{2}_{1:X8}.bin", targetDirB, block.id, block.getTypeName());
                            File.WriteAllBytes(targetFile, otherBlock.inflateData());
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void openMenuItem_Click(object sender, EventArgs e)
        {
            var ofd = new OpenFileDialog() {
                Filter = "Fallout 4 Save Files (*.fos)|*.fos|All Files|*"
            };

            if(ofd.ShowDialog() == DialogResult.OK) {
                using (var stream = File.OpenRead(ofd.FileName)) {
                    saveFile = new SaveFile(stream);

                    saveFile.read();

                    overviewFragment.loadSave(saveFile);
                    idBlocksFragment.loadSave(saveFile);
                    idBlocksTabPage.Text = String.Format("{0} ({1:n0})", strings.IdBlocks, saveFile.idBlocks.Count);

                    formBlocksFragment.loadSave(saveFile);
                    formBlocksTabPage.Text = String.Format("{0} ({1:n0})", strings.FormBlocks, saveFile.formBlocks.Count);
                }
            }
        }