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); } } }
//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); }
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; }
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(); } }
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(); } } }
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(); }
public TagInfo(XmlElement xmlElement, OutDoc outDoc) { AssignElement(xmlElement, outDoc); }