//===================================================================== /// <summary> /// Add new help attribute /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnAddAttribute_Click(object sender, EventArgs e) { dgvHelpAttributes.EndEdit(); attributes.Add("NoName", null); dgvHelpAttributes.CurrentCell = dgvHelpAttributes[0, attributes.Count - 1]; dgvHelpAttributes.Focus(); this.IsDirty = attributesChanged = true; }
/// <summary> /// Add new help attribute /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnAdd_Click(object sender, EventArgs e) { dgvAttributes.EndEdit(); attributes.Add("NoName", null); dgvAttributes.CurrentCell = dgvAttributes[0, attributes.Count - 1]; dgvAttributes.Focus(); }
//===================================================================== /// <summary> /// Parse the specified HTML file /// </summary> /// <param name="filename">The file to parse</param> /// <remarks>After parsing, the properties can be used to retrieve the information parsed from /// the file.</remarks> public void ParseFile(string filename) { Match m; Encoding enc = Encoding.Default; string content = ReadWithEncoding(filename, ref enc); helpAttributes = new MSHelpAttrCollection(); helpKeywords = new MSHelpKeywordCollection(); topicId = Guid.Empty; title = body = topicAbstract = null; revisionNumber = "1"; tocExclude = defaultTopic = splitToc = false; sortOrder = Int32.MaxValue; m = reTopicId.Match(content); if (m.Success) { Guid.TryParse(HttpUtility.HtmlDecode(m.Groups[1].Value), out topicId); } m = reRevisionNumber.Match(content); if (m.Success) { revisionNumber = HttpUtility.HtmlDecode(m.Groups[1].Value); } m = reTitle.Match(content); if (m.Success) { title = HttpUtility.HtmlDecode(m.Groups[1].Value); } tocExclude = reTocExclude.IsMatch(content); defaultTopic = reIsDefaultTopic.IsMatch(content); splitToc = reSplitToc.IsMatch(content); m = reSortOrder.Match(content); if (m.Success) { sortOrder = Convert.ToInt32(m.Groups["SortOrder"].Value, CultureInfo.InvariantCulture); } m = reBody.Match(content); if (m.Success) { body = m.Groups["Body"].Value; } foreach (Match attr in reMSHelpAttr.Matches(content)) { if (attr.Groups["Name"].Value == "Abstract") { topicAbstract = attr.Groups["Value"].Value; } else { helpAttributes.Add(attr.Groups["Name"].Value, attr.Groups["Value"].Value); } } foreach (Match keyword in reMSHelpKeyword.Matches(content)) { helpKeywords.Add(new MSHelpKeyword(keyword.Groups["Index"].Value, keyword.Groups["Term"].Value)); } }
//===================================================================== /// <summary> /// Parse the specified HTML file /// </summary> /// <param name="filename">The file to parse</param> /// <remarks>After parsing, the properties can be used to retrieve the information parsed from /// the file.</remarks> public void ParseFile(string filename) { Match m; Encoding enc = Encoding.Default; string content = ReadWithEncoding(filename, ref enc); helpAttributes = new MSHelpAttrCollection(); helpKeywords = new MSHelpKeywordCollection(); topicId = Guid.Empty; title = body = topicAbstract = null; revisionNumber = "1"; tocExclude = defaultTopic = splitToc = false; sortOrder = Int32.MaxValue; m = reTopicId.Match(content); if(m.Success) Guid.TryParse(HttpUtility.HtmlDecode(m.Groups[1].Value), out topicId); m = reRevisionNumber.Match(content); if(m.Success) revisionNumber = HttpUtility.HtmlDecode(m.Groups[1].Value); m = reTitle.Match(content); if(m.Success) title = HttpUtility.HtmlDecode(m.Groups[1].Value); tocExclude = reTocExclude.IsMatch(content); defaultTopic = reIsDefaultTopic.IsMatch(content); splitToc = reSplitToc.IsMatch(content); m = reSortOrder.Match(content); if(m.Success) sortOrder = Convert.ToInt32(m.Groups["SortOrder"].Value, CultureInfo.InvariantCulture); m = reBody.Match(content); if(m.Success) body = m.Groups["Body"].Value; foreach(Match attr in reMSHelpAttr.Matches(content)) if(attr.Groups["Name"].Value == "Abstract") topicAbstract = attr.Groups["Value"].Value; else helpAttributes.Add(attr.Groups["Name"].Value, attr.Groups["Value"].Value); foreach(Match keyword in reMSHelpKeyword.Matches(content)) helpKeywords.Add(new MSHelpKeyword(keyword.Groups["Index"].Value, keyword.Groups["Term"].Value)); }