Exemple #1
0
        private void btDocFilterResult_Click(object sender, EventArgs e)
        {
            for (int i = lVTag.Items.Count - 1; i >= 0; --i)
            {
                TagInfo tagInfo = lVTag.Items[i].Tag as TagInfo;
                if (tagInfo == null)
                {
                    lVTag.Items.RemoveAt(i);
                    continue;
                }
                OutDoc curDoc = tagInfo.ownerDoc;
                if (curDoc == null)
                {
                    lVTag.Items.RemoveAt(i);
                    continue;
                }

                if (!(
                        (String.IsNullOrEmpty(cBDocType.Text) || cBDocType.Text == curDoc.DocType) &&
                        (String.IsNullOrEmpty(cBDocIntent.Text) || cBDocIntent.Text == curDoc.DocIntent) &&
                        (String.IsNullOrEmpty(tBDocPropName.Text) || curDoc.DocProperties[tBDocPropName.Text] == tBDocPropValue.Text)
                        )) //TODO: Modify that.
                {
                    lVTag.Items.RemoveAt(i);
                }
            }
        }
Exemple #2
0
        //static functions here
        public static OutDoc LoadFile(string fileName)
        {
            if (!File.Exists(fileName))
            {
                return(null);
            }
            OutDoc ret = null;
            string ext = Path.GetExtension(fileName).ToLower();

            ret = new OutDoc(fileName);

            return(ret);
        }
Exemple #3
0
 public void AssignElement(XmlElement xmlElement, OutDoc outDoc)
 {
     tagName = xmlElement.Name;
     if (xmlElement.Attributes["value"] != null)
     {
         tagValue = xmlElement.Attributes["value"].Value;
     }
     else
     {
         tagValue = null;
     }
     tagText    = xmlElement.InnerText.Replace("\r\n", "");
     ownerDoc   = outDoc;
     tagDocName = ownerDoc.FileName;
 }
Exemple #4
0
 private void lVTag_DragDrop(object sender, DragEventArgs e)
 {
     string[] fileNames = (string[])e.Data.GetData(DataFormats.FileDrop);
     if (fileNames.Length > 0 && Directory.Exists(fileNames[0]))
     {
         outDocList.Clear();
         string[] files = Directory.GetFiles(fileNames[0], "*.xml", SearchOption.TopDirectoryOnly);
         foreach (string file in files)
         {
             OutDoc newDoc = new OutDoc(file);
             if (!String.IsNullOrEmpty(newDoc.FileName))
             {
                 outDocList.Add(newDoc);
             }
         }
         RefreshTagListView();
     }
 }
Exemple #5
0
 private void tSbtImport_Click(object sender, EventArgs e)
 {
     using (FolderBrowserDialog fbDlg = new FolderBrowserDialog())
     {
         if (fbDlg.ShowDialog() == DialogResult.OK)
         {
             outDocList.Clear();
             string[] files = Directory.GetFiles(fbDlg.SelectedPath, "*.xml", SearchOption.TopDirectoryOnly);
             foreach (string file in files)
             {
                 OutDoc newDoc = new OutDoc(file);
                 if (!String.IsNullOrEmpty(newDoc.FileName))
                 {
                     outDocList.Add(newDoc);
                 }
             }
             RefreshTagListView();
         }
     }
 }
Exemple #6
0
        public void RefreshDoc(TagInfo tagInfo)
        {
            if (tagInfo == null)
            {
                return;
            }
            OutDoc curDoc = tagInfo.ownerDoc;
            int    index = curDoc.TagInfoList.IndexOf(tagInfo);
            int    selStart, selLength;

            lbFileName.Text = curDoc.FileName;
            lVFileAttribute.Items.Clear();
            foreach (KeyValuePair <string, string> prop in curDoc.DocProperties)
            {
                lVFileAttribute.Items.Add(prop.Key).SubItems.Add(prop.Value);
            }
            rTBDoc.Text = curDoc.Content;
            if (curDoc.GetTagOffset(index, out selStart, out selLength))
            {
                rTBDoc.Select(selStart, selLength);
            }
            rTBDoc.ScrollToCaret();
        }
Exemple #7
0
 public TagInfo(XmlElement xmlElement, OutDoc outDoc)
 {
     AssignElement(xmlElement, outDoc);
 }