Universal Bible API 1.0.2011.1274

SwordBible.cs

Go to the documentation of this file.
00001 using System;
00002 using System.Collections.Generic;
00003 using System.ComponentModel;
00004 using System.Linq;
00005 using System.Text;
00006 using sword2net;
00007 
00008 namespace UniversalBibleAPI
00009 { 
00010 
00011 
00012 
00013 
00014     public class SwordBible : IBibleModul
00015     {
00016         private List<CurrentContentKey> FResultVerses = new List<CurrentContentKey>();
00017         SwordBibleModule SwordModul;
00018         private Scriptureparser BibleParser = new Scriptureparser();
00019         private string FModuleName = "No Name";
00020         private string FModulePath = "";
00021         private BackgroundWorker BackGroundWorkerLoadModul;
00022         private CurrentContentKey DoFilter(CurrentContentKey tmp)
00023         {
00024             if (this.MyFilter != null)
00025             {
00026                 tmp.ContentText = this.MyFilter.PerformFilter(tmp.ContentText);
00027             }
00028             return tmp;
00029         }
00030         #region IBibleModul Members
00031         public event EventHandler<ModulConnectedEventArgs> OnConnected;
00032         public event EventHandler<ParseEventArgs> OnQueryFinished;
00033 
00034        
00035         public IFilter MyFilter { get; set; } 
00036         
00037 
00038         public void Connect(string PathToBibleModul)
00039         {
00040             FModulePath = PathToBibleModul;
00041             BackGroundWorkerLoadModul = new BackgroundWorker();
00042             BackGroundWorkerLoadModul.DoWork += new DoWorkEventHandler(BackGroundWorkerLoadModul_DoWork);
00043             BackGroundWorkerLoadModul.RunWorkerAsync(PathToBibleModul);
00044         }
00045 
00046         void BackGroundWorkerLoadModul_DoWork(object sender, DoWorkEventArgs e)
00047         {
00048 
00049             SwordModul = new SwordBibleModule((e.Argument as String), 7, 4);
00050             if (OnConnected != null)
00051             {
00052 
00053                 ModulConnectedEventArgs args = new ModulConnectedEventArgs();
00054                 args.ModulName = (e.Argument as String);
00055                 FModuleName = args.ModulName;
00056                 OnConnected(this, args);
00057 
00058             }
00059         }
00060 
00061 
00062         private void ReportResult()
00063         {
00064             if (OnQueryFinished != null)
00065             {
00066                 ParseEventArgs PEV = new ParseEventArgs();
00067                 PEV.QueryResultList = this.FResultVerses;
00068                 OnQueryFinished(this, PEV);
00069 
00070             }
00071         }
00072 
00073         public bool HasVersRef(string SingleVersRef)
00074         {
00075             try
00076             {
00077                 return false;
00078             }
00079             catch (Exception e)
00080             {
00081 
00082                 throw e;
00083             }
00084         }
00085 
00086         public void ParseQuery(string BibleQuery)
00087         {
00088             try
00089             {
00090                 if (BibleQuery != string.Empty)
00091                 {
00092 
00093                 }
00094             }
00095             catch (Exception e)
00096             {
00097 
00098                 throw e;
00099             }
00100         }
00101 
00102         public void NextVerse()
00103         {
00104             try
00105             {
00106                 FResultVerses.Clear();
00107                 FResultVerses.Add(DoFilter(BibleParser.GetKeyFromLine(SwordModul.NextVerse())));
00108                 ReportResult();
00109             }
00110             catch (Exception e)
00111             {
00112 
00113                 throw e;
00114             }
00115         }
00116 
00117         public void PreviousVerse()
00118         {
00119             try
00120             {
00121 
00122             }
00123             catch (Exception e)
00124             {
00125 
00126                 throw e;
00127             }
00128         }
00129 
00130         public void NextChapter()
00131         {
00132             try
00133             {
00134 
00135             }
00136             catch (Exception e)
00137             {
00138 
00139                 throw e;
00140             }
00141         }
00142 
00143         public void PreviousChapter()
00144         {
00145             try
00146             {
00147 
00148             }
00149             catch (Exception e)
00150             {
00151 
00152                 throw e;
00153             }
00154         }
00155 
00156         public void NextBook()
00157         {
00158             try
00159             {
00160 
00161             }
00162             catch (Exception e)
00163             {
00164 
00165                 throw e;
00166             }
00167         }
00168 
00169         public void PreviousBook()
00170         {
00171             try
00172             {
00173 
00174             }
00175             catch (Exception e)
00176             {
00177 
00178                 throw e;
00179             }
00180         }
00181 
00182         public bool IsOnEnd()
00183         {
00184             try
00185             {
00186                 return false;
00187             }
00188             catch (Exception e)
00189             {
00190 
00191                 throw e;
00192             }
00193         }
00194 
00195         public bool IsOnStart()
00196         {
00197             try
00198             {
00199                 return true;
00200             }
00201             catch (Exception e)
00202             {
00203 
00204                 throw e;
00205             }
00206         }
00207 
00208         public string ModuleName
00209         {
00210             get
00211             {
00212                 return this.ModuleName;
00213             }
00214             set
00215             {
00216                 this.ModuleName = value;
00217             }
00218         }
00219 
00220         public string ModulePath
00221         {
00222             get { return this.ModulePath; }
00223         }
00224 
00225         public List<CurrentContentKey> GetAllVerses()
00226         {
00227             try
00228             {
00229                 return null;
00230             }
00231             catch (Exception e)
00232             {
00233 
00234                 throw e;
00235             }
00236         }
00237 
00238         #endregion
00239 
00240         #region IBibleModul Members
00241 
00242 
00243         public void ConvertTo(IBibleModul ModulToConvert)
00244         {
00245             throw new NotImplementedException();
00246         }
00247 
00248         #endregion
00249     }
00250 }
 All Classes Namespaces Files Functions Enumerations Properties Events