");
+ MatchCollection matches = regex.Matches(osisDoc);
+ if (matches.Count > 0)
+ {
+ string book = "header";
+ int start = 0;
+
+ foreach (Match match in matches)
+ {
+ int offset = match.Index;
+ try
+ {
+ osisDocSegments.Add(book, osisDoc.Substring(start, offset - start));
+ }
+ catch (Exception ex)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
+ throw;
+ }
+
+ start = offset;
+ book = match.Groups[1].Value;
+ }
+ osisDocSegments.Add(book, osisDoc.Substring(start));
+ break;
+ }
+ else
+ {
+ throw new Exception("Could not identify any book in the document");
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
+ throw;
+ }
+ }
+
+ #endregion OSIS Top Version
+
+
+
}
}
diff --git a/src/BibleTaggingUtil/BibleVersions/ReferenceVersionKJV.cs b/src/BibleTaggingUtil/BibleVersions/ReferenceTopVersion.cs
similarity index 80%
rename from src/BibleTaggingUtil/BibleVersions/ReferenceVersionKJV.cs
rename to src/BibleTaggingUtil/BibleVersions/ReferenceTopVersion.cs
index dcd4a83..cf76ad9 100644
--- a/src/BibleTaggingUtil/BibleVersions/ReferenceVersionKJV.cs
+++ b/src/BibleTaggingUtil/BibleVersions/ReferenceTopVersion.cs
@@ -8,9 +8,9 @@
namespace BibleTaggingUtil.BibleVersions
{
- public class ReferenceVersionKJV : BibleVersion
+ public class ReferenceTopVersion : BibleVersion
{
- public ReferenceVersionKJV(BibleTaggingForm container) : base(container, 23145 + 7957) { }
+ public ReferenceTopVersion(BibleTaggingForm container) : base(container, 23145 + 7957) { }
public void Load()
{
@@ -34,7 +34,9 @@ public void Load()
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
}
diff --git a/src/BibleTaggingUtil/BibleVersions/ReferenceVersionTAGNT.cs b/src/BibleTaggingUtil/BibleVersions/ReferenceVersionTAGNT.cs
index 0259aea..e04714f 100644
--- a/src/BibleTaggingUtil/BibleVersions/ReferenceVersionTAGNT.cs
+++ b/src/BibleTaggingUtil/BibleVersions/ReferenceVersionTAGNT.cs
@@ -194,7 +194,9 @@ override protected void ParseLine(string line)
}
catch(Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
}
}
diff --git a/src/BibleTaggingUtil/BibleVersions/ReferenceVersionTOTHT.cs b/src/BibleTaggingUtil/BibleVersions/ReferenceVersionTOTHT.cs
index 539f6d5..b556f11 100644
--- a/src/BibleTaggingUtil/BibleVersions/ReferenceVersionTOTHT.cs
+++ b/src/BibleTaggingUtil/BibleVersions/ReferenceVersionTOTHT.cs
@@ -76,7 +76,9 @@ private void SaveUpdates()
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
@@ -263,7 +265,9 @@ override protected void ParseLine(string wordLine)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
}
@@ -381,7 +385,9 @@ protected void ParseLine2(string wordLine)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
}
@@ -509,7 +515,9 @@ protected void ParseLine3(string wordLine)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
}
diff --git a/src/BibleTaggingUtil/BibleVersions/TargetOsisVersion.cs b/src/BibleTaggingUtil/BibleVersions/TargetOsisVersion.cs
new file mode 100644
index 0000000..0a2941d
--- /dev/null
+++ b/src/BibleTaggingUtil/BibleVersions/TargetOsisVersion.cs
@@ -0,0 +1,652 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Net.Http;
+using System.Reflection;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Xml;
+
+using BibleTaggingUtil.OsisXml;
+
+namespace BibleTaggingUtil.BibleVersions
+{
+ ///
+ /// 1. Read all the contents of the OSIS xml as a string
+ /// 2. Use regex to get offset of each book and create a book/offset map
+ /// 3. GetVerse() takes a verse reference (e.g. Rev.19.14) and uses regex to find the offset and size
+ /// of the verse. (regex starts its search from the offset found in the offsets map)
+ /// 4. ParseVerse() takes the verse text enclosed between sID and eID and loads it into a XmlDocument.
+ /// This is because the verse content is well formed xml. This makes it easy to extract the verse's
+ /// words and Strong's tags.
+ /// 5. Once the tags has been update, the verse is reconstructed and is replaced in the text
+ /// 6. Finally the text is saved.
+ ///
+ public class TargetOsisVersion : BibleVersion
+ {
+ ///
+ /// The complete OSIS XML file is read into this string
+ ///
+ private string osisDoc = string.Empty;
+
+ ///
+ /// key: book name
+ /// value: osis segment representing this book
+ /// the first segment is the osis header
+ ///
+ private Dictionary
osisDocSegments = new Dictionary();
+
+ ///
+ /// Key: book name
+ /// Value: Dictionary with:
+ /// Key: verse reference
+ /// value: Verse
+ ///
+ private Dictionary> bookTemp = new Dictionary>();
+
+ ///
+ /// Key: Verse reference in the format Gen 1:1
+ /// value: The parsed OSIS content of the verse
+ private Dictionary osisBible = new Dictionary();
+
+ public TargetOsisVersion(BibleTaggingForm container) : base(container, 31104) { }
+
+
+ protected override bool LoadBibleFileInternal(string textFilePath, bool more)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceEntry(name, textFilePath, more);
+
+ bool result = false;
+ if (File.Exists(textFilePath))
+ {
+ try
+ {
+ //ThreadPool.SetMinThreads(8, 8);
+
+ var stopwatch = new Stopwatch();
+ stopwatch.Start();
+ LoadT(textFilePath);
+ stopwatch.Stop();
+ long elapsed_time = stopwatch.ElapsedMilliseconds;
+
+ foreach (OsisVerse osisVerse in osisBible.Values)
+ {
+ Verse verseWords = osisVerse.GetVerseWords();
+ bible.Add(osisVerse.VerseRefX, verseWords);
+ }
+
+
+ //bookNamesList = bookOffsets.Keys.ToList();
+ bookNamesList = new List();
+ bookNamesList.AddRange(osisDocSegments.Keys.Skip(1));
+
+ if (bookNamesList.Count == 66 || bookNamesList.Count == 39)
+ {
+ for (int i = 0; i < bookNamesList.Count; i++)
+ {
+ bookNames.Add(Constants.ubsNames[i], bookNamesList[i]);
+ }
+ }
+ else if (bookNamesList.Count == 27)
+ {
+ for (int i = 0; i < bookNamesList.Count; i++)
+ {
+ bookNames.Add(Constants.ubsNames[i + 39], bookNamesList[i]);
+ }
+ }
+
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ Tracing.TraceException(name, ex.Message);
+ throw;
+ }
+ }
+ return result;
+ }
+ ///
+ ///
+ ///
+ ///
+ private void Load(string fileName)
+ {
+ // Read the complete OSIS XML file
+ //osisDoc = File.ReadAllText(fileName);
+ using(StreamReader sr = new StreamReader(fileName))
+ {
+ osisDoc = sr.ReadToEnd();
+ }
+
+ // Build the book's offsets map
+ // BuildBookOffsets();
+ BuildOsisSegments();
+
+ // Create an OSIS Bible Map
+ //foreach (string book in bookOffsets.Keys)
+ foreach (string book in osisDocSegments.Keys)
+ {
+ Regex regex = new Regex(
+ string.Format(@"", book));
+
+// MatchCollection VerseMatches = regex.Matches(osisDoc, bookOffsets[book]);
+ MatchCollection VerseMatches = regex.Matches(osisDocSegments[book]);
+ if (VerseMatches.Count > 0)
+ {
+ foreach (Match VerseMatch in VerseMatches)
+ {
+ OsisVerse? osisVerse = OsisUtils.Instance.GetVersesTags(book, osisDocSegments[book], VerseMatch);
+ if (osisVerse != null)
+ {
+ osisBible.Add(osisVerse.VerseRefX, osisVerse);
+ //Verse verseWords = osisVerse.GetVerseWords();
+ //bible.Add(osisVerse.VerseRefX, verseWords);
+ }
+ }
+ }
+ }
+ }
+
+ private void LoadT(string fileName)
+ {
+ try
+ {
+ // Read the complete OSIS XML file
+ //osisDoc = File.ReadAllText(fileName);
+ using (StreamReader sr = new StreamReader(fileName))
+ {
+ osisDoc = sr.ReadToEnd();
+ }
+
+ // Build the book's offsets map
+ //BuildBookOffsets();
+ BuildOsisSegments();
+
+ bookCount = 0;
+ container.UpdateProgress("Loading " + bibleName, (100 * bookCount) / 66);
+ // Create an OSIS Bible Map
+ //foreach (string book in bookOffsets.Keys)
+ //{
+ // //new Thread(() => { LoadBook(book); }).Start();
+ // ThreadPool.QueueUserWorkItem(LoadBook, book);
+ //}
+ //while (bookCount < bookOffsets.Keys.Count) ;
+
+ foreach (string book in osisDocSegments.Keys.Skip(1))
+ {
+ //new Thread(() => { LoadBook(book); }).Start();
+ ThreadPool.QueueUserWorkItem(LoadBookFromSegments, book);
+ }
+ while (bookCount < osisDocSegments.Keys.Count-1) ;
+
+ foreach(string book in osisDocSegments.Keys.Skip(1))
+ {
+ osisBible = osisBible.Concat(bookTemp[book]).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
+ }
+ }
+ catch(Exception ex)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
+ throw;
+ }
+ }
+
+ object lockingObject = new object();
+ int bookCount = 0;
+ private void BookLoaded(string book, Dictionary localBible)
+ {
+ lock (lockingObject)
+ {
+ bookCount++;
+ container.UpdateProgress("Loading " + bibleName, (100 * bookCount) / 66);
+ bookTemp[book] = localBible;
+ }
+ }
+ //private void LoadBook(Object threadContext) //string book)
+ //{
+ // string book = (string)threadContext;
+
+ // Dictionary localBible = new Dictionary();
+ // try
+ // {
+ // Regex regex = new Regex(
+ // string.Format(@"", book));
+
+ // MatchCollection VerseMatches = regex.Matches(osisDoc, bookOffsets[book]);
+ // if (VerseMatches.Count > 0)
+ // {
+ // foreach (Match VerseMatch in VerseMatches)
+ // {
+ // OsisVerse? osisVerse = GetVersesTags(book, VerseMatch);
+ // if (osisVerse != null)
+ // {
+ // //lock (this)
+ // {
+ // localBible.Add(osisVerse.VerseRefX, osisVerse);
+ // }
+ // // Verse verseWords = osisVerse.GetVerseWords();
+ // // bible.Add(osisVerse.VerseRefX, verseWords);
+ // }
+ // }
+ // }
+ // }
+ // catch (Exception ex)
+ // {
+ // var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ // var name = cm.DeclaringType.FullName + "." + cm.Name;
+ // Tracing.TraceException(name, ex.Message);
+ // }
+ // finally
+ // {
+ // BookLoaded(book, localBible);
+ // }
+ //}
+ private void LoadBookFromSegments(Object threadContext) //string book)
+ {
+ string book = (string)threadContext;
+
+ Dictionary localBible = new Dictionary();
+ try
+ {
+ Regex regex = new Regex(
+ string.Format(@"", book));
+
+ MatchCollection VerseMatches = regex.Matches(osisDocSegments[book]);
+ if (VerseMatches.Count > 0)
+ {
+ foreach (Match VerseMatch in VerseMatches)
+ {
+ OsisVerse? osisVerse = OsisUtils.Instance.GetVersesTags(book, osisDocSegments[book], VerseMatch);
+ if (osisVerse != null)
+ {
+ //lock (this)
+ {
+ localBible.Add(osisVerse.VerseRefX, osisVerse);
+ }
+ // Verse verseWords = osisVerse.GetVerseWords();
+ // bible.Add(osisVerse.VerseRefX, verseWords);
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
+ throw;
+ }
+ finally
+ {
+ BookLoaded(book, localBible);
+ }
+ }
+
+
+ private OsisVerse? GetVersesTagsObsolete(string book, string osisSegment, Match VerseMatch)
+ {
+ OsisVerse result = null;
+
+ int startIndex = VerseMatch.Index + VerseMatch.Groups[0].Length;
+ string sID = VerseMatch.Groups[1].Value;
+ string eID = string.Empty;
+ string verseRef = string.Format("{0}.{1}.{2}", book, VerseMatch.Groups[2].Value, VerseMatch.Groups[3].Value);
+ string verseXML = string.Empty;
+ int endIndex = 0;
+
+ if (verseRef == "Gen.2.7")
+ {
+ int x = 0;
+ }
+
+ try
+ {
+ Regex regex = new Regex(string.Format(@"", sID));
+// VerseMatch = regex.Match(osisDoc, startIndex);
+ VerseMatch = regex.Match(osisSegment, startIndex);
+ if (VerseMatch.Success)
+ {
+ endIndex = VerseMatch.Index;
+ eID = VerseMatch.Groups[1].Value;
+ }
+
+ string verseXml = string.Empty;
+ if (endIndex > startIndex)
+ verseXml = osisSegment.Substring(startIndex, endIndex - startIndex);
+ // verseXml = osisDoc.Substring(startIndex, endIndex - startIndex);
+
+ result = new OsisVerse(verseRef, startIndex, sID, verseXml, eID);
+ }
+ catch (Exception ex)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
+ throw;
+ }
+
+ return result;
+ }
+
+ internal OsisVerse GetVerse(string verseRef)
+ {
+ OsisVerse verseXML = null;
+
+ //string verse = @"Then God said, ch. 3:22; 11:7; Isa. 6:8Let us make manThe Hebrew word for man (adam) is the generic term for mankind and becomes the proper name Adam in our image, ch. 5:1; 9:6; 1 Cor. 11:7; Eph. 4:24; Col. 3:10; James 3:9after our likeness. And ch. 9:2; Ps. 8:6-8; James 3:7let them have dominion over the fish of the sea and over the birds of the heavens and over the livestock and over all the earth and over every creeping thing that creeps on the earth.";
+ verseRef = "Rev.19.14";
+
+ int bookStart = -1;
+ string book = string.Empty;
+ Match m = Regex.Match(verseRef, @"([1-9A-Za-z]*)\.(\d{1,3})\.(\d{1,3})");
+ if (m != null)
+ {
+ book = m.Groups[1].Value;
+ string chapter = m.Groups[2].Value;
+ string verse = m.Groups[3].Value;
+
+ //bookStart = bookOffsets[book];
+ }
+
+
+ string pattern1 = string.Format(
+ @"", verseRef);
+
+ var regex = new Regex(pattern1);
+ int startIndex = 0;
+ int endIndex = 0;
+ string sID = string.Empty;
+ string eID = string.Empty;
+
+ //Match match = regex.Match(osisDoc, bookStart);
+ Match match = regex.Match(osisDocSegments[book]);
+ if (match.Success)
+ {
+ startIndex = match.Index + match.Groups[0].Length;
+ sID = match.Groups[1].Value;
+ }
+
+ string pattern2 = string.Format(
+ @"", sID);
+ regex = new Regex(pattern2);
+ //match = regex.Match(osisDoc, startIndex);
+ match = regex.Match(osisDocSegments[book]);
+ if (match.Success)
+ {
+ endIndex = match.Index;
+ eID = match.Groups[1].Value;
+ }
+
+ string osisVerse = string.Empty;
+ if (endIndex > startIndex)
+ {
+ //osisVerse = osisDoc.Substring(startIndex, endIndex - startIndex);
+ osisVerse = osisDocSegments[book].Substring(startIndex, endIndex - startIndex);
+ verseXML = new OsisVerse(verseRef, osisVerse.Length, sID, osisVerse, eID);
+ }
+
+ return verseXML;
+ }
+
+ private void ParseVerse(string verse)
+ {
+ //string verse = @"And the armies of heaven, ch. 3:4; 7:9arrayed in fine linen, white and pure, [ch. 14:20]were following him on white horses.";
+ string header = @"";
+ string trailer = @"";
+
+ string verseXML = header + verse + trailer;
+
+ XmlDocument document = new XmlDocument();
+ document.LoadXml(verseXML);
+ //XPathNavigator? nav = document.CreateNavigator();
+
+ XmlElement root = document.DocumentElement;
+ foreach (XmlNode node in root.ChildNodes)
+ {
+ string name = node.Name;
+ List strongs = new List();
+ if (name == "#text")
+ {
+ string word = node.InnerText;
+ }
+ else if (name == "w")
+ {
+ string word = node.InnerText;
+ XmlAttributeCollection? attrib = node.Attributes;
+ if (attrib != null)
+ {
+ foreach (XmlAttribute attr in attrib)
+ {
+ if (attr.Name == "lemma")
+ {
+ strongs = OsisUtils.Instance.GetStrongsFromLemma(attr.Value);
+ }
+ }
+ }
+
+ }
+
+ }
+ }
+
+ internal void Save(string fileName)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ try
+ {
+ Tracing.TraceEntry(name);
+ lock (this)
+ {
+ if (!container.EditorPanel.TargetDirty)
+ return;
+
+ container.WaitCursorControl(true);
+ container.EditorPanel.TargetDirty = false;
+ container.EditorPanel.SaveCurrentVerse();
+
+ // 1.Update osisBible' dirty fkag from Bible
+ foreach (string verseRef in Bible.Keys)
+ {
+ Verse v = Bible[verseRef];
+ if (v.Dirty)
+ {
+ //osisBible[verseRef].UpdateVerse(v);
+ osisBible[verseRef].Dirty = true;
+ }
+ }
+
+ // 2. Update osisDoc from osisBible
+ foreach (OsisVerse osisVerse in osisBible.Values)
+ {
+ if (osisVerse.Dirty)
+ {
+ osisDocSegments[osisVerse.Book] = osisDocSegments[osisVerse.Book]
+ .Remove(osisVerse.StartIndex, osisVerse.Length)
+ .Insert(osisVerse.StartIndex, osisVerse.VerseCompleteXml);
+
+ int diff = osisVerse.VerseCompleteXml.Length - osisVerse.Length;
+ if (diff != 0)
+ {
+ osisVerse.UpdateVerseXml(osisVerse.VerseCompleteXml);
+ UpdateIndices(osisVerse.Book);
+ }
+ }
+ }
+
+ // rebuild Document
+ osisDoc = string.Empty;
+ foreach(string seg in osisDocSegments.Values)
+ {
+ osisDoc += seg;
+ }
+
+ // construce Updates fileName
+ string taggedFolder = Path.GetDirectoryName(container.Config.TaggedBible);
+ string oldTaggedFolder = Path.Combine(taggedFolder, "OldTagged");
+ if (!Directory.Exists(oldTaggedFolder))
+ Directory.CreateDirectory(oldTaggedFolder);
+
+ // move existing tagged files to the old folder
+ String[] existingTagged = Directory.GetFiles(taggedFolder, "*.*");
+ foreach (String existingTaggedItem in existingTagged)
+ {
+ string fName = Path.GetFileName(existingTaggedItem);
+ string src = Path.Combine(taggedFolder, fName);
+ string dst = Path.Combine(oldTaggedFolder, fName);
+ if (System.IO.File.Exists(dst))
+ System.IO.File.Delete(src);
+ else
+ System.IO.File.Move(src, dst);
+ }
+
+ string baseName = Path.GetFileNameWithoutExtension(container.Config.TaggedBible);
+ string updatesFileName = string.Format("{0:s}_{1:s}.xml", baseName, DateTime.Now.ToString("yyyy_MM_dd_HH_mm"));
+
+ File.WriteAllText(Path.Combine(taggedFolder, updatesFileName), osisDoc);
+ }
+ }
+ catch (Exception ex)
+ {
+ Tracing.TraceException(name, ex.Message);
+ throw;
+ }
+ container.WaitCursorControl(false);
+ }
+
+ private void UpdateIndices(string book)
+ {
+ try
+ {
+ Regex regex = new Regex(
+ string.Format(@"", book));
+
+ MatchCollection VerseMatches = regex.Matches(osisDocSegments[book]);
+ if (VerseMatches.Count > 0)
+ {
+ foreach (Match VerseMatch in VerseMatches)
+ {
+ int startIndex = VerseMatch.Index + VerseMatch.Groups[0].Length;
+ string verseRefX = string.Format("{0} {1}:{2}", book, VerseMatch.Groups[2].Value, VerseMatch.Groups[3].Value);
+
+ OsisVerse? osisVerse = osisBible[verseRefX];
+ osisVerse.UpdateVerseStartIndex(startIndex);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
+ throw;
+ }
+ }
+
+ //private void UpdateBook(Object threadContext) //string book)
+ //{
+ // string book = (string)threadContext;
+
+ // try
+ // {
+ // Regex regex = new Regex(
+ // string.Format(@"", book));
+
+ // MatchCollection VerseMatches = regex.Matches(osisDocSegments[book]);
+ // if (VerseMatches.Count > 0)
+ // {
+ // foreach (Match VerseMatch in VerseMatches)
+ // {
+ // int startIndex = VerseMatch.Index + VerseMatch.Groups[0].Length;
+ // string verseRefX = string.Format("{0} {1}:{2}", book, VerseMatch.Groups[2].Value, VerseMatch.Groups[3].Value);
+
+ // OsisVerse? osisVerse = osisBible[verseRefX];
+ // osisVerse.UpdateVerseStartIndex(startIndex);
+ // }
+ // }
+ // }
+ // catch (Exception ex)
+ // {
+ // var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ // var name = cm.DeclaringType.FullName + "." + cm.Name;
+ // Tracing.TraceException(name, ex.Message);
+ // }
+ // finally
+ // {
+ // BookUpdated();
+ // }
+ //}
+
+
+ //private void BuildBookOffsets()
+ //{
+ // bookOffsets.Clear();
+ // while (true)
+ // {
+ // //
+ // Regex regex = new Regex(@"
");
+ // MatchCollection matches = regex.Matches(osisDoc);
+ // if (matches.Count > 0)
+ // {
+ // foreach (Match match in matches)
+ // {
+ // int offset = match.Index;
+ // string book = match.Groups[1].Value;
+ // bookOffsets[book] = offset;
+ // bookTemp[book] = null;
+ // }
+ // break;
+ // }
+ // }
+ //}
+ private void BuildOsisSegments()
+ {
+ osisDocSegments.Clear();
+ while (true)
+ {
+ //
+ Regex regex = new Regex(@"
");
+ MatchCollection matches = regex.Matches(osisDoc);
+ if (matches.Count > 0)
+ {
+ string book = "header";
+ int start = 0;
+
+ foreach (Match match in matches)
+ {
+ int offset = match.Index;
+ try
+ {
+ osisDocSegments.Add(book, osisDoc.Substring(start, offset-start));
+ }
+ catch (Exception ex)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
+ throw;
+ }
+
+ start = offset;
+ book = match.Groups[1].Value;
+ }
+ osisDocSegments.Add(book, osisDoc.Substring(start));
+ break;
+ }
+ else
+ {
+ throw new Exception("Could not identify any book in the document");
+ }
+ }
+ }
+
+ }
+}
diff --git a/src/BibleTaggingUtil/BibleVersions/TargetVersion.cs b/src/BibleTaggingUtil/BibleVersions/TargetVersion.cs
index 84fea9a..e96253c 100644
--- a/src/BibleTaggingUtil/BibleVersions/TargetVersion.cs
+++ b/src/BibleTaggingUtil/BibleVersions/TargetVersion.cs
@@ -82,7 +82,9 @@ public void SaveUpdates()
}
catch(Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
container.WaitCursorControl(false);
diff --git a/src/BibleTaggingUtil/CofigurationHolder.cs b/src/BibleTaggingUtil/CofigurationHolder.cs
index cc22bab..8518216 100644
--- a/src/BibleTaggingUtil/CofigurationHolder.cs
+++ b/src/BibleTaggingUtil/CofigurationHolder.cs
@@ -45,6 +45,7 @@ public string ReadBiblesConfig(string biblesFolder)
ParseState state = ParseState.NONE;
using (StreamReader sr = new StreamReader(configFilePath))
{
+ bool osis = false;
while (sr.Peek() >= 0)
{
string line = sr.ReadLine().Trim();
@@ -88,6 +89,9 @@ public string ReadBiblesConfig(string biblesFolder)
case "kjv":
KJV = Path.Combine(biblesFolder, parts[1].Trim());
break;
+ case "topreferenceversion":
+ TopReferenceVersion = parts[1].Trim();
+ break;
case "hebrewreferences":
{
string[] hebParts = parts[1].Split(',');
@@ -109,6 +113,9 @@ public string ReadBiblesConfig(string biblesFolder)
case "targettextdirection":
Properties.Settings.Default.TargetTextDirection = parts[1].Trim();
break;
+ case "osis":
+ if(parts[1].Trim().ToLower() == "true") osis = true;
+ break;
}
}
@@ -131,12 +138,15 @@ public string ReadBiblesConfig(string biblesFolder)
}
}
+
+ Properties.Settings.Default.Osis = osis;
}
return string.Empty;
}
public string UnTaggedBible { get; private set; }
public string TaggedBible { get; private set; }
+ public string TopReferenceVersion { get; private set; }
public string KJV { get; private set; }
public List
HebrewReferences { get; private set; }
diff --git a/src/BibleTaggingUtil/Editor/EditorPanel.Designer.cs b/src/BibleTaggingUtil/Editor/EditorPanel.Designer.cs
index ed044a8..184a284 100644
--- a/src/BibleTaggingUtil/Editor/EditorPanel.Designer.cs
+++ b/src/BibleTaggingUtil/Editor/EditorPanel.Designer.cs
@@ -48,8 +48,8 @@ private void InitializeComponent()
cbTagToFind = new System.Windows.Forms.ComboBox();
tbCurrentReference = new System.Windows.Forms.TextBox();
splitContainerMainEditor = new System.Windows.Forms.SplitContainer();
- dgvKJV = new KJVGridView();
- tbKJV = new System.Windows.Forms.TextBox();
+ dgvTopVersion = new TopVersionGridView();
+ tbTopVersion = new System.Windows.Forms.TextBox();
splitContainer1 = new System.Windows.Forms.SplitContainer();
dgvTOTHT = new TOHTHGridView();
tbTH = new System.Windows.Forms.TextBox();
@@ -72,7 +72,7 @@ private void InitializeComponent()
splitContainerMainEditor.Panel1.SuspendLayout();
splitContainerMainEditor.Panel2.SuspendLayout();
splitContainerMainEditor.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)dgvKJV).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)dgvTopVersion).BeginInit();
((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit();
splitContainer1.Panel1.SuspendLayout();
splitContainer1.Panel2.SuspendLayout();
@@ -255,8 +255,8 @@ private void InitializeComponent()
//
// splitContainerMainEditor.Panel1
//
- splitContainerMainEditor.Panel1.Controls.Add(dgvKJV);
- splitContainerMainEditor.Panel1.Controls.Add(tbKJV);
+ splitContainerMainEditor.Panel1.Controls.Add(dgvTopVersion);
+ splitContainerMainEditor.Panel1.Controls.Add(tbTopVersion);
//
// splitContainerMainEditor.Panel2
//
@@ -265,16 +265,16 @@ private void InitializeComponent()
splitContainerMainEditor.SplitterDistance = 266;
splitContainerMainEditor.TabIndex = 4;
//
- // dgvKJV
+ // dgvTopVersion
//
- dgvKJV.AllowDrop = true;
- dgvKJV.AllowUserToAddRows = false;
- dgvKJV.AllowUserToDeleteRows = false;
- dgvKJV.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
- dgvKJV.BackgroundColor = System.Drawing.SystemColors.ControlLight;
- dgvKJV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- dgvKJV.ColumnHeadersVisible = false;
- dgvKJV.Cursor = System.Windows.Forms.Cursors.Hand;
+ dgvTopVersion.AllowDrop = true;
+ dgvTopVersion.AllowUserToAddRows = false;
+ dgvTopVersion.AllowUserToDeleteRows = false;
+ dgvTopVersion.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
+ dgvTopVersion.BackgroundColor = System.Drawing.SystemColors.ControlLight;
+ dgvTopVersion.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dgvTopVersion.ColumnHeadersVisible = false;
+ dgvTopVersion.Cursor = System.Windows.Forms.Cursors.Hand;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
@@ -282,33 +282,33 @@ private void InitializeComponent()
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
- dgvKJV.DefaultCellStyle = dataGridViewCellStyle1;
- dgvKJV.Dock = System.Windows.Forms.DockStyle.Fill;
- dgvKJV.GridColor = System.Drawing.SystemColors.ControlText;
- dgvKJV.Location = new System.Drawing.Point(0, 31);
- dgvKJV.Name = "dgvKJV";
- dgvKJV.ReadOnly = true;
- dgvKJV.RowHeadersVisible = false;
- dgvKJV.RowHeadersWidth = 51;
- dgvKJV.RowTemplate.Height = 29;
- dgvKJV.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
- dgvKJV.ShowCellToolTips = false;
- dgvKJV.Size = new System.Drawing.Size(1299, 235);
- dgvKJV.TabIndex = 4;
- //
- // tbKJV
- //
- tbKJV.BackColor = System.Drawing.SystemColors.MenuHighlight;
- tbKJV.Dock = System.Windows.Forms.DockStyle.Top;
- tbKJV.Font = new System.Drawing.Font("Segoe UI", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
- tbKJV.ForeColor = System.Drawing.SystemColors.HighlightText;
- tbKJV.Location = new System.Drawing.Point(0, 0);
- tbKJV.Name = "tbKJV";
- tbKJV.ReadOnly = true;
- tbKJV.Size = new System.Drawing.Size(1299, 31);
- tbKJV.TabIndex = 3;
- tbKJV.Text = "KJV";
- tbKJV.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ dgvTopVersion.DefaultCellStyle = dataGridViewCellStyle1;
+ dgvTopVersion.Dock = System.Windows.Forms.DockStyle.Fill;
+ dgvTopVersion.GridColor = System.Drawing.SystemColors.ControlText;
+ dgvTopVersion.Location = new System.Drawing.Point(0, 31);
+ dgvTopVersion.Name = "dgvTopVersion";
+ dgvTopVersion.ReadOnly = true;
+ dgvTopVersion.RowHeadersVisible = false;
+ dgvTopVersion.RowHeadersWidth = 51;
+ dgvTopVersion.RowTemplate.Height = 29;
+ dgvTopVersion.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
+ dgvTopVersion.ShowCellToolTips = false;
+ dgvTopVersion.Size = new System.Drawing.Size(1299, 235);
+ dgvTopVersion.TabIndex = 4;
+ //
+ // tbTopVersion
+ //
+ tbTopVersion.BackColor = System.Drawing.SystemColors.MenuHighlight;
+ tbTopVersion.Dock = System.Windows.Forms.DockStyle.Top;
+ tbTopVersion.Font = new System.Drawing.Font("Segoe UI", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ tbTopVersion.ForeColor = System.Drawing.SystemColors.HighlightText;
+ tbTopVersion.Location = new System.Drawing.Point(0, 0);
+ tbTopVersion.Name = "tbTopVersion";
+ tbTopVersion.ReadOnly = true;
+ tbTopVersion.Size = new System.Drawing.Size(1299, 31);
+ tbTopVersion.TabIndex = 3;
+ //tbTopVersion.Text = "KJV";
+ tbTopVersion.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// splitContainer1
//
@@ -451,7 +451,7 @@ private void InitializeComponent()
splitContainerMainEditor.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)splitContainerMainEditor).EndInit();
splitContainerMainEditor.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)dgvKJV).EndInit();
+ ((System.ComponentModel.ISupportInitialize)dgvTopVersion).EndInit();
splitContainer1.Panel1.ResumeLayout(false);
splitContainer1.Panel1.PerformLayout();
splitContainer1.Panel2.ResumeLayout(false);
@@ -471,7 +471,7 @@ private void InitializeComponent()
private System.Windows.Forms.SplitContainer splitContainerMainEditor;
private System.Windows.Forms.SplitContainer splitContainer1;
private TargetGridView dgvTarget;
- private KJVGridView dgvKJV;
+ private TopVersionGridView dgvTopVersion;
private TOHTHGridView dgvTOTHT;
private System.Windows.Forms.ComboBox cbTagToFind;
private System.Windows.Forms.PictureBox picNextVerse;
@@ -483,7 +483,7 @@ private void InitializeComponent()
private System.Windows.Forms.PictureBox picFindTagForward;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.PictureBox picRedo;
- private System.Windows.Forms.TextBox tbKJV;
+ private System.Windows.Forms.TextBox tbTopVersion;
private System.Windows.Forms.TextBox tbTH;
private System.Windows.Forms.TextBox tbTarget;
private System.Windows.Forms.PictureBox picRefresh;
diff --git a/src/BibleTaggingUtil/Editor/EditorPanel.cs b/src/BibleTaggingUtil/Editor/EditorPanel.cs
index 590c69e..02415a9 100644
--- a/src/BibleTaggingUtil/Editor/EditorPanel.cs
+++ b/src/BibleTaggingUtil/Editor/EditorPanel.cs
@@ -16,6 +16,7 @@
using BibleTaggingUtil.BibleVersions;
using System.Security.Cryptography.Xml;
using System.Reflection;
+using System.Xml.Linq;
namespace BibleTaggingUtil.Editor
{
@@ -32,6 +33,7 @@ public partial class EditorPanel : DockContent
private TestamentEnum testament = TestamentEnum.NEW;
private System.Timers.Timer tempTimer = null;
+ private bool osis = false;
public bool TargetDirty { get; set; }
@@ -42,6 +44,12 @@ public TargetVersion TargetVersion
set { dgvTarget.Bible = value; }
}
+ public TargetOsisVersion TargetOsisVersion
+ {
+ get { return dgvTarget.OsisBible; }
+ set { dgvTarget.OsisBible = value; }
+ }
+
class VerseDetails
{
public VerseDetails()
@@ -85,8 +93,8 @@ public EditorPanel(BibleTaggingForm container, BrowserPanel browser, VerseSelect
private void EditorPanel_Load(object sender, EventArgs e)
{
- int tbKJVHeight = tbKJV.Height;
- int dgvKJVHeight = dgvKJV.Height;
+ int tbTopVersionHeight = tbTopVersion.Height;
+ int dgvTopVersionHeight = dgvTopVersion.Height;
int tbTHHeight = tbTH.Height;
int dgvTOTHTHeight = dgvTOTHT.Height;
@@ -107,7 +115,7 @@ private void EditorPanel_Load(object sender, EventArgs e)
}
- dgvKJV.CellContentDoubleClick += Dgv_CellContentDoubleClick;
+ dgvTopVersion.CellContentDoubleClick += Dgv_CellContentDoubleClick;
dgvTarget.CellContentDoubleClick += Dgv_CellContentDoubleClick;
dgvTOTHT.CellContentDoubleClick += Dgv_CellContentDoubleClick;
//dgvTOTHT.CellContentDoubleClick += DgvTOTHTView_CellContentDoubleClick;
@@ -118,7 +126,7 @@ private void EditorPanel_Load(object sender, EventArgs e)
dgvTarget.KeyDown += DgvTarget_KeyDown;
dgvTarget.KeyUp += DgvTarget_KeyUp;
- dgvKJV.KeyUp += DgvTarget_KeyUp;
+ dgvTopVersion.KeyUp += DgvTarget_KeyUp;
dgvTOTHT.KeyUp += DgvTarget_KeyUp;
dgvTarget.SearchTag = cbTagToFind.Text;
@@ -148,8 +156,8 @@ public void ClearCurrentVerse()
tbCurrentReference.Text = string.Empty;
dgvTarget.Rows.Clear();
dgvTarget.ColumnCount = 0;
- dgvKJV.Rows.Clear();
- dgvKJV.ColumnCount = 0;
+ dgvTopVersion.Rows.Clear();
+ dgvTopVersion.ColumnCount = 0;
dgvTOTHT.Rows.Clear();
dgvTOTHT.ColumnCount = 0;
}
@@ -162,8 +170,18 @@ public void SaveCurrentVerse()
dgvTarget.SaveVerse(tbCurrentReference.Text);
}
}
+
+ private bool firstEvent = true;
private void Verse_VerseChanged(object sender, VerseChangedEventArgs e)
{
+ if (firstEvent)
+ {
+ firstEvent = false;
+ picEnableEdit.Hide();
+
+ }
+ osis = Properties.Settings.Default.Osis;
+
strongsPrefix = e.StrongsPrefix;
testament = e.Testament;
@@ -175,20 +193,22 @@ private void Verse_VerseChanged(object sender, VerseChangedEventArgs e)
string actualBookName = string.Empty;
try
{
- // KJV view
- actualBookName = container.KJV[bookName];
+ // Top Version view
+ actualBookName = container.TopVersion[bookName];
if (!string.IsNullOrEmpty(actualBookName))
{
string reference = e.VerseReference.Replace(bookName, actualBookName);
- if (container.KJV.Bible.ContainsKey(reference))
- dgvKJV.Update(container.KJV.Bible[reference]);
+ if (container.TopVersion.Bible.ContainsKey(reference))
+ dgvTopVersion.Update(container.TopVersion.Bible[reference]);
else
- dgvKJV.Update(null);
+ dgvTopVersion.Update(null);
}
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name + "-KJV", ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
Verse verseWords = null;
@@ -235,7 +255,9 @@ private void Verse_VerseChanged(object sender, VerseChangedEventArgs e)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name + "-TOTHT", ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
try
@@ -243,17 +265,23 @@ private void Verse_VerseChanged(object sender, VerseChangedEventArgs e)
// Target view
if (!string.IsNullOrEmpty(oldReference) && dgvTarget.Columns.Count > 0)
{
- dgvTarget.SaveVerse(oldReference);
+ if(osis)
+ {
+ // TODO handle osis save
+ }
+ else
+ dgvTarget.SaveVerse(oldReference);
}
- actualBookName = container.Target[bookName];
+
+ actualBookName = osis? container.OsisTarget[bookName] : container.Target[bookName];
if (!string.IsNullOrEmpty(actualBookName))
{
string reference = e.VerseReference.Replace(bookName, actualBookName);
//targetUpdatedVerse = Utils.GetVerseText(container.Target.Bible[targetRef], true);
if (tbTarget.Text.ToLower().Contains("arabic"))
DoSepecialHandling(reference);
- Verse v = container.Target.Bible[reference];
+ Verse v = osis? container.OsisTarget.Bible[reference]: container.Target.Bible[reference];
if (dgvTarget.IsCurrentTextAramaic)
{
@@ -292,7 +320,9 @@ private void Verse_VerseChanged(object sender, VerseChangedEventArgs e)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name + "-Target", ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
}
@@ -309,6 +339,8 @@ private void Verse_VerseChanged(object sender, VerseChangedEventArgs e)
///
private void DoSepecialHandling(string verseReference)
{
+ if (osis) return;
+
bool changed = false;
Verse v = container.Target.Bible[verseReference];
//List merges = new List();
@@ -510,13 +542,13 @@ private void SelectReferenceTags(string tag, bool firstHalf)
{
try
{
- dgvKJV.ClearSelection();
+ dgvTopVersion.ClearSelection();
dgvTOTHT.ClearSelection();
if (string.IsNullOrEmpty(tag))
{
SetHighlightedCell(dgvTOTHT, null, null, firstHalf);
- SetHighlightedCell(dgvKJV, null, null, firstHalf);
+ SetHighlightedCell(dgvTopVersion, null, null, firstHalf);
return;
}
@@ -532,12 +564,14 @@ private void SelectReferenceTags(string tag, bool firstHalf)
}
SetHighlightedCell(dgvTOTHT, tags1, tags2, firstHalf);
- SetHighlightedCell(dgvKJV, tags1, tags2, firstHalf);
+ SetHighlightedCell(dgvTopVersion, tags1, tags2, firstHalf);
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
}
}
@@ -630,7 +664,13 @@ private void DgvTarget_KeyUp(object sender, KeyEventArgs e)
}
else if (e.Control)
{
- if (e.KeyCode == Keys.S) container.Target.SaveUpdates();
+ if (e.KeyCode == Keys.S)
+ {
+ if (osis)
+ container.OsisTarget.Save("");
+ else
+ container.Target.SaveUpdates();
+ }
if (e.KeyCode == Keys.Y) dgvTarget.Redo();
if (e.KeyCode == Keys.Z) dgvTarget.Undo();
}
@@ -659,14 +699,17 @@ private void picUndo_Click(object sender, EventArgs e)
private void picSave_Click(object sender, EventArgs e)
{
- container.Target.SaveUpdates();
+ if (osis)
+ container.OsisTarget.Save("");
+ else
+ container.Target.SaveUpdates();
}
private void picDecreaseFont_Click(object sender, EventArgs e)
{
- Font font = dgvKJV.DefaultCellStyle.Font;
- dgvKJV.DefaultCellStyle.Font = new Font(font.Name, font.Size - 1);
- font = dgvKJV.DefaultCellStyle.Font;
+ Font font = dgvTopVersion.DefaultCellStyle.Font;
+ dgvTopVersion.DefaultCellStyle.Font = new Font(font.Name, font.Size - 1);
+ font = dgvTopVersion.DefaultCellStyle.Font;
dgvTarget.DefaultCellStyle.Font = new Font(font.Name, font.Size - 1);
font = dgvTOTHT.DefaultCellStyle.Font;
dgvTOTHT.DefaultCellStyle.Font = new Font(font.Name, font.Size - 1);
@@ -674,9 +717,9 @@ private void picDecreaseFont_Click(object sender, EventArgs e)
}
private void picIncreaseFont_Click(object sender, EventArgs e)
{
- Font font = dgvKJV.DefaultCellStyle.Font;
- dgvKJV.DefaultCellStyle.Font = new Font(font.Name, font.Size + 1);
- font = dgvKJV.DefaultCellStyle.Font;
+ Font font = dgvTopVersion.DefaultCellStyle.Font;
+ dgvTopVersion.DefaultCellStyle.Font = new Font(font.Name, font.Size + 1);
+ font = dgvTopVersion.DefaultCellStyle.Font;
dgvTarget.DefaultCellStyle.Font = new Font(font.Name, font.Size + 1);
font = dgvTOTHT.DefaultCellStyle.Font;
dgvTOTHT.DefaultCellStyle.Font = new Font(font.Name, font.Size + 1);
@@ -739,6 +782,19 @@ public void TargetBibleName(string name)
tbTarget.Text = name;
}
}
+
+ public void TopReferenceBibleName(string name)
+ {
+ if (InvokeRequired)
+ {
+ Action safeWrite = delegate { TopReferenceBibleName(name); };
+ Invoke(safeWrite);
+ }
+ else
+ {
+ tbTopVersion.Text = name;
+ }
+ }
private void cbTagToFind_SelectedIndexChanged(object sender, EventArgs e)
{
dgvTarget.SearchTag = cbTagToFind.Text;
@@ -751,10 +807,23 @@ private void picRefresh_Click(object sender, EventArgs e)
string reference = tbCurrentReference.Text;
dgvTarget.SaveVerse(reference);
- Verse v = container.Target.Bible[reference];
+ Verse v = osis? container.OsisTarget.Bible[reference] : container.Target.Bible[reference];
dgvTarget.Update(v);
dgvTarget.CurrentCell = dgvTarget[savedColumn, savedRow];
}
+
+ internal void EnableSaveButton(bool v)
+ {
+ if (InvokeRequired)
+ {
+ Invoke(new Action(() => { EnableSaveButton(v); }));
+ }
+ else
+ {
+ picSave.Visible = v;
+ }
+
+ }
}
}
diff --git a/src/BibleTaggingUtil/Editor/HebrewGreekGrid.cs b/src/BibleTaggingUtil/Editor/HebrewGreekGrid.cs
index 62cd474..dd068e4 100644
--- a/src/BibleTaggingUtil/Editor/HebrewGreekGrid.cs
+++ b/src/BibleTaggingUtil/Editor/HebrewGreekGrid.cs
@@ -170,7 +170,9 @@ private void UpdateOT(Verse verseWords)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
this.ClearSelection();
@@ -219,7 +221,9 @@ private void UpdateNT(Verse verseWords)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
}
diff --git a/src/BibleTaggingUtil/Editor/OsisTargetGridView.cs b/src/BibleTaggingUtil/Editor/OsisTargetGridView.cs
new file mode 100644
index 0000000..2affeb9
--- /dev/null
+++ b/src/BibleTaggingUtil/Editor/OsisTargetGridView.cs
@@ -0,0 +1,787 @@
+using Microsoft.VisualBasic.Devices;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+using BibleTaggingUtil.BibleVersions;
+using System.Security.Cryptography.X509Certificates;
+using System.Threading;
+using System.ComponentModel;
+using System.Xml.Linq;
+using static WeifenLuo.WinFormsUI.Docking.DockPanel;
+using System.Reflection;
+using System.Text.RegularExpressions;
+
+namespace BibleTaggingUtil.Editor
+{
+ public class OsisTargetGridView : DataGridView
+ {
+
+ public event VerseViewChangedEventHandler VerseViewChanged;
+ public event RefernceHighlightRequestEventHandler RefernceHighlightRequest;
+ public event GotoVerseRequestEventHandler GotoVerseRequest;
+
+ private FixedSizeStack undoStack = new FixedSizeStack();
+ private FixedSizeStack redoStack = new FixedSizeStack();
+
+ public OsisTargetGridView()
+ {
+ this.ContextMenuStrip = new ContextMenuStrip();
+ this.ContextMenuStrip.Opening += ContextMenuStrip_Opening;
+ this.ContextMenuStrip.ItemClicked += ContextMenuStrip_ItemClicked;
+ }
+
+ public string CurrentVerseReferece { get; set; }
+
+ public string SearchTag { get; set; }
+
+ public Verse CurrentVerse { get; set; }
+
+ public TargetVersion Bible { get; set; }
+
+ public bool IsLastWord
+ {
+ get
+ {
+ if (this.SelectedCells.Count == 1 &&
+ this.SelectedCells[0].ColumnIndex == Columns.Count - 1)
+ return true;
+ else
+ return false;
+ }
+ }
+
+ public bool IsFirstWord
+ {
+ get
+ {
+ if (this.SelectedCells.Count == 1 &&
+ this.SelectedCells[0].ColumnIndex == 0)
+ return true;
+ else
+ return false;
+ }
+ }
+
+ public bool IsCurrentTextAramaic
+ {
+ get
+ {
+ bool result = false;
+
+ string referencePattern = @"^([0-9A-Za-z]+)\s([0-9]+):([0-9]+)";
+ Match mTx = Regex.Match(CurrentVerseReferece, referencePattern);
+ if (!mTx.Success)
+ {
+ Tracing.TraceError(MethodBase.GetCurrentMethod().Name, "Incorrect reference format: " + CurrentVerseReferece);
+ return result;
+ }
+
+ String book = mTx.Groups[1].Value;
+ string chapter = mTx.Groups[2].Value;
+ string verse = mTx.Groups[3].Value;
+ int ch = 0;
+ int vs = 0;
+ if (!int.TryParse(chapter, out ch))
+ return result;
+ if (!int.TryParse(verse, out vs))
+ return result;
+ if ((book == "Gen" && ch == 31 && vs == 47) ||
+ (book == "Ezr" && ((ch == 4 && vs >= 8) || (ch == 5) || (ch == 6 && vs <= 18))) ||
+ (book == "Ezr" && (ch >= 7 && vs >= 12 && vs <= 26)) ||
+ (book == "Pro" && ch == 31 && vs == 2) ||
+ (book == "Jer" && ch == 10 && vs == 11) ||
+ (book == "Dan" && ((ch == 2 && vs >= 4) || (ch > 2 && ch < 7) || (ch == 7 && vs <= 28))))
+ result = true;
+
+ return result;
+ }
+ }
+
+ #region Context Menue
+
+ private const string MERGE_CONTEXT_MENU = "Merge";
+ private const string SWAP_CONTEXT_MENU = "Swap Tags";
+ private const string SPLIT_CONTEXT_MENU = "Split";
+ private const string DELETE_CONTEXT_MENU = "Delete Tag";
+ private const string REVERSE_CONTEXT_MENU = "Reverse Tags";
+ private const string DELETE_LEFT_CONTEXT_MENU = "Delete Left Tags";
+ private const string DELETE_RIGHT_CONTEXT_MENU = "Delete Right Tags";
+
+ private void ContextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e)
+ {
+ e.Cancel = true;
+ if (this.SelectedCells.Count == 0)
+ return;
+
+ if (this.SelectedCells.Count > 1)
+ {
+ bool sameRow = true;
+ foreach (DataGridViewCell cell in this.SelectedCells)
+ {
+ // we only merge in the top row
+ if (cell.RowIndex != 0)
+ {
+ sameRow = false;
+ break;
+ }
+ }
+
+ bool mergeOk = true; // we only merge adjacent cells
+ int colIndex = SelectedCells[0].ColumnIndex;
+ for (int i = 1; i < this.SelectedCells.Count; i++)
+ {
+ if(Math.Abs(SelectedCells[i].ColumnIndex - colIndex) != 1)
+ {
+ mergeOk = false;
+ break;
+ }
+ colIndex = SelectedCells[i].ColumnIndex;
+ }
+
+
+ if (sameRow)
+ {
+ this.ContextMenuStrip.Items.Clear();
+ ToolStripMenuItem mergeMenuItem = new ToolStripMenuItem(MERGE_CONTEXT_MENU);
+ ToolStripMenuItem swapMenuItem = new ToolStripMenuItem(SWAP_CONTEXT_MENU);
+
+ if(mergeOk)
+ this.ContextMenuStrip.Items.Add(mergeMenuItem);
+ if(this.SelectedCells.Count == 2)
+ this.ContextMenuStrip.Items.Add(swapMenuItem);
+ e.Cancel = false;
+ }
+ }
+ else
+ {
+ if (this.SelectedCells[0].RowIndex == 1)
+ {
+ string text = (String)this.SelectedCells[0].Value;
+
+ if (string.IsNullOrEmpty(text))
+ return;
+
+ this.ContextMenuStrip.Items.Clear();
+
+ this.ContextMenuStrip.Items.Clear();
+
+ string[] strings = text.Trim().Split(' ');
+ if (strings.Length > 1)
+ {
+ ToolStripMenuItem reverseMenuItem = new ToolStripMenuItem(REVERSE_CONTEXT_MENU);
+ this.ContextMenuStrip.Items.Add(reverseMenuItem);
+
+ ToolStripMenuItem deleteLeftMenuItem = new ToolStripMenuItem(DELETE_LEFT_CONTEXT_MENU);
+ this.ContextMenuStrip.Items.Add(deleteLeftMenuItem);
+
+ ToolStripMenuItem deleteRightMenuItem = new ToolStripMenuItem(DELETE_RIGHT_CONTEXT_MENU);
+ this.ContextMenuStrip.Items.Add(deleteRightMenuItem);
+ }
+
+ ToolStripMenuItem deleteMenuItem = new ToolStripMenuItem(DELETE_CONTEXT_MENU);
+ this.ContextMenuStrip.Items.Add(deleteMenuItem);
+
+
+ e.Cancel = false;
+ }
+ else
+ {
+ this.ContextMenuStrip.Items.Clear();
+ ToolStripMenuItem deleteMenuItem = new ToolStripMenuItem(SPLIT_CONTEXT_MENU);
+
+ this.ContextMenuStrip.Items.Add(deleteMenuItem);
+ e.Cancel = false;
+ }
+ }
+ }
+
+ private void ContextMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
+ {
+ if (e.ClickedItem.Text == MERGE_CONTEXT_MENU)
+ {
+ int savedColumn = this.CurrentCell.ColumnIndex;
+ int savedRow = this.CurrentCell.RowIndex;
+ if (this.CurrentVerse != null)
+ undoStack.Push(new VerseEx(new Verse(this.CurrentVerse), savedColumn, savedRow));
+
+ int firstMergeIndex = this.SelectedCells[0].ColumnIndex;
+ for (int i = 1; i < this.SelectedCells.Count; i++)
+ {
+ if (this.SelectedCells[i].ColumnIndex < firstMergeIndex)
+ firstMergeIndex = this.SelectedCells[i].ColumnIndex;
+ }
+ this.CurrentVerse.Merge(firstMergeIndex, this.SelectedCells.Count);
+
+ SaveVerse(CurrentVerseReferece);
+ this.Update(CurrentVerse);
+
+ this[firstMergeIndex, 1].Selected = true;
+ this.CurrentCell = this[firstMergeIndex, 1];
+ if (!string.IsNullOrEmpty((string)this[firstMergeIndex, 1].Value))
+ FireRefernceHighlightRequest((string)this[firstMergeIndex, 1].Value);
+ FireVerseViewChanged();
+ }
+ else if (e.ClickedItem.Text == SWAP_CONTEXT_MENU)
+ {
+ int savedColumn = this.CurrentCell.ColumnIndex;
+ int savedRow = this.CurrentCell.RowIndex;
+ if (this.CurrentVerse != null)
+ undoStack.Push(new VerseEx(new Verse(this.CurrentVerse), savedColumn, savedRow));
+
+ int firstSwapIndex = this.SelectedCells[0].ColumnIndex;
+ int secondSwapIndex = this.SelectedCells[1].ColumnIndex;
+ //for (int i = 1; i < this.SelectedCells.Count; i++)
+ //{
+ // if (this.SelectedCells[i].ColumnIndex < firstSwapIndex)
+ // firstSwapIndex = this.SelectedCells[i].ColumnIndex;
+ //}
+ this.CurrentVerse.SwapTags(firstSwapIndex, secondSwapIndex);
+
+ SaveVerse(CurrentVerseReferece);
+ this.Update(CurrentVerse);
+
+ this[firstSwapIndex, 1].Selected = true;
+ this.CurrentCell = this[firstSwapIndex, 1];
+ if (!string.IsNullOrEmpty((string)this[firstSwapIndex, 1].Value))
+ FireRefernceHighlightRequest((string)this[firstSwapIndex, 1].Value);
+ FireVerseViewChanged();
+ }
+ else if (e.ClickedItem.Text == SPLIT_CONTEXT_MENU)
+ {
+ int savedColumn = this.CurrentCell.ColumnIndex;
+ int savedRow = this.CurrentCell.RowIndex;
+ if (this.CurrentVerse != null)
+ undoStack.Push(new VerseEx(new Verse(this.CurrentVerse), savedColumn, savedRow));
+
+ int splitIndex = this.SelectedCells[0].ColumnIndex;
+ for (int i = 1; i < this.SelectedCells.Count; i++)
+ {
+ if (this.SelectedCells[i].ColumnIndex < splitIndex)
+ splitIndex = this.SelectedCells[i].ColumnIndex;
+ }
+ this.CurrentVerse.split(splitIndex);
+
+ SaveVerse(CurrentVerseReferece);
+ this.Update(CurrentVerse);
+
+ this[splitIndex, 1].Selected = true;
+ this.CurrentCell = this[splitIndex, 1];
+ if (!string.IsNullOrEmpty((string)this[splitIndex, 1].Value))
+ FireRefernceHighlightRequest((string)this[splitIndex, 1].Value);
+ FireVerseViewChanged();
+ }
+ else if (e.ClickedItem.Text == DELETE_CONTEXT_MENU)
+ {
+ int savedColumn = this.CurrentCell.ColumnIndex;
+ int savedRow = this.CurrentCell.RowIndex;
+ if (this.CurrentVerse != null)
+ undoStack.Push(new VerseEx(new Verse(this.CurrentVerse), savedColumn, savedRow));
+
+ int col = this.SelectedCells[0].ColumnIndex;
+ this.CurrentVerse[col].Strong = new string[] { string.Empty };
+ SaveVerse(CurrentVerseReferece);
+ this.Update(CurrentVerse);
+
+ this[col, 1].Selected = true;
+ this.CurrentCell = this[col, 1];
+ FireVerseViewChanged();
+ }
+ else
+ {
+ string[] strings = ((string)this.SelectedCells[0].Value).Split(' ');
+ if (strings.Length < 2) return;
+
+ int savedColumn = this.CurrentCell.ColumnIndex;
+ int savedRow = this.CurrentCell.RowIndex;
+ if (this.CurrentVerse != null)
+ undoStack.Push(new VerseEx(new Verse(this.CurrentVerse), savedColumn, savedRow));
+
+ string newText = string.Empty;
+ int col = 0;
+ if (e.ClickedItem.Text == REVERSE_CONTEXT_MENU)
+ {
+ newText = strings[strings.Length - 1];
+ for (int i = strings.Length - 2; i >= 0; i--)
+ {
+ newText += " " + strings[i];
+ }
+ this.SelectedCells[0].Value = newText;
+
+ col = this.SelectedCells[0].ColumnIndex;
+ this.CurrentVerse[col].StrongString = newText;
+ SaveVerse(CurrentVerseReferece);
+ FireVerseViewChanged();
+ }
+ else if (e.ClickedItem.Text == DELETE_LEFT_CONTEXT_MENU)
+ {
+ for (int i = 1; i < strings.Length; i++)
+ {
+ newText += string.IsNullOrEmpty(newText) ? strings[i] : " " + strings[i];
+ }
+ this.SelectedCells[0].Value = newText;
+
+ col = this.SelectedCells[0].ColumnIndex;
+ this.CurrentVerse[col].StrongString = newText;
+ SaveVerse(CurrentVerseReferece);
+ FireVerseViewChanged();
+ }
+ else if (e.ClickedItem.Text == DELETE_RIGHT_CONTEXT_MENU)
+ {
+ for (int i = 0; i < strings.Length - 1; i++)
+ {
+ newText += string.IsNullOrEmpty(newText) ? strings[i] : " " + strings[i];
+ }
+ this.SelectedCells[0].Value = newText;
+
+ col = this.SelectedCells[0].ColumnIndex;
+ this.CurrentVerse[col].StrongString = newText;
+ SaveVerse(CurrentVerseReferece);
+ FireVerseViewChanged();
+ }
+ this[col, 1].Selected = true;
+ this.CurrentCell = this[col, 1];
+ if (!string.IsNullOrEmpty((string)this[col, 1].Value))
+ FireRefernceHighlightRequest((string)this[col, 1].Value);
+ FireVerseViewChanged();
+ }
+ }
+
+ #endregion Context Menue
+
+ #region Save & Update
+ ///
+ /// Updates the target verse display when the verse contains tags already
+ ///
+ /// tagged verse
+ public void Update(Verse verse)
+ {
+ //«
+ try
+ {
+ if (verse == null)
+ {
+ return;
+ }
+
+ this.CurrentVerse = verse;
+ bool oldTestament = false;
+
+ string direction = Properties.Settings.Default.TargetTextDirection;
+ this.Rows.Clear();
+
+ string[] verseWords = new string[verse.Count];
+ string[] verseTags = new string[verse.Count];
+ oldTestament = (verse[0].Testament == BibleTestament.OT);
+ for (int i = 0; i < verse.Count; i++)
+ {
+ verseWords[i] = verse[i].Word;
+ for (int j = 0; j < verse[i].Strong.Length; j++)
+ verseTags[i] += "<" + verse[i].Strong[j] + "> ";
+ verseTags[i] = verseTags[i].Trim();
+ }
+
+ int col = -1;
+ for (int i = 0; i < verseTags.Length; i++)
+ {
+ // if (verseTags[i].Contains("3068")) //verseTags[i].Contains("???") || verseTags[i].Contains("0000"))
+ //{
+ // col = i;
+ // break;
+ // }
+ if (verseTags[i] == "<>")
+ verseTags[i] = string.Empty;
+ }
+
+
+ this.ColumnCount = verseWords.Length;
+ this.Rows.Add(verseWords);
+ this.Rows.Add(verseTags);
+
+ string tagToHighlight = SearchTag;
+ if (string.IsNullOrEmpty(tagToHighlight) || tagToHighlight.ToLower() == "")
+ tagToHighlight = "<>";
+ for (int i = 0; i < verseWords.Length; i++)
+ {
+ string word = (string)this.Rows[0].Cells[i].Value;
+ string tag = (string)this.Rows[1].Cells[i].Value;
+ string nextTag = string.Empty;
+ if(i < verseWords.Length - 1)
+ {
+ nextTag = (string)this.Rows[1].Cells[i+1].Value;
+ }
+ if (tag == null)
+ continue;
+
+ if ((tag.Contains("3068") || tag.Contains("3069")) && oldTestament)
+ {
+ this.Rows[1].Cells[i].Style.ForeColor = Color.Red;
+ }
+ if (tag.Contains("0430>") && oldTestament)
+ {
+ //this.Rows[1].Cells[i].Style.BackColor = Color.Green;
+ this.Rows[1].Cells[i].Style.ForeColor = Color.Green;
+ }
+
+ if (tag.Contains("0410>") && oldTestament)
+ this.Rows[1].Cells[i].Style.ForeColor = Color.Blue;
+
+ if (tag.Contains(tagToHighlight) || tag.Contains("0000") || (tag == string.Empty && tagToHighlight == "<>"))
+ this.Rows[1].Cells[i].Style.BackColor = Color.LightGray;
+ else if (!string.IsNullOrEmpty(tag) && tag == nextTag)
+ {
+ this.Rows[1].Cells[i].Style.BackColor = Color.Yellow;
+ this.Rows[1].Cells[i+1].Style.BackColor = Color.Yellow;
+ }
+
+ if (direction.ToLower() == "rtl")
+ this.Columns[i].DisplayIndex = verseWords.Length - i - 1;
+ }
+
+ if (col >= 0)
+ this.CurrentCell = this.Rows[1].Cells[col];
+
+ this.ClearSelection();
+
+ this.Rows[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
+ this.Rows[0].ReadOnly = true;
+ this[0,1].Selected = true;
+ this.CurrentCell = this[0, 1];
+ if(!string.IsNullOrEmpty((string)this[0, 1].Value))
+ FireRefernceHighlightRequest((string)this[0, 1].Value);
+ //this.Rows[1].ReadOnly = true;
+
+ }
+ catch (Exception ex)
+ {
+ Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ }
+ }
+
+
+ ///
+ ///
+ ///
+ ///
+ public void SaveVerse(Verse verse)
+ {
+ Bible.Bible[verse[0].Reference] = verse;
+ if (!Utils.AreReferencesEqual(CurrentVerseReferece, verse[0].Reference))
+ {
+ FireGotoVerseRequest(verse[0].Reference);
+ }
+ }
+
+
+ ///
+ ///
+ ///
+ ///
+ public void SaveVerse(string reference)
+ {
+ Verse verse = new Verse();
+
+ for (int i = 0; i < this.Columns.Count; i++)
+ {
+ string[] tags;
+ string tag = ((string)this[i, 1].Value);
+ if (string.IsNullOrEmpty(tag))
+ tags = new string[] { "<>" };
+ else
+ tags = tag.Split(' ');
+
+ // remove <> from tags
+ for (int j = 0; j < tags.Length; j++)
+ tags[j] = tags[j].Replace("<", "").Replace(">", "");
+
+ verse[i] = new VerseWord((string)this[i, 0].Value, tags, reference);
+ }
+
+ reference = Bible.GetCorrectReference(reference);
+
+ if (Bible.Bible.ContainsKey(reference))
+ {
+ Bible.Bible[reference] = verse;
+ }
+ else
+ {
+ Bible.Bible.Add(reference, verse);
+ }
+ }
+ #endregion Save & Update
+
+
+ #region overrides
+ ///
+ ///
+ ///
+ ///
+ protected override void OnCellValueChanged(DataGridViewCellEventArgs e)
+ {
+ if (e.RowIndex == 0)
+ {
+ string newWord = (string)this[e.ColumnIndex, e.RowIndex].Value;
+ CurrentVerse.UpdateWord(e.ColumnIndex, newWord);
+// FireVerseViewChanged();
+ }
+ base.OnCellValueChanged(e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected override void OnCellEnter(DataGridViewCellEventArgs e)
+ {
+ if (this.Rows.Count > 1)
+ {
+ // during initialsation, we may come here
+ // when the grid rows are not fully initialised
+ //if (this.SelectedRows.Count > 1)
+ //{
+ //}
+ if(e.RowIndex == 1)
+ {
+ this.ClearSelection();
+ this[e.ColumnIndex, e.RowIndex].Selected = true;
+ }
+ FireRefernceHighlightRequest((string)this.Rows[1].Cells[e.ColumnIndex].Value);
+
+ }
+ //base.OnCellEnter(e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ //protected override void OnColumnRemoved(DataGridViewColumnEventArgs e)
+ //{
+ // FireVerseViewChanged();
+ // base.OnColumnRemoved(e);
+ //}
+
+ protected override void OnKeyUp(KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Delete)
+ {
+ if(this.SelectedCells.Count == 1)
+ {
+ int savedColumn = this.CurrentCell.ColumnIndex;
+ int savedRow = this.CurrentCell.RowIndex;
+ if (this.CurrentVerse != null)
+ undoStack.Push(new VerseEx(new Verse(this.CurrentVerse), savedColumn, savedRow));
+
+ int col = this.SelectedCells[0].ColumnIndex;
+ this[col, 1].Value = string.Empty;
+ this.CurrentVerse[col].Strong = new string[] { string.Empty };
+ SaveVerse(CurrentVerseReferece);
+ this.Update(CurrentVerse);
+
+ }
+ }
+
+ base.OnKeyUp(e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected override void OnDragEnter(DragEventArgs drgevent)
+ {
+ drgevent.Effect = DragDropEffects.Copy;
+ base.OnDragEnter(drgevent);
+ }
+
+
+ protected override void OnDragDrop(DragEventArgs drgevent)
+ {
+ DragData data = drgevent.Data.GetData(typeof(DragData)) as DragData;
+ string droppedValue = data.Text;
+ Point cursorLocation = this.PointToClient(new Point(drgevent.X, drgevent.Y));
+
+ System.Windows.Forms.DataGridView.HitTestInfo hittest = this.HitTest(cursorLocation.X, cursorLocation.Y);
+ if (hittest.ColumnIndex != -1
+ && hittest.RowIndex == 1)
+ { //CHANGE
+ if (data.Source.Equals(this))
+ {
+ if (data.ColumnIndex == hittest.ColumnIndex)
+ return;
+ }
+
+ droppedValue = droppedValue.Replace("+G", "> <");
+ string[] droppedValueParts = droppedValue.Split(' ');
+ String newValue = string.Empty;
+
+ string currentValue = (string)this[hittest.ColumnIndex, 1].Value;
+
+ if (!string.IsNullOrEmpty(currentValue) && !currentValue.Contains("???") && Control.ModifierKeys == Keys.Control)
+ newValue = currentValue;
+
+ // special Handling for Aramaic
+ if (droppedValueParts.Length == 2 && IsCurrentTextAramaic && data.Source is Editor.TOHTHGridView)
+ {
+ droppedValueParts = new string[1] { droppedValueParts[1] };
+ }
+
+ for (int i = 0; i < droppedValueParts.Length; i++)
+ {
+ if (droppedValueParts[i].Contains('('))
+ continue; //skip morphology
+
+ string tmp = droppedValueParts[i].Trim().Replace("<", "").Replace(">", "");
+ tmp = ("0000" + tmp).Substring(tmp.Length);
+ int val = Convert.ToInt32(tmp);
+ if (val > 0)
+ {
+ tmp = "<" + tmp + ">";
+ // if (!droppedValue.Contains(tmp) || Control.ModifierKeys == Keys.Alt)
+ newValue += string.IsNullOrEmpty(droppedValue) ? tmp : (" " + tmp);
+ }
+ }
+ int savedColumn = this.CurrentCell.ColumnIndex;
+ int savedRow = this.CurrentCell.RowIndex;
+ if (this.CurrentVerse != null)
+ undoStack.Push(new VerseEx(new Verse(this.CurrentVerse), savedColumn, savedRow));
+
+ this[hittest.ColumnIndex, 1].Value = newValue.Trim();
+ this.CurrentVerse[hittest.ColumnIndex].StrongString = newValue.Trim();
+
+ FireRefernceHighlightRequest(newValue);
+
+ if (data.Source.Equals(this))
+ {
+ this[data.ColumnIndex, 1].Value = string.Empty;
+ this.CurrentVerse[data.ColumnIndex].StrongString = string.Empty;
+ }
+ SaveVerse(CurrentVerseReferece);
+ FireVerseViewChanged();
+
+ this.ClearSelection();
+ this[hittest.ColumnIndex, 1].Selected = true;
+ this.Rows[0].ReadOnly = true;
+
+ this[hittest.ColumnIndex, 1].Selected = true;
+ this.CurrentCell = this[hittest.ColumnIndex, 1];
+ if (!string.IsNullOrEmpty((string)this[hittest.ColumnIndex, 1].Value))
+ FireRefernceHighlightRequest((string)this[hittest.ColumnIndex, 1].Value);
+
+ this.Focus();
+ }
+
+ base.OnDragDrop(drgevent);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ if (e.Button == MouseButtons.Left && e.Clicks == 1)
+ {
+ DataGridView.HitTestInfo info = this.HitTest(e.X, e.Y);
+ if (info.RowIndex > 0)
+ {
+ if (info.RowIndex >= 0 && info.ColumnIndex >= 0)
+ {
+ string text = (String)this.Rows[1].Cells[info.ColumnIndex].Value;
+ DragData data = new DragData(1, info.ColumnIndex, text, this);
+ if (text != null)
+ {
+ //Need to put braces here CHANGE
+ this.DoDragDrop(data, DragDropEffects.Copy);
+ }
+ }
+ }
+ }
+ base.OnMouseDown(e);
+ }
+
+ #endregion overrides
+
+ #region Undo / Redo
+ public void Undo()
+ {
+ if (undoStack.Count > 0)
+ {
+ int savedColumn = this.CurrentCell.ColumnIndex;
+ int savedRow = this.CurrentCell.RowIndex;
+ redoStack.Push(new VerseEx(new Verse(this.CurrentVerse), savedColumn, savedRow));
+
+ VerseEx verseEx = undoStack.Pop();
+ Verse verse = verseEx.SavedVerse;
+
+ if (Utils.AreReferencesEqual(CurrentVerseReferece, verse[0].Reference))
+ {
+ Update(verse);
+ }
+ SaveVerse(verse);
+ this.CurrentCell = this[verseEx.Colum, verseEx.Row];
+ }
+ }
+
+ public void Redo()
+ {
+ if (redoStack.Count > 0)
+ {
+ VerseEx verseEx = redoStack.Pop();
+ Verse verse = verseEx.SavedVerse;
+ if (Utils.AreReferencesEqual(CurrentVerseReferece, verse[0].Reference))
+ {
+ Update(verse);
+ }
+ SaveVerse(verse);
+ this.CurrentCell = this[verseEx.Colum, verseEx.Row];
+ }
+ }
+
+ #endregion Undo / Redo
+
+ #region Firing events
+ public void FireVerseViewChanged()
+ {
+ if (this.VerseViewChanged != null)
+ {
+ this.VerseViewChanged(this, EventArgs.Empty);
+ }
+
+ }
+
+ public void FireRefernceHighlightRequest(string tag)
+ {
+ if (this.RefernceHighlightRequest != null)
+ {
+ bool firstHalf = true;
+ if(this.SelectedCells.Count == 1)
+ {
+ if (this.SelectedCells[0].ColumnIndex > (this.ColumnCount/2))
+ firstHalf = false;
+ }
+ this.RefernceHighlightRequest(this, tag, firstHalf);
+ }
+
+ }
+
+ public void FireGotoVerseRequest(string tag)
+ {
+ if (this.GotoVerseRequest != null)
+ {
+ this.GotoVerseRequest(this, tag);
+ }
+
+ }
+ #endregion Firing events
+
+ }
+ public delegate void VerseViewChangedEventHandler(object sender, EventArgs e);
+ public delegate void RefernceHighlightRequestEventHandler(object sender, string tag, bool firstHalf);
+ public delegate void GotoVerseRequestEventHandler(object sender, string reference);
+
+}
diff --git a/src/BibleTaggingUtil/Editor/TOHTHGridView.cs b/src/BibleTaggingUtil/Editor/TOHTHGridView.cs
index 8873980..6207e16 100644
--- a/src/BibleTaggingUtil/Editor/TOHTHGridView.cs
+++ b/src/BibleTaggingUtil/Editor/TOHTHGridView.cs
@@ -171,7 +171,9 @@ private void UpdateOT(Verse verseWords)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
this.ClearSelection();
@@ -224,7 +226,9 @@ private void UpdateNT(Verse verseWords)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
}
}
diff --git a/src/BibleTaggingUtil/Editor/TargetGridView.cs b/src/BibleTaggingUtil/Editor/TargetGridView.cs
index 6e9ab8b..48b87de 100644
--- a/src/BibleTaggingUtil/Editor/TargetGridView.cs
+++ b/src/BibleTaggingUtil/Editor/TargetGridView.cs
@@ -42,6 +42,7 @@ public TargetGridView()
public Verse CurrentVerse { get; set; }
public TargetVersion Bible { get; set; }
+ public TargetOsisVersion OsisBible { get; internal set; }
public bool IsLastWord
{
@@ -102,6 +103,7 @@ public bool IsCurrentTextAramaic
}
}
+
#region Context Menue
private const string MERGE_CONTEXT_MENU = "Merge";
@@ -118,6 +120,9 @@ private void ContextMenuStrip_Opening(object sender, System.ComponentModel.Cance
if (this.SelectedCells.Count == 0)
return;
+ if (Properties.Settings.Default.Osis)
+ return;
+
if (this.SelectedCells.Count > 1)
{
bool sameRow = true;
@@ -382,7 +387,11 @@ public void Update(Verse verse)
verseWords[i] = verse[i].Word;
for (int j = 0; j < verse[i].Strong.Length; j++)
verseTags[i] += "<" + verse[i].Strong[j] + "> ";
- verseTags[i] = verseTags[i].Trim();
+ if (verseTags[i] == null)
+ verseTags[i] = string.Empty;
+ else
+ verseTags[i] = verseTags[i].Trim();
+
}
int col = -1;
@@ -458,7 +467,9 @@ public void Update(Verse verse)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
}
@@ -469,7 +480,11 @@ public void Update(Verse verse)
///
public void SaveVerse(Verse verse)
{
- Bible.Bible[verse[0].Reference] = verse;
+ if (Properties.Settings.Default.Osis)
+ OsisBible.Bible[verse[0].Reference] = verse;
+ else
+ Bible.Bible[verse[0].Reference] = verse;
+
if (!Utils.AreReferencesEqual(CurrentVerseReferece, verse[0].Reference))
{
FireGotoVerseRequest(verse[0].Reference);
@@ -483,33 +498,56 @@ public void SaveVerse(Verse verse)
///
public void SaveVerse(string reference)
{
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+
+ bool osis = Properties.Settings.Default.Osis;
+
Verse verse = new Verse();
- for (int i = 0; i < this.Columns.Count; i++)
+ try
{
- string[] tags;
- string tag = ((string)this[i, 1].Value);
- if (string.IsNullOrEmpty(tag))
- tags = new string[] { "<>" };
- else
- tags = tag.Split(' ');
-
- // remove <> from tags
- for (int j = 0; j < tags.Length; j++)
- tags[j] = tags[j].Replace("<", "").Replace(">", "");
+ for (int i = 0; i < this.Columns.Count; i++)
+ {
+ string[] tags;
+ string tag = ((string)this[i, 1].Value);
+ if (string.IsNullOrEmpty(tag))
+ tags = new string[] { "<>" };
+ else
+ tags = tag.Split(' ');
+
+ // remove <> from tags
+ for (int j = 0; j < tags.Length; j++)
+ tags[j] = tags[j].Replace("<", "").Replace(">", "");
+
+ verse[i] = new VerseWord((string)this[i, 0].Value, tags, reference);
+ if (osis)
+ {
+ verse[i].OsisTagIndex = CurrentVerse[i].OsisTagIndex;
+ verse[i].OsisTagLevel = CurrentVerse[i].OsisTagLevel;
+ verse.Dirty = true;
+ }
+ }
- verse[i] = new VerseWord((string)this[i, 0].Value, tags, reference);
- }
+ reference = osis ? OsisBible.GetCorrectReference(reference) : Bible.GetCorrectReference(reference);
- reference = Bible.GetCorrectReference(reference);
+ Dictionary bible = osis ? OsisBible.Bible : Bible.Bible;
+ if (bible.ContainsKey(reference))
+ {
+ string oldVerse = bible[reference].ToString();
+ bible[reference] = verse;
+ Tracing.TraceInfo(name, "OLD: " + oldVerse, "NEW: " + verse.ToString());
- if (Bible.Bible.ContainsKey(reference))
- {
- Bible.Bible[reference] = verse;
+ }
+ else
+ {
+ bible.Add(reference, verse);
+ }
}
- else
+ catch (Exception ex)
{
- Bible.Bible.Add(reference, verse);
+ Tracing.TraceException(name, ex);
+ throw;
}
}
#endregion Save & Update
diff --git a/src/BibleTaggingUtil/Editor/KJVGridView.cs b/src/BibleTaggingUtil/Editor/TopVersionGridView.cs
similarity index 91%
rename from src/BibleTaggingUtil/Editor/KJVGridView.cs
rename to src/BibleTaggingUtil/Editor/TopVersionGridView.cs
index 91d5efe..3841732 100644
--- a/src/BibleTaggingUtil/Editor/KJVGridView.cs
+++ b/src/BibleTaggingUtil/Editor/TopVersionGridView.cs
@@ -9,7 +9,7 @@
namespace BibleTaggingUtil.Editor
{
- internal class KJVGridView : DataGridView
+ internal class TopVersionGridView : DataGridView
{
protected override void OnCellMouseDown(DataGridViewCellMouseEventArgs e)
{
@@ -91,7 +91,9 @@ public void Update(Verse verse)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
}
diff --git a/src/BibleTaggingUtil/OSIS_Generator.cs b/src/BibleTaggingUtil/OSIS_Generator.cs
index 32e492c..4c4ecf5 100644
--- a/src/BibleTaggingUtil/OSIS_Generator.cs
+++ b/src/BibleTaggingUtil/OSIS_Generator.cs
@@ -164,7 +164,9 @@ public void Generate(TargetVersion targetVersion)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
throw;
}
}
@@ -372,7 +374,9 @@ private void WriteBibleBooks(StreamReader sr, StreamWriter sw, string strongPref
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
throw;
}
@@ -419,7 +423,9 @@ private string GetTaggedVerse(string verseText, string strongPrefix)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
@@ -444,7 +450,13 @@ private string GetTaggedVerse(string verseText, string strongPrefix)
if (string.IsNullOrEmpty(strongStr))
words.Add(string.Format("{0}", word));
else
- words.Add(string.Format("{1}", strongStr, word));
+ {
+ //if((strongStr.Contains("H3068") || strongStr.Contains("H3069")) &&
+ // osisConf[OsisConstants.osisIDWork].ToLower().Contains("ara"))
+ // words.Add(string.Format("{1}", strongStr, word));
+ //else
+ words.Add(string.Format("{1}", strongStr, word));
+ }
}
word = string.Empty;
@@ -464,7 +476,11 @@ private string GetTaggedVerse(string verseText, string strongPrefix)
{
strongStr += string.Format(" strong:{0}{1}", strongPrefix, tags[j]);
}
- words.Add(string.Format("{1}", strongStr, word));
+ //if ((strongStr.Contains("H3068") || strongStr.Contains("H3069")) &&
+ // osisConf[OsisConstants.osisIDWork].ToLower().Contains("ara"))
+ // words.Add(string.Format("{1}", strongStr, word));
+ //else
+ words.Add(string.Format("{1}", strongStr, word));
}
}
@@ -477,7 +493,9 @@ private string GetTaggedVerse(string verseText, string strongPrefix)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
throw;
}
}
@@ -505,7 +523,9 @@ private void WriteOsisTextStartTag(StreamWriter sw)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
throw;
}
}
@@ -577,7 +597,9 @@ private void WriteHeader(StreamWriter sw)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
throw;
}
}
diff --git a/src/BibleTaggingUtil/OsisXml/OsisTag.cs b/src/BibleTaggingUtil/OsisXml/OsisTag.cs
new file mode 100644
index 0000000..b835b34
--- /dev/null
+++ b/src/BibleTaggingUtil/OsisXml/OsisTag.cs
@@ -0,0 +1,316 @@
+using BibleTaggingUtil;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Xml;
+using System.Xml.Linq;
+
+namespace BibleTaggingUtil.OsisXml
+{
+ internal class OsisTag
+ {
+ private int level = 0;
+ private int index = 0;
+ private VerseTagType tagType;
+ private XmlNode tagXml;
+ private VerseWord? verseWord = null;
+ private List osisTags = new List();
+
+ public OsisTag(int level, int index, VerseTagType tagType, XmlNode tagXML, string verseRef)
+ {
+ this.tagType = tagType;
+ tagXml = tagXML;
+ this.level = level;
+ this.index = index;
+ string verseRefX = GetVerseRefX(verseRef);
+ switch (tagType)
+ {
+ case VerseTagType.text:
+ CreateUntaggedWord(index, tagXML, verseRefX);
+ break;
+ case VerseTagType.w:
+ CreateTaggedWord(index, tagXML, verseRefX);
+ break;
+ case VerseTagType.note:
+ case VerseTagType.milestone:
+ case VerseTagType.b:
+ case VerseTagType.UNKNOWN:
+ break;
+
+ default:
+ {
+ osisTags = OsisUtils.Instance.GetOsisTags(tagXML, verseRef, ++level);
+ //foreach (OsisTag tag in osisTags)
+ //{
+ // new OsisTag(++level, index, tag.tagType, tag.tagXml, verseRef); ;
+ //}
+ }
+ break;
+ }
+ }
+
+ private string GetVerseRefX(string VerseRef)
+ {
+ string verseRefX = string.Empty;
+
+ Match m = Regex.Match(VerseRef, @"([1-9A-Za-z]*)\.(\d{1,3})\.(\d{1,3})");
+ if (m != null)
+ {
+ string book = m.Groups[1].Value;
+ string chapter = m.Groups[2].Value;
+ string verse = m.Groups[3].Value;
+
+ verseRefX = string.Format("{0} {1}:{2}", book, chapter, verse);
+ }
+ return verseRefX;
+ }
+
+ private void CreateUntaggedWord(int index, XmlNode tagXML, string verseRef)
+ {
+ verseWord = new VerseWord(tagXML.InnerText, new string[0], verseRef);
+ verseWord.OsisTagIndex = index;
+ verseWord.OsisTagLevel = level;
+ }
+ private void CreateTaggedWord(int index, XmlNode tagXML, string verseRef)
+ {
+ string word = tagXML.InnerText;
+
+ List strongs = new List();
+
+ XmlAttributeCollection? attrib = tagXML.Attributes;
+ if (attrib != null)
+ {
+ foreach (XmlAttribute attr in attrib)
+ {
+ if (attr.Name == "lemma")
+ {
+ strongs = GetStrongs(attr.Value);
+ }
+ }
+ }
+
+ verseWord = new VerseWord(tagXML.InnerText, strongs.ToArray(), verseRef);
+ verseWord.OsisTagIndex = index;
+ verseWord.OsisTagLevel = level;
+ }
+
+ private List GetStrongs(string value)
+ {
+ List strings = new List();
+ MatchCollection matches = Regex.Matches(value, @"strong:[GH](\d\d\d\d)");
+ if (matches.Count > 0)
+ {
+ foreach (Match match in matches)
+ {
+ strings.Add(match.Groups[1].Value);
+ }
+ }
+
+ return strings;
+ }
+
+ public List GetVerseWords()
+ {
+ List verseWords = new List();
+ try
+ {
+ switch (tagType)
+ {
+ case VerseTagType.text:
+ case VerseTagType.w:
+ verseWords.Add(verseWord);
+ break;
+ default:
+ {
+ if (osisTags.Count > 0)
+ {
+ foreach (OsisTag tag in osisTags)
+ {
+ List verseWords1 = tag.GetVerseWords();
+ if (verseWords1.Count > 0)
+ verseWords.AddRange(verseWords1);
+ }
+ }
+ }
+ break;
+ }
+ }
+ catch (Exception ex)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
+ throw;
+ }
+
+ return verseWords;
+ }
+ public override string ToString()
+ {
+ string result = string.Empty;
+ try
+ {
+ switch (tagType)
+ {
+ case VerseTagType.text:
+
+ if (verseWord != null)
+ {
+ if (verseWord.Strong.Length > 1 ||
+ (verseWord.Strong.Length == 1 && !string.IsNullOrEmpty(verseWord.Strong[0])))
+ {
+ string lemmaValue = string.Empty;
+ foreach (string s in verseWord.Strong)
+ {
+ lemmaValue += string.Format("strong:{0}{1} ", verseWord.Testament == BibleTestament.OT ? "H" : "G", s);
+ }
+ lemmaValue = lemmaValue.Trim();
+ result = string.Format("{1}", lemmaValue, verseWord.Word);
+ }
+ else
+ result = verseWord.Word;
+ }
+
+ break;
+ case VerseTagType.w:
+ if (verseWord.Strong.Length == 0 ||
+ (verseWord.Strong.Length == 1 && string.IsNullOrEmpty(verseWord.Strong[0])))
+ {
+ result = verseWord.Word;
+ }
+ else
+ {
+ string lemmaValue = string.Empty;
+ if (verseWord != null)
+ {
+ foreach (string s in verseWord.Strong)
+ {
+ lemmaValue += string.Format("strong:{0}{1} ", verseWord.Testament == BibleTestament.OT ? "H" : "G", s);
+ }
+ lemmaValue = lemmaValue.Trim();
+ XmlNode tagXml1 = tagXml.Clone();
+ if (tagXml1 != null)
+ {
+ ((XmlElement)tagXml1).SetAttribute("lemma", lemmaValue); // Set to new value.
+ result = tagXml1.OuterXml;
+ }
+ }
+ }
+ break;
+ case VerseTagType.note:
+ case VerseTagType.milestone:
+ case VerseTagType.b:
+ result = tagXml.OuterXml;
+ break;
+
+ case VerseTagType.UNKNOWN:
+ string temp = tagXml.OuterXml;
+ string marker = tagXml.InnerXml;
+ int idx = temp.IndexOf(marker);
+ switch (marker)
+ {
+ case "$start$":
+ result = temp.Substring(idx + marker.Length);
+ break;
+ case "$end$":
+ result = temp.Substring(0, idx);
+ break;
+ default:
+ result = tagXml.OuterXml;
+ break;
+ }
+ break;
+
+ default:
+ {
+ string result1 = string.Empty;
+ if (osisTags.Count > 0)
+ {
+ foreach (OsisTag tag in osisTags)
+ {
+ result1 += tag.ToString();
+ }
+ XmlNode tagXmlTemp = tagXml.Clone();
+ tagXmlTemp.InnerXml = result1;
+ result = tagXmlTemp.OuterXml;
+ if (tagType == VerseTagType.l)
+ {
+ int i = result.IndexOf("$end$");
+ if (i > 0)
+ result = result.Remove(i, "$end$".Length);
+ i = result.IndexOf("$start$");
+ if (i > 0)
+ {
+ int x = result.LastIndexOf(" 1 ||
+ (w.Strong.Length == 1 && !string.IsNullOrEmpty(w.Strong[0])))
+ tagType = VerseTagType.w;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
+ throw;
+ }
+ }
+
+ public XmlNode TagNode
+ {
+ get
+ {
+ return tagXml;
+ }
+ }
+
+
+ }
+}
diff --git a/src/BibleTaggingUtil/OsisXml/OsisUtils.cs b/src/BibleTaggingUtil/OsisXml/OsisUtils.cs
new file mode 100644
index 0000000..1f24d64
--- /dev/null
+++ b/src/BibleTaggingUtil/OsisXml/OsisUtils.cs
@@ -0,0 +1,175 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Xml;
+using System.Xml.Linq;
+
+namespace BibleTaggingUtil.OsisXml
+{
+ internal class OsisUtils
+ {
+ private static OsisUtils instance = null;
+ private static readonly object lockObj = new object();
+
+ public static OsisUtils Instance
+ {
+ get
+ {
+ if (instance == null)
+ {
+ lock (lockObj)
+ {
+ if (instance == null)
+ {
+ instance = new OsisUtils();
+ }
+ }
+ }
+ return instance;
+ }
+ }
+
+ private OsisUtils()
+ {
+ }
+
+ public List GetOsisTags(XmlNode? root, string verseRef, int level=0)
+ {
+ List osisTags = new List();
+ try
+ {
+ foreach (XmlNode node in root.ChildNodes)
+ {
+ osisTags.Add(GetVerseTag(level, osisTags.Count, node, verseRef));
+ }
+ }
+ catch (Exception ex)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
+
+ }
+
+ return osisTags;
+ }
+
+ public List GetStrongsFromLemma(string value)
+ {
+ List strings = new List();
+ MatchCollection matches = Regex.Matches(value, @"strong:([GH]\d\d\d\d)");
+ if (matches.Count > 0)
+ {
+ foreach (Match match in matches)
+ {
+ strings.Add(match.Groups[1].Value);
+ }
+ }
+
+ return strings;
+ }
+
+ public OsisVerse? GetVersesTags(string book, string osisSegment, Match VerseMatch)
+ {
+ OsisVerse result = null;
+
+ int startIndex = VerseMatch.Index + VerseMatch.Groups[0].Length;
+ string sID = VerseMatch.Groups[1].Value;
+ string eID = string.Empty;
+ string verseRef = string.Format("{0}.{1}.{2}", book, VerseMatch.Groups[2].Value, VerseMatch.Groups[3].Value);
+ string verseXML = string.Empty;
+ int endIndex = 0;
+
+ if (verseRef == "Gen.2.7")
+ {
+ int x = 0;
+ }
+
+ try
+ {
+ Regex regex = new Regex(string.Format(@"", sID));
+ // VerseMatch = regex.Match(osisDoc, startIndex);
+ VerseMatch = regex.Match(osisSegment, startIndex);
+ if (VerseMatch.Success)
+ {
+ endIndex = VerseMatch.Index;
+ eID = VerseMatch.Groups[1].Value;
+ }
+
+ string verseXml = string.Empty;
+ if (endIndex > startIndex)
+ verseXml = osisSegment.Substring(startIndex, endIndex - startIndex);
+ // verseXml = osisDoc.Substring(startIndex, endIndex - startIndex);
+
+ result = new OsisVerse(verseRef, startIndex, sID, verseXml, eID);
+ }
+ catch (Exception ex)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
+ throw;
+ }
+
+ return result;
+ }
+
+ public string ChangeReferenceToLocalFormat(string VerseRef)
+ {
+ string verseRefX = string.Empty;
+
+ Match m = Regex.Match(VerseRef, @"([1-9A-Za-z]*)\.(\d{1,3})\.(\d{1,3})");
+ if (m != null)
+ {
+ string book = m.Groups[1].Value;
+ string chapter = m.Groups[2].Value;
+ string verse = m.Groups[3].Value;
+
+ verseRefX = string.Format("{0} {1}:{2}", book, chapter, verse);
+ }
+ return verseRefX;
+ }
+ private OsisTag GetVerseTag(int level, int index, XmlNode node, string verseRef)
+ {
+ VerseTagType tagType = VerseTagType.UNKNOWN;
+ switch (node.Name)
+ {
+ case "#text":
+ tagType = VerseTagType.text;
+ break;
+ case "w":
+ tagType = VerseTagType.w;
+ break;
+ case "hi":
+ tagType = VerseTagType.hi;
+ break;
+ case "q":
+ tagType = VerseTagType.q;
+ break;
+ case "l":
+ tagType = VerseTagType.l;
+ break;
+ case "divineName":
+ tagType = VerseTagType.divineName;
+ break;
+ case "note":
+ tagType = VerseTagType.note;
+ break;
+ case "milestone":
+ tagType = VerseTagType.milestone;
+ break;
+ case "b":
+ tagType = VerseTagType.b;
+ break;
+ }
+
+ return new OsisTag(level, index, tagType, node, verseRef);
+
+ }
+
+
+ }
+}
diff --git a/src/BibleTaggingUtil/OsisXml/OsisVerse.cs b/src/BibleTaggingUtil/OsisXml/OsisVerse.cs
new file mode 100644
index 0000000..f8a9a93
--- /dev/null
+++ b/src/BibleTaggingUtil/OsisXml/OsisVerse.cs
@@ -0,0 +1,226 @@
+using BibleTaggingUtil;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Reflection.Metadata;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Xml;
+using static System.Windows.Forms.AxHost;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
+
+namespace BibleTaggingUtil.OsisXml
+{
+ internal class OsisVerse
+ {
+ private const string zeroWidthSpace = "\u200B";
+ List osisTags = null;
+ public OsisVerse(string verseRef, int startIndex, string sid, string verseXml, string eid)
+ {
+ if(verseRef == "Ps.42.5")
+ {
+ int x = 0;
+ }
+ VerseRef = verseRef;
+ int idx = verseRef.IndexOf(".");
+ Book = verseRef.Substring(0, idx);
+ StartIndex = startIndex;
+ Length = verseXml.Length;
+ sID = sid;
+ VerseXml = verseXml;
+ eID = eid;
+
+ Dirty = false;
+
+ BuildOsisTags();
+ }
+
+ private void BuildOsisTags()
+ {
+ string header = @"";
+ string trailer = @"";
+
+ if (VerseRef == "John.1.9")
+ {
+ //
+ int x = 0;
+ }
+
+ // Gen.3.1
+ VerseXml = TreatOddTags(VerseXml, "p");
+ // Gen.2.23
+ VerseXml = TreatOddTags(VerseXml, "lg");
+ // 1Sam.25.1
+ VerseXml = TreatOddTags(VerseXml, "div");
+ // Ps.42.5 , 6
+ VerseXml = TreatOddTags(VerseXml, "l");
+
+ XmlDocument document = new XmlDocument();
+ VerseXml = VerseXml.Replace("> <", ">" + zeroWidthSpace + "<");
+ document.PreserveWhitespace = true;
+
+ try
+ {
+ document.LoadXml(header + VerseXml + trailer);
+ }
+ catch (Exception ex)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
+ MessageBox.Show("Exception Encountered\r\n" + ex.Message, "Fatal Error!");
+ throw;
+ }
+
+ osisTags = OsisUtils.Instance.GetOsisTags(document.DocumentElement, VerseRef);
+
+ }
+
+ public string VerseCompleteXml
+ {
+ get
+ {
+ string verseRebuild = string.Empty;
+ foreach (OsisTag osisTag in osisTags)
+ {
+ verseRebuild += osisTag.ToString();
+ }
+ verseRebuild = verseRebuild.Replace(">" + zeroWidthSpace + "<", "> <");
+
+ return verseRebuild;
+ }
+ }
+
+ private string TreatOddTags(string VerseXml, string tag)
+ {
+ string s = string.Format("<{0}>", tag);
+ string e = string.Format("{0}>", tag);
+ string startAdded = string.Format("{0}$start${1}", s, e);
+ string endAdded = string.Empty;
+
+ int startIndex = 0;
+ try
+ {
+ while (true)
+ {
+ Regex regex = new Regex(@"(<" + tag + @"[^>]*>)");
+ if (tag == "div" || tag == "l")
+ regex = new Regex(string.Format(@"(<{0}\s[^>]+>)", tag));
+
+ int startP = -1;
+ Match match = regex.Match(VerseXml, startIndex);
+ if (match.Success)
+ {
+ startP = match.Index;
+ s = match.Groups[1].Value;
+ }
+ else
+ startP = VerseXml.IndexOf(s, startIndex);
+
+ endAdded = string.Format("{0}$end${1}", s, e);
+
+ int endP = VerseXml.IndexOf(e, startIndex);
+ if (startP < 0 && endP < 0) break;
+ if (startP < 0 && endP >= 0)
+ {
+ VerseXml = VerseXml.Remove(endP, e.Length).Insert(endP, startAdded); //Replace(e, startAdded);
+ startIndex = endP + startAdded.Length;
+ continue;
+ }
+ else if (startP >= 0 && endP < 0)
+ {
+ VerseXml = VerseXml.Remove(startP, s.Length).Insert(startP, endAdded); //Replace(s, endAdded);
+ startIndex = startP + endAdded.Length;
+ continue;
+ }
+ else if (startP < endP)
+ {
+ startIndex = endP + e.Length;
+ continue;
+ }
+ else if (startP > endP)
+ {
+ VerseXml = VerseXml.Remove(endP, e.Length).Insert(endP, startAdded); //Replace(e, startAdded);
+ startIndex = endP + startAdded.Length;
+ continue;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
+ throw;
+ }
+ return VerseXml;
+ }
+
+ internal Verse GetVerseWords()
+ {
+ Verse verse = new Verse();
+
+ int idx = 0;
+ foreach(OsisTag tag in osisTags)
+ {
+ List words = tag.GetVerseWords();
+ foreach(VerseWord word in words)
+ {
+ verse[idx++] = word;
+ }
+ }
+
+ return verse;
+ }
+
+ public string VerseRefX
+ {
+ get
+ {
+ string verseRefX = string.Empty;
+
+ Match m = Regex.Match(VerseRef, @"([1-9A-Za-z]*)\.(\d{1,3})\.(\d{1,3})");
+ if (m != null)
+ {
+ string book = m.Groups[1].Value;
+ string chapter = m.Groups[2].Value;
+ string verse = m.Groups[3].Value;
+
+ verseRefX = string.Format("{0} {1}:{2}", book, chapter, verse);
+ }
+ return verseRefX;
+ }
+ }
+
+ public void UpdateVerse(Verse verseWords)
+ {
+ for(int i = 0; i < verseWords.Count; i++)
+ {
+ osisTags[verseWords[i].OsisTagIndex].Update(verseWords[i]);
+ }
+
+ }
+ internal void UpdateVerseXml(string newCompleteXml)
+ {
+ VerseXml = newCompleteXml;
+ Length = VerseXml.Length;
+ }
+
+ internal void UpdateVerseStartIndex(int newStartIndex)
+ {
+ StartIndex = newStartIndex;
+ }
+
+ public string VerseRef { get; }
+ public int StartIndex { get; private set; }
+ public int Length { get; private set; }
+ public string sID { get; }
+ public string VerseXml { get; private set; }
+ public string eID { get; }
+ public bool Dirty { get; set; }
+ public string Book { get; internal set; }
+ }
+}
diff --git a/src/BibleTaggingUtil/OsisXml/VerseTagType.cs b/src/BibleTaggingUtil/OsisXml/VerseTagType.cs
new file mode 100644
index 0000000..8405625
--- /dev/null
+++ b/src/BibleTaggingUtil/OsisXml/VerseTagType.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BibleTaggingUtil.OsisXml
+{
+ internal enum VerseTagType
+ {
+ text,
+ w,
+ note,
+ hi,
+ q,
+ l,
+ divineName,
+ milestone,
+ b,
+ UNKNOWN
+ }
+}
diff --git a/src/BibleTaggingUtil/Properties/Settings.Designer.cs b/src/BibleTaggingUtil/Properties/Settings.Designer.cs
index 6559c6d..a4579d9 100644
--- a/src/BibleTaggingUtil/Properties/Settings.Designer.cs
+++ b/src/BibleTaggingUtil/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace BibleTaggingUtil.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -142,5 +142,17 @@ public int PeriodicSaveTime {
this["PeriodicSaveTime"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool Osis {
+ get {
+ return ((bool)(this["Osis"]));
+ }
+ set {
+ this["Osis"] = value;
+ }
+ }
}
}
diff --git a/src/BibleTaggingUtil/Properties/Settings.settings b/src/BibleTaggingUtil/Properties/Settings.settings
index 252aa18..95e5a75 100644
--- a/src/BibleTaggingUtil/Properties/Settings.settings
+++ b/src/BibleTaggingUtil/Properties/Settings.settings
@@ -32,5 +32,8 @@
0
+
+ False
+
\ No newline at end of file
diff --git a/src/BibleTaggingUtil/OSIS/USFM2OSIS _BookData.cs b/src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS _BookData.cs
similarity index 99%
rename from src/BibleTaggingUtil/OSIS/USFM2OSIS _BookData.cs
rename to src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS _BookData.cs
index 1a64de7..357e629 100644
--- a/src/BibleTaggingUtil/OSIS/USFM2OSIS _BookData.cs
+++ b/src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS _BookData.cs
@@ -5,7 +5,7 @@
using System.Text;
using System.Threading.Tasks;
-namespace SM.Bible.Formats.OSIS
+namespace SM.Bible.Formats.USFM2OSIS
{
///
/// This code is based on the Python code by Chris Little https://github.com/chrislit/usfm2osis
diff --git a/src/BibleTaggingUtil/OSIS/USFM2OSIS _Convert.cs b/src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS _Convert.cs
similarity index 99%
rename from src/BibleTaggingUtil/OSIS/USFM2OSIS _Convert.cs
rename to src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS _Convert.cs
index 66510e7..f6059b1 100644
--- a/src/BibleTaggingUtil/OSIS/USFM2OSIS _Convert.cs
+++ b/src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS _Convert.cs
@@ -9,7 +9,7 @@
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;
-namespace SM.Bible.Formats.OSIS
+namespace SM.Bible.Formats.USFM2OSIS
{
///
/// This code is based on the Python code by Chris Little https://github.com/chrislit/usfm2osis
diff --git a/src/BibleTaggingUtil/OSIS/USFM2OSIS _Sort.cs b/src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS _Sort.cs
similarity index 98%
rename from src/BibleTaggingUtil/OSIS/USFM2OSIS _Sort.cs
rename to src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS _Sort.cs
index 08658d6..a86aa63 100644
--- a/src/BibleTaggingUtil/OSIS/USFM2OSIS _Sort.cs
+++ b/src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS _Sort.cs
@@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;
-namespace SM.Bible.Formats.OSIS
+namespace SM.Bible.Formats.USFM2OSIS
{
///
/// This code is based on the Python code by Chris Little https://github.com/chrislit/usfm2osis
diff --git a/src/BibleTaggingUtil/OSIS/USFM2OSIS _Util.cs b/src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS _Util.cs
similarity index 94%
rename from src/BibleTaggingUtil/OSIS/USFM2OSIS _Util.cs
rename to src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS _Util.cs
index bad9fd6..d69e306 100644
--- a/src/BibleTaggingUtil/OSIS/USFM2OSIS _Util.cs
+++ b/src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS _Util.cs
@@ -5,7 +5,7 @@
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;
-namespace SM.Bible.Formats.OSIS
+namespace SM.Bible.Formats.USFM2OSIS
{
///
/// This code is based on the Python code by Chris Little https://github.com/chrislit/usfm2osis
diff --git a/src/BibleTaggingUtil/OSIS/USFM2OSIS.cs b/src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS.cs
similarity index 95%
rename from src/BibleTaggingUtil/OSIS/USFM2OSIS.cs
rename to src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS.cs
index 5267c6c..e021127 100644
--- a/src/BibleTaggingUtil/OSIS/USFM2OSIS.cs
+++ b/src/BibleTaggingUtil/USFM2OSIS/USFM2OSIS.cs
@@ -10,7 +10,7 @@
using System.Text.RegularExpressions;
using System.Threading.Tasks;
-namespace SM.Bible.Formats.OSIS
+namespace SM.Bible.Formats.USFM2OSIS
{
///
/// This code is based on the Python code by Chris Little https://github.com/chrislit/usfm2osis
@@ -146,7 +146,9 @@ private void read_identifiers_from_osis(string filename)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
using (StreamReader sr = new StreamReader(filename, encoding))
@@ -177,10 +179,11 @@ private void read_identifiers_from_osis(string filename)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
-
using (StreamReader sr = new StreamReader(filename, encoding))
{
osis = sr.ReadToEnd().Trim() + "\n";
diff --git a/src/BibleTaggingUtil/Verse.cs b/src/BibleTaggingUtil/Verse.cs
index cea5b34..c58212a 100644
--- a/src/BibleTaggingUtil/Verse.cs
+++ b/src/BibleTaggingUtil/Verse.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
@@ -14,7 +15,7 @@ public class Verse
{
private Dictionary verse = new Dictionary();
- public Verse() { }
+ public Verse() { Dirty = false; }
///
/// Creates a deep copy of itself
@@ -96,6 +97,11 @@ public void Merge(int start, int count)
verse = temp;
}
+ public override string ToString()
+ {
+ return Utils.GetVerseText(this, true);
+ }
+
///
/// Splits the word at index into two
///
@@ -152,6 +158,7 @@ public void split(int index)
verse = temp;
}
+ public bool Dirty { get; set; }
}
@@ -166,11 +173,14 @@ public VerseEx(Verse verse, int col, int row)
SavedVerse = verse;
Colum = col;
Row = row;
+ Dirty = false;
}
public Verse SavedVerse { get; private set; }
public int Colum { get; private set; }
public int Row { get; private set; }
+ public bool Dirty { get; set; }
+
}
}
diff --git a/src/BibleTaggingUtil/VerseSelectionPanel.cs b/src/BibleTaggingUtil/VerseSelectionPanel.cs
index 1507073..3f4df5e 100644
--- a/src/BibleTaggingUtil/VerseSelectionPanel.cs
+++ b/src/BibleTaggingUtil/VerseSelectionPanel.cs
@@ -336,7 +336,9 @@ public string GetNextRef(string currentReference)
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
return result;
@@ -404,7 +406,9 @@ private void SetSelectedIndex(int currentBook, int currentChapter, int currentVe
}
catch (Exception ex)
{
- Tracing.TraceException(MethodBase.GetCurrentMethod().Name, ex.Message);
+ var cm = System.Reflection.MethodBase.GetCurrentMethod();
+ var name = cm.DeclaringType.FullName + "." + cm.Name;
+ Tracing.TraceException(name, ex.Message);
}
}
diff --git a/src/BibleTaggingUtil/VerseWord.cs b/src/BibleTaggingUtil/VerseWord.cs
index 06967ad..7a9c13d 100644
--- a/src/BibleTaggingUtil/VerseWord.cs
+++ b/src/BibleTaggingUtil/VerseWord.cs
@@ -118,5 +118,13 @@ public object Clone()
{
return MemberwiseClone();
}
+
+
+ #region OSIS XML Support
+ public int OsisTagIndex { get; internal set; }
+ public int OsisTagLevel { get; internal set; }
+
+ #endregion OSIS XML Support
+
}
}