コード例 #1
0
ファイル: Program.cs プロジェクト: az1020/xenoblade2-research
        private static BdatStringCollection DeserializeBdatStringArchive(string arhFilename, string ardFilename)
        {
            var header  = File.ReadAllBytes(arhFilename);
            var archive = new FileArchive(header, ardFilename);

            var files     = new List <byte[]>();
            var fileNames = new List <string>();

            files.Add(archive.ReadFile("/bdat/common.bdat"));
            fileNames.Add(Path.GetFileNameWithoutExtension("common.bdat"));
            files.Add(archive.ReadFile("/bdat/common_gmk.bdat"));
            fileNames.Add(Path.GetFileNameWithoutExtension("common_gmk.bdat"));
            foreach (var file in archive.GetChildFileInfos("/bdat/gb/"))
            {
                byte[] bdat = archive.ReadFile(file);
                if (bdat == null)
                {
                    continue;
                }
                files.Add(bdat);
                fileNames.Add(Path.GetFileNameWithoutExtension(file.Filename));
            }

            BdatStringCollection tables = DeserializeStrings.ReadBdats(files.ToArray(), fileNames.ToArray());

            return(tables);
        }
コード例 #2
0
        private static BdatStringCollection GetBdatStringCollection(Options options)
        {
            BdatTables           bdats  = ReadBdatTables(options, true);
            BdatStringCollection tables = DeserializeStrings.DeserializeTables(bdats);

            Metadata.ApplyMetadata(tables);
            return(tables);
        }
コード例 #3
0
        public static void GenerateBdatHtml(IFileSystem fs, string outDir, IProgressReport progress)
        {
            var bdats = new BdatTables(fs, true, progress);
            BdatStringCollection tablesStr = DeserializeStrings.DeserializeTables(bdats, progress);

            Metadata.ApplyMetadata(tablesStr);
            HtmlGen.PrintSeparateTables(tablesStr, Path.Combine(outDir, BdatDir), progress);
            JsonGen.PrintAllTables(tablesStr, Path.Combine(outDir, JsonDir), progress);

            BdatCollection tables = Deserialize.DeserializeTables(bdats, progress);

            string dataDir = Path.Combine(outDir, DataDir);

            progress.SetTotal(0);
            progress.LogMessage("Creating salvaging tables");
            Directory.CreateDirectory(dataDir);
            string salvaging = SalvagingTable.Print(tables);

            File.WriteAllText(Path.Combine(dataDir, "salvaging.html"), salvaging);

            progress.LogMessage("Creating enemy tables");
            using (var writer = new StreamWriter(Path.Combine(dataDir, "enemies.csv")))
            {
                Enemies.PrintEnemies(tables, writer);
            }

            progress.LogMessage("Creating achievement tables");
            using (var writer = new StreamWriter(Path.Combine(dataDir, "achievements.csv")))
            {
                Achievements.PrintAchievements(tables, writer);
            }

            string gmkDir = Path.Combine(outDir, GmkDir);

            MapInfo[] gimmicks = ReadGmk.ReadAll(fs, tables, progress);
            progress.LogMessage("Writing map info and gimmick data");
            ExportMap.ExportCsv(gimmicks, gmkDir);
        }