private async Task WriteFilter(Filter baseFilter, bool isGeneratingStylesAndSeed, string outputFolder = null) { if (File.Exists(outputFolder + "RESULTS.zip")) { File.Delete(outputFolder + "RESULTS.zip"); } var oldSeedVersion = baseFilter.GetHeaderMetaData("version:"); var newVersion = LocalConfiguration.GetInstance().YieldConfiguration().First(x => x.Key == "Version Number").Value; if (oldSeedVersion == newVersion) { var isStopping = !InfoPopUpMessageDisplay.DisplayQuestionMessageBox("Error: \n\nVersion did not change!\nDo you want to continue the filter generation?"); if (isStopping) { return; } } else { baseFilter.SetHeaderMetaData("version:", newVersion); } await FilterWriter.WriteFilter(baseFilter, isGeneratingStylesAndSeed, outputFolder, Configuration.AppSettings["StyleSheet Folder"]); }
private void InitializeLocalConfiguration() { this.Configuration = LocalConfiguration.GetInstance(); var data = this.Configuration.YieldConfiguration().ToList(); data.ForEach(x => ConfigurationData.Add(x)); this.ConfigGrid.ItemsSource = ConfigurationData; }
private static bool VerifyFilter(Filter baseFilter) { var errorMsg = new List <string>(); var oldSeedVersion = baseFilter.GetHeaderMetaData("version:"); var newVersion = LocalConfiguration.GetInstance().YieldConfiguration().First(x => x.Key == "Version Number").Value; if (oldSeedVersion == newVersion) { errorMsg.Add("Version did not change!"); } else { baseFilter.SetHeaderMetaData("version:", newVersion); } // add missing UP command tags // currently unused/unnecessary plus bug: trinkets/amulets/... should not be affected by this!! // foreach (var entry in baseFilter.FilterEntries) // { // if (entry.Header.Type != FilterConstants.FilterEntryType.Content) continue; // // if (!(entry?.Content?.Content?.ContainsKey("ItemLevel") ?? false)) continue; // if (entry.Content.Content["ItemLevel"]?.Count != 1) continue; // var ilvl = entry.Content.Content["ItemLevel"].Single().Value as NumericValueContainer; // if (ilvl == null) continue; // if (ilvl.Value != "65" || ilvl.Operator != ">=") continue; // // if (!(entry?.Content?.Content?.ContainsKey("SetTextColor") ?? false)) continue; // // if (entry.Header.HeaderValue == "Hide") continue; // // if (!entry.Content.Content.ContainsKey("Rarity")) continue; // var rarity = entry.Content.Content["Rarity"].Single().Value as NumericValueContainer; // if (rarity.Value != "Rare") continue; // if (!string.IsNullOrEmpty(rarity.Operator)) // { // if (rarity.Operator.Contains("<") || rarity.Operator.Contains(">")) continue; // } // // if (entry.Header.GenerationTags.Any(tag => tag is RaresUpEntryCommand)) continue; // // InfoPopUpMessageDisplay.ShowInfoMessageBox("Adding UP tag to this entry:\n\n\n" + string.Join("\n", entry.Serialize())); // entry.Header.GenerationTags.Add(new RaresUpEntryCommand(entry as FilterEntry) { Value = "UP", Strictness = -1}); // } // FilterStyleVerifyer.Run(baseFilter); // todo: re-enable this when the filter doesnt have the tons of errors anymore if (errorMsg.Count > 0) { var isStopping = !InfoPopUpMessageDisplay.DisplayQuestionMessageBox("Error: \n\n" + string.Join("\n", errorMsg) + "\n\nDo you want to continue the filter generation?"); return(isStopping); } return(false); }
private void ApplyAllSuggestions(object sender, RoutedEventArgs e) { this.TierListFacade.ApplyAllSuggestions(); this.TierListFacade.TierListData.Values.ToList().ForEach(x => x.ReEvaluate()); var json = JsonConvert.SerializeObject(this.TierListFacade.Changelog).Replace("->", "_"); var changeLogPath = LocalConfiguration.GetInstance().AppSettings["Output Folder"] + "/Changelog/changelog.json"; FileWork.WriteTextAsync(changeLogPath, json); this.EventGrid.Publish(); }