private void EhLinkClicked(object sender, LinkClickedEventArgs e) { try { System.Diagnostics.Process.Start(e.LinkText); } catch { string friendlyText = e.LinkText; var list1 = XMLBible.ParseStringToVerse(friendlyText); if (list1.Count > 0) { XMLBible.BCVSTRUCT start = new XMLBible.BCVSTRUCT(); XMLBible.BCVSTRUCT end = new XMLBible.BCVSTRUCT(); var bcv = list1[0].bcv; if (XMLBible.ParseForBCVStructs(bcv, ref start, ref end) != "NOT_A_VERSE") { string szHeader = e.LinkText; List <string> listofTextToDisplay = new List <string>(); listofTextToDisplay = XMLBible.GetVerseText(ref start, ref end); TextCardHolder PopUp = new TextCardHolder(listofTextToDisplay.ToArray(), szHeader); } } } }
public static void ConvertOldFormat1(string existingRtf, RichTextBoxEx rtb) { var textMatches1 = Regex.Matches(existingRtf, @"\d?[a-zA-Z]{1,3}\.\d{1,3}\.\d{1,3}-\d?[a-zA-Z]{1,3}\.\d{1,3}\.\d{1,3}"); var textMatches2 = Regex.Matches(existingRtf, @"\d?[a-zA-Z]{1,3}\.\d{1,3}\.\d{1,3}"); int arraySize = textMatches1.Count + textMatches2.Count; Match[] matches = new Match[arraySize]; textMatches1.CopyTo(matches, 0); textMatches2.CopyTo(matches, textMatches1.Count); if (matches.Length > 0) { foreach (Match match in matches) { string oldVerseText = match.Value.Trim(); XMLBible.BCVSTRUCT start, end; start = new XMLBible.BCVSTRUCT(); end = new XMLBible.BCVSTRUCT(); XMLBible.ParseForBCVStructs(oldVerseText, ref start, ref end); if (!string.IsNullOrEmpty(start.Book) && XMLBible.ConfirmBookNameExists(start.Book) && int.Parse(start.Chapter) <= XMLBible.ChapterCount(start.Book) && int.Parse(start.Verse) <= XMLBible.VerseCount(start.Book, start.Chapter)) { string newVerseText = string.Empty; if (string.IsNullOrEmpty(end.Book)) { newVerseText = XMLBible.GetBookName_abbr(start.Book) + " " + start.Chapter + ":" + start.Verse; } else { if (XMLBible.ConfirmBookNameExists(end.Book) && int.Parse(end.Chapter) <= XMLBible.ChapterCount(end.Book) && int.Parse(end.Verse) <= XMLBible.VerseCount(end.Book, end.Chapter)) { if (start.Verse == "1" && end.Verse == XMLBible.VerseCount(end.Book, end.Chapter).ToString()) { newVerseText = XMLBible.GetBookName_short(start.Book) + " " + start.Chapter; } else { newVerseText = XMLBible.GetBookName_abbr(start.Book) + " " + start.Chapter + ":" + start.Verse + "-" + end.Verse; } } } if (!string.IsNullOrEmpty(newVerseText)) { d_ReplaceOldVerseText myDelegate = new d_ReplaceOldVerseText(InvokeReplaceOldVerseText); rtb.Invoke(myDelegate, oldVerseText, newVerseText, rtb); } } } } }