Beispiel #1
0
        private void PopWildEdit(GameFile type)
        {
            var file = ROM.GetFile(type);
            var data = file[0];
            var obj  = FlatBufferConverter.DeserializeFrom <EncounterArchive7b>(data);

            using var form = new GGWE(ROM, obj);
            if (form.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            data    = FlatBufferConverter.SerializeFrom(obj);
            file[0] = data;
        }
Beispiel #2
0
        private void PopWildEdit(string file)
        {
            var winner = Path.Combine(ROM.PathRomFS, "bin", "field", "param", "encount", file);
            var obj    = FlatBufferConverter.DeserializeFrom <EncounterArchive7b>(winner);

            using var form = new GGWE(ROM, obj);
            if (form.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var data = FlatBufferConverter.SerializeFrom(obj);

            FileMitm.WriteAllBytes(winner, data);
        }
Beispiel #3
0
        public void EditWild()
        {
            var ofd = new OpenFileDialog {
                Filter = "json files (*.json)|*.json|All files (*.*)|*.*"
            };

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

            if (!File.Exists(path))
            {
                return;
            }

            if (Path.GetExtension(path) != ".json" || new FileInfo(path).Length > 350_000)
            {
                WinFormsUtil.Alert("Not an expected json file.");
                return;
            }
            var json = File.ReadAllText(path);
            var form = new GGWE(ROM, json);

            form.ShowDialog();
            var result = form.Result;

            if (string.IsNullOrWhiteSpace(result))
            {
                return; // no save
            }
            var sfd = new SaveFileDialog {
                Filter = "json files (*.json)|*.json|All files (*.*)|*.*"
            };

            if (sfd.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            path = sfd.FileName;
            File.WriteAllText(path, result);
        }