static void FixFileReferences(Iso9660.IsoImage iso, IO.IFileSystem filesystem)
        {
            Assert.IsNotNull(iso, nameof(iso));
            Assert.IsNotNull(filesystem, nameof(filesystem));

            var data_text = Text.TextFileDescription.GetTextFileData();

            foreach (var item in data_text)
            {
                var textfilepath = Path.Combine(IsoFilePaths.DirectoryPath_Text, item.FileName);

                Update_datalst(iso, textfilepath);
                ClearFileReference(iso, IsoFilePaths.FilePath_sysstartbbc, item.FileName);
                ClearFileReference(iso, IsoFilePaths.FilePath_sysonmembbc, item.FileName);
            }

            foreach (var item in filesystem.GetChildren(@"data\scena", "*.bin"))
            {
                var scenariofilepath = Path.Combine(@"PSP_GAME\USRDIR", item);

                Update_datalst(iso, scenariofilepath);
            }

            foreach (var filepath in filesystem.GetChildren(@"data\battle\dat", "ms*.dat"))
            {
                var filename = Path.GetFileName(filepath);

                var filepath2 = Path.Combine(@"PSP_GAME\USRDIR", filepath);

                Update_datalst(iso, filepath2);
                ClearFileReference(iso, IsoFilePaths.FilePath_btasm1bbc, filename);
            }

            CleanAllMC1Files(iso);

            Update_datalst(iso, IsoFilePaths.FilePath_monsnotedt2);
            ClearFileReference(iso, IsoFilePaths.FilePath_sysonmembbc, "monsnote.dt2");
        }
        static void Run(IO.IFileSystem filesystem, Encoding encoding, String datapath)
        {
            Assert.IsNotNull(filesystem, nameof(filesystem));
            Assert.IsNotNull(encoding, nameof(encoding));
            Assert.IsValidString(datapath, nameof(datapath));

            var data_text = Text.TextFileDescription.GetTextFileData_AoK();

            var totalscenastringtable = new SortedSet <String>();

            Directory.CreateDirectory(datapath);
            Directory.CreateDirectory(Path.Combine(datapath, "text"));
            Directory.CreateDirectory(Path.Combine(datapath, "monster"));

            foreach (var item in data_text)
            {
                Console.WriteLine(item.FileName);

                var textfilepath = Path.Combine(@"data\text", item.FileName);
                var jsonfilepath = Path.ChangeExtension(Path.Combine(datapath, "text", item.FileName), ".json");

                using (var reader = filesystem.OpenFile(textfilepath, encoding))
                {
                    var strings = Text.TextFileIO.Read(reader, item.FilePointerDelegate, item.RecordCount);
                    JsonTextItemFileIO.WriteToFile(strings.Select(x => new TextItem(x)).ToList(), jsonfilepath);
                }
            }

            JsonTextItemFileIO.WriteToFile(totalscenastringtable.Select(x => new TextItem(x)).ToList(), Path.Combine(datapath, "stringtable.json"));

            foreach (var filepath in filesystem.GetChildren(@"data\battle\dat", "ms*.dat"))
            {
                var filename     = Path.GetFileName(filepath);
                var jsonfilepath = Path.ChangeExtension(Path.Combine(datapath, "monster", filename), ".json");

                Console.WriteLine(filename);

                using (var reader = filesystem.OpenFile(filepath, encoding))
                {
                    var monsterfile = OpenMonsterDefinitionFile(reader);
                    var strings     = monsterfile.GetStrings();

                    JsonTextItemFileIO.WriteToFile(strings.Select(x => new TextItem(x)).ToList(), jsonfilepath);
                }
            }

            Console.WriteLine();
            Console.WriteLine("Done.");
        }
        static void Run(IO.IFileSystem filesystem, Encoding encoding, String datapath)
        {
            Assert.IsNotNull(filesystem, nameof(filesystem));
            Assert.IsNotNull(encoding, nameof(encoding));
            Assert.IsValidString(datapath, nameof(datapath));

            var data_text = Text.TextFileDescription.GetTextFileData_AoK();

            var stringtableitems = JsonTextItemFileIO.ReadFromFile(Path.Combine(datapath, "stringtable.json"));

            foreach (var item in data_text)
            {
                var textfilepath = Path.Combine(@"data\text", item.FileName);
                var jsonfilepath = Path.ChangeExtension(Path.Combine(datapath, "text", item.FileName), ".json");

                if (File.Exists(jsonfilepath) == true)
                {
                    Console.WriteLine(item.FileName);

                    using (var reader = filesystem.OpenFile(textfilepath, encoding))
                    {
                        var buffer = UpdateTextFile(reader, item.FilePointerDelegate, item.RecordCount, jsonfilepath);
                        filesystem.SaveFile(textfilepath, buffer);
                    }
                }
            }

            foreach (var filepath in filesystem.GetChildren(@"data\battle\dat", "ms*.dat"))
            {
                var filename     = Path.GetFileName(filepath);
                var jsonfilepath = Path.ChangeExtension(Path.Combine(datapath, "monster", filename), ".json");

                if (File.Exists(jsonfilepath) == true)
                {
                    Console.WriteLine(filename);

                    using (var reader = filesystem.OpenFile(filepath, encoding))
                    {
                        var buffer = UpdateMonsterFile(reader, jsonfilepath);
                        filesystem.SaveFile(filepath, buffer);
                    }
                }
            }

            UpdateMonsterNote(filesystem, encoding);
        }