public void SubmitTags() { if (string.IsNullOrEmpty(this.CurrentModName)) { UIState prevMenuUI = MenuContextService.GetPreviousMenuUI(); UIState currMenuUI = MenuContextService.GetCurrentMenuUI(); this.CurrentModName = ModMenuHelpers.GetModName(prevMenuUI, currMenuUI) ?? ""; if (string.IsNullOrEmpty(this.CurrentModName)) { throw new ModHelpersException("Invalid mod name."); } } Action <Exception, string> onError = (e, output) => { this.SetInfoText("Error: " + (string.IsNullOrEmpty(output) ? e.Message : output), Color.Red); LogHelpers.Log(e.ToString()); }; ISet <string> newTags = this.GetTagsWithGivenState(1); // Update snapshot of tags for the given mod (locally) if (this.AllModTagsSnapshot != null) { this.AllModTagsSnapshot[this.CurrentModName] = newTags; } PostModInfo.SubmitModInfo(this.CurrentModName, newTags, onError, this.PostSubmitTags); ModTagsManager.RecentTaggedMods.Add(this.CurrentModName); }
internal void SubmitTags() { if (string.IsNullOrEmpty(this.CurrentModName)) { this.CurrentModName = ModMenuHelpers.GetModName(MenuContextService.GetPreviousMenuUI(), MenuContextService.GetCurrentMenuUI()) ?? ""; if (string.IsNullOrEmpty(this.CurrentModName)) { throw new HamstarException("Invalid mod name."); } } Action <string> onSuccess = delegate(string output) { this.InfoDisplay?.SetText(output, Color.Lime); ErrorLogger.Log("Mod info submit result: " + output); }; Action <Exception, string> onFail = (e, output) => { this.InfoDisplay?.SetText("Error: " + (string.IsNullOrEmpty(output)?e.Message:output), Color.Red); LogHelpers.Log(e.ToString()); }; ISet <string> newTags = this.GetTagsOfState(1); // Update snapshot of tags for the given mod (locally) if (this.AllModTagsSnapshot != null) { this.AllModTagsSnapshot[this.CurrentModName] = newTags; } PostModInfo.SubmitModInfo(this.CurrentModName, newTags, onSuccess, onFail); this.FinishButton.Lock(); this.ResetButton.Lock(); }