/// <summary> /// Initializes a new instance of the <see cref="ParseZoneModelDat"/> class. /// </summary> /// <param name="l">The l.</param> /// <param name="mf">The mf.</param> /// <param name="zid">The zid.</param> /// <param name="zname">The zname.</param> /// <param name="ffxIpath">The FFX ipath.</param> /// <param name="dumpSRinfo">if set to <c>true</c> [dump s rinfo].</param> public ParseZoneModelDat(Log l, HomeView mf, int zid, string zname, string ffxIpath, bool dumpSRinfo) { try { Log = l; Main = mf; ZoneId = zid; FileName = zname; InstallPath = ffxIpath; DumpSRtoXml = dumpSRinfo; RomPath = new RomPath(ffxIpath, l, mf); Mzb = new Mzb(l, mf); Mmb = new Mmb(l, mf); Rid = new Rid(l, mf, ffxIpath, RomPath); Chunks = new List <DatChunk>(); } catch (Exception ex) { Log.LogFile(ex.ToString(), nameof(ParseZoneModelDat)); Log.AddDebugText(Main.RtbDebug, $@"{ex} > {nameof(ParseZoneModelDat)}"); } }
/// <summary> /// dump all object files as an asynchronous operation. /// </summary> /// <param name="run">if set to <c>true</c> [run].</param> private async Task DumpAllObjFilesAsync(bool run) { _cancellationToken = new CancellationTokenSource(); switch (run) { case true: { if (Dat.Dms._zones.Count > 0) { var stopWatch = new Stopwatch(); SubTp.IsEnabled = false; EntTp.IsEnabled = false; stopWatch.Start(); foreach (var zone in Dat.Dms._zones) { await DumpZoneDat(zone.Id, zone.Name, zone.Path); if ((bool)TPNamesCB.IsChecked) { foreach (KeyValuePair<int, string> tz in Tnames.zoneNames) { if (tz.Key == zone.Id) { ZoneDat.Mzb.WriteObj(tz.Value); } } } else switch (IDonlyCb.IsChecked) { case true when ZoneDat.Mzb.WriteObj(zone.Id.ToString()): case false when ZoneDat.Mzb.WriteObj(zone.Name): continue; } } stopWatch.Stop(); var ts = stopWatch.Elapsed; var elapsedTime = $"{ts.Hours.ToString("00")}:{ts.Minutes.ToString("00")}:{ts.Seconds.ToString("00")}.{ts.Milliseconds / 10:00}"; Log.AddDebugText(RtbDebug, $@"Time taken to dump all collision obj files {elapsedTime}"); BuildAllObJbtn.Content = @"Build obj files for all zones."; _dumpingMapDats = false; SubTp.IsEnabled = true; EntTp.IsEnabled = true; SubRegion.IsEnabled = true; Entity.IsEnabled = true; } else Log.AddDebugText(RtbDebug, "Please click Load Zones, before you try and build obj files!."); BuildAllObJbtn.Content = @"Build obj files for all zones."; _dumpingMapDats = false; SubTp.IsEnabled = true; EntTp.IsEnabled = true; SubRegion.IsEnabled = true; Entity.IsEnabled = true; break; } case false: { _cancellationToken?.Cancel(); BuildAllObJbtn.Content = @"Build obj files for all zones."; _dumpingMapDats = false; SubTp.IsEnabled = true; EntTp.IsEnabled = true; SubRegion.IsEnabled = true; Entity.IsEnabled = true; break; } } }