/// <summary> /// Get the Local Version of an Addon /// </summary> private string GetLocalVersion() { // Check for Blizzard Addon if (Mappings.Count > 0) { if (Mappings[0].AddonSiteId == AddonSiteId.blizzard) { return("None"); } } // Check for SubAddon if (IsSubAddon && !IsMain) { return("SubAddon"); } // Check if it is Installed if (!IsInstalled) { return("Not Installed"); } var addonFolderPath = Path.Combine(Config.Instance.WowFolderPath, @"Interface\Addons"); addonFolderPath = Path.Combine(addonFolderPath, Name); // Try by Changelog foreach (var file in Directory.GetFiles(addonFolderPath, "Changelog*")) { var start = file.IndexOf("-") + 1; start = file.IndexOf("-", start) + 1; var end = file.LastIndexOf(".txt"); if (start > 0 && end > 0) { return(file.Substring(start, end - start)); } } // Try by .toc File string version; if (TocHelper.GetVersion(this, out version)) { return(version); } // Special if (Name == "MarsPartyBuff") { var versionFile = Path.Combine(addonFolderPath, "VERSION.TXT"); if (File.Exists(versionFile)) { return(File.ReadAllLines(versionFile)[0]); } } // Unknown return("?"); }
public void LoadBadTocYamlFileShouldGiveLineNumber() { var content = @" - name: x items: - name: x1 href: x1.md - name: x2 href: x2.md"; var toc = _fileCreator.CreateFile(content, FileType.YamlToc); var ex = Assert.Throws <DocumentException>(() => TocHelper.LoadSingleToc(toc)); Assert.Equal("toc.yml is not a valid TOC File: toc.yml is not a valid TOC file, detail: (Line: 3, Col: 10, Idx: 22) - (Line: 3, Col: 10, Idx: 22): Mapping values are not allowed in this context..", ex.Message); }
public TocResponse SessionId(bool autoCapture) { try { var apiKey = "d1e15e6eeab44925b1cfcde84fe763e1"; var url = "https://sandbox-api.7oc.cl/session-manager/v1/session-id"; var helper = new TocHelper().GetSessionID(apiKey, url, autoCapture); return(helper.Result); } catch (Exception ex) { _logger.LogError(ex, "Error getting session id"); return(new TocResponse()); } }
public string Validate([FromBody] DocumentValidationModel validationData) { try { var apiKey = "d1e15e6eeab44925b1cfcde84fe763e1"; var url = "https://sandbox-api.7oc.cl/v2/face-and-document"; var result = new TocHelper().ValidateFaceAndDocuemnt(apiKey, url, validationData); return(result.Result); } catch (Exception ex) { _logger.LogError(ex, "Error validating the data"); return(string.Empty); } }
private void dgvAddons_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e) { var dgv = sender as DataGridView; if (e.StateChanged == DataGridViewElementStates.Selected) { if (dgv.SelectedRows.Count > 0) { var addon = e.Row.DataBoundItem as Addon; lvRelations.BeginUpdate(); lvRelations.Columns[0].Width = -2; lvRelations.Items.Clear(); // Dependencies foreach (var dep in TocHelper.GetDependencies(addon)) { var i = new ListViewItem(dep, lvRelations.Groups[0]); lvRelations.Items.Add(i); } // SubAddons foreach (var subAddon in addon.SubAddons) { var i = new ListViewItem(subAddon.Name, lvRelations.Groups[1]); lvRelations.Items.Add(i); } // SuperAddons foreach (var superAddon in addon.SuperAddons) { var i = new ListViewItem(superAddon.Name, lvRelations.Groups[2]); lvRelations.Items.Add(i); } lvRelations.EndUpdate(); // Other Info txtName.Text = addon.Name; txtLocalVersion.Text = addon.LocalVersion; dgvMappings.DataSource = addon.Mappings; } } }
protected void Page_Load(object sender, EventArgs e) { try { SlkUtilities.RetryOnDeadlock(delegate() { // Clear data that may need to be reset on retry Response.Clear(); ClearError(); m_tocHelper = new TocHelper(); string submitText = ""; SessionView view; if (TryGetSessionView(false, out view)) { if (view == SessionView.Execute) { submitText = SlkFrameset.TOC_SubmitAssignment; } else { submitText = SlkFrameset.TOC_SubmitGrading; } } m_tocHelper.ProcessPageLoad(Response, SlkStore.PackageStore, TryGetSessionView, TryGetAttemptId, ProcessViewRequest, RegisterError, submitText); }); } catch (Exception ex) { // Unexpected exceptions are not shown to user SlkStore.LogError(FramesetResources.FRM_UnknownExceptionMsg, ex.ToString()); RegisterError(ResHelper.GetMessage(FramesetResources.FRM_UnknownExceptionTitle), ResHelper.GetMessage(SlkFrameset.FRM_UnexpectedExceptionMsg), false); } }