示例#1
0
 /// <summary>
 /// If you need to hand over parameters from the hosting application
 /// (Pali Text Reader) towards the plugin, this is the method to call.
 /// </summary>
 /// <param name="o"></param
 public void SetPluginParameter(Object o)
 {
     bookContent = (ITree<String>)o;
     if (bookContent != null)
     {
         FillTreeView(this.contentTree, bookContent);
     }
 }
示例#2
0
 private void ExamineBookContents()
 {
     try
     {
         bookContents = NodeTree<String>.NewTree();
         INode<String> section = null;
         INode<String> sutta = null;
         string l = "";
         string p = "";
         string prev = "";
         for(int i = 0; i < ps.length; i++)
         {
             mshtml.IHTMLElement ce = (mshtml.IHTMLElement)ps.item((object)i,0);
           	if (ce != null)
           	{
           		l = ce.outerHTML;
                 if (l != null)
                 {
                     if (l.Contains("=c10>"))
           			{
                         p = ce.innerHTML;
                         if (bookContents != null)
                         {
                             book = bookContents.AddChild(p);
                         }
           			}
                     else if ((l.Contains("=c11>")) || (l.Contains("=c15>")))
           			{
                         p = ce.innerHTML;
                         if (book != null)
                         {
                             section = book.AddChild(p);
                             prev = "section";
                         }
           			}
                     else if ((l.Contains("=c14>")))
           			{
                         p = ce.innerHTML;
                         if (book != null)
                         {
                             if (Regex.IsMatch(p, @"\d{1}\. "))
                             {
                                 sutta = section.AddChild(p);
                                 prev = "sutta";
                             }
                         }
           			}
                     else if (l.Contains("=c03>"))
                     {
                         p = ce.innerHTML;
                         if (Regex.IsMatch(p, @"\d{1}\. "))
                         {
                             string par = p.Substring(0, p.IndexOf(".") + 2);
                             if (sutta != null && prev == "sutta")
                                 sutta.AddChild(par);
                             else if (section != null && prev == "section")
                                 section.AddChild(par);
                         }
                     }
                 }
           	}
         }
         OnContentsParsed();
     }
     catch(Exception ex)
     {
         MessageBox.Show("Error: " + ex.StackTrace.ToString() + ex.Message.ToString());
     }
 }