public static void WriteMapModels(ARealmReversed realm, TerritoryType teriType, SaintCoinach.Graphics.Territory teri = null) { string name = teri != null ? teri.Name : teriType.Name; //Plot.Ward ward = Plot.StringToWard(teriType.Name); string outpath = Path.Combine(FFXIVHSPaths.GetRootDirectory(), name, "objects\\"); string inpath = Path.Combine(FFXIVHSPaths.GetRootDirectory(), name + "\\", name + ".json"); if (!Directory.Exists(outpath)) { Directory.CreateDirectory(outpath); } //string inpath = FFXIVHSPaths.GetWardJson(ward); if (!File.Exists(inpath)) { throw new FileNotFoundException(); } //string outpath = FFXIVHSPaths.GetWardObjectsDirectory(ward); string json = File.ReadAllText(inpath); Map map = JsonConvert.DeserializeObject <Map>(json); foreach (MapModel model in map.models.Values) { if (realm.Packs.TryGetFile(model.modelPath, out SaintCoinach.IO.File f)) { ObjectFileWriter.WriteObjectFile(outpath, (ModelFile)f); } } }
public static void WriteMap(ARealmReversed realm, TerritoryType teriType, SaintCoinach.Graphics.Territory teri = null) { string name = teri != null ? teri.Name : teriType.Name; //Plot.Ward ward = Plot.StringToWard(teriType.Name); string outdir = Path.Combine(FFXIVHSPaths.GetRootDirectory(), name + "\\"); string outpath = Path.Combine(outdir, name + ".json"); //string outpath = FFXIVHSPaths.GetWardJson(ward); if (!Directory.Exists(outdir)) { Directory.CreateDirectory(outdir); } if (File.Exists(outpath)) { WriteMapModels(realm, teriType, teri); return; } Map map = ReadTerritory(teriType, teri); string json = JsonConvert.SerializeObject(map, Formatting.Indented); File.WriteAllText(outpath, json); }