public DemihumanViewModel(MainViewModel parent) { this.Parent = parent; Entries = new Models.ModelCharaHierarchy("d{0:D4}", "e{0:D4}", "v{0:D4}"); foreach (var mc in parent.Realm.GameData.GetSheet<ModelChara>().Where(mc => mc.Type == 2)) { var imcPath = string.Format(ImcPathFormat, mc.ModelKey, mc.BaseKey); if (parent.Realm.Packs.FileExists(imcPath)) Entries.Add(mc); } }
void DoBruteForceWork(object sender, System.ComponentModel.DoWorkEventArgs eventArgs) { var dlg = (Ookii.Dialogs.Wpf.ProgressDialog)sender; var newEntries = new Models.ModelCharaHierarchy(Entries.MainFormat, Entries.SubFormat, Entries.VariantFormat); for (var m = 0; m < 10000; ++m) { if (dlg.CancellationPending) { return; } dlg.ReportProgress(m / 100, null, string.Format("Current progress: {0:P}", m / 10000.0)); for (var b = 0; b < 10000; ++b) { var imcPath = string.Format(ImcPathFormat, m, b); SaintCoinach.IO.File imcBase; if (!Parent.Realm.Packs.TryGetFile(imcPath, out imcBase)) { continue; } try { var imc = new SaintCoinach.Graphics.ImcFile(imcBase); for (var v = 1; v < imc.Count; ++v) { if (Entries.Contains(m, b, v)) { continue; } var any = false; foreach (var p in imc.Parts) { if (p.Variants[v].Variant != 0) { any = true; break; } } if (any) { newEntries.Add(m, b, v); } } } catch (Exception ex) { Console.Error.WriteLine("Failed parsing imc file {0}:{1}{2}", imcPath, Environment.NewLine, ex); } } } Entries = newEntries; }
public DemihumanViewModel(MainViewModel parent) { this.Parent = parent; Entries = new Models.ModelCharaHierarchy("d{0:D4}", "e{0:D4}", "v{0:D4}"); foreach (var mc in parent.Realm.GameData.GetSheet <ModelChara>().Where(mc => mc.Type == 2)) { var imcPath = string.Format(ImcPathFormat, mc.ModelKey, mc.BaseKey); if (parent.Realm.Packs.FileExists(imcPath)) { Entries.Add(mc); } } }
public MonstersViewModel(MainViewModel parent) { this.Parent = parent; var modelCharaSheet = Parent.Realm.GameData.GetSheet<ModelChara>(); Entries = new Models.ModelCharaHierarchy("m{0:D4}", "b{0:D4}", "v{0:D4}"); foreach(var mc in modelCharaSheet.Where(mc => mc.Type == 3)) { var imcPath = string.Format(ImcPathFormat, mc.ModelKey, mc.BaseKey); var mdlPath = string.Format(ModelPathFormat, mc.ModelKey, mc.BaseKey); if(!Parent.Realm.Packs.FileExists(imcPath) ||!Parent.Realm.Packs.FileExists(mdlPath)) continue; Entries.Add(mc); } }
public MonstersViewModel(MainViewModel parent) { this.Parent = parent; var modelCharaSheet = Parent.Realm.GameData.GetSheet <ModelChara>(); Entries = new Models.ModelCharaHierarchy("m{0:D4}", "b{0:D4}", "v{0:D4}"); foreach (var mc in modelCharaSheet.Where(mc => mc.Type == 3)) { var imcPath = string.Format(ImcPathFormat, mc.ModelKey, mc.BaseKey); var mdlPath = string.Format(ModelPathFormat, mc.ModelKey, mc.BaseKey); if (!Parent.Realm.Packs.FileExists(imcPath) || !Parent.Realm.Packs.FileExists(mdlPath)) { continue; } Entries.Add(mc); } }
void DoBruteForceWork(object sender, System.ComponentModel.DoWorkEventArgs eventArgs) { var dlg = (Ookii.Dialogs.Wpf.ProgressDialog)sender; var newEntries = new Models.ModelCharaHierarchy(Entries.MainFormat, Entries.SubFormat, Entries.VariantFormat); for (var m = 0; m < 10000; ++m) { if (dlg.CancellationPending) return; dlg.ReportProgress(m / 100, null, string.Format("Current progress: {0:P}", m / 10000.0)); for (var b = 0; b < 10000; ++b) { var imcPath = string.Format(ImcPathFormat, m, b); SaintCoinach.IO.File imcBase; if (!Parent.Realm.Packs.TryGetFile(imcPath, out imcBase)) continue; try { var imc = new SaintCoinach.Graphics.ImcFile(imcBase); for (var v = 1; v < imc.Count; ++v) { if (Entries.Contains(m, b, v)) continue; var any = false; foreach (var p in imc.Parts) { if (p.Variants[v].Variant != 0) { any = true; break; } } if (any) newEntries.Add(m, b, v); } } catch (Exception ex) { Console.Error.WriteLine("Failed parsing imc file {0}:{1}{2}", imcPath, Environment.NewLine, ex); } } } Entries = newEntries; }