private void CreateByTemplate(string xml) { using (CreateCustomFilterByTemplateDialog createCustomFilterByTemplateDialog = new CreateCustomFilterByTemplateDialog(this, errorReport)) { try { createCustomFilterByTemplateDialog.Initialize(xml); } catch (AppSettingsException e) { ExceptionManager.ReportCommonErrorToUser(e); } if (userIP.ShowDialog(createCustomFilterByTemplateDialog, appForm) == DialogResult.OK) { ListViewItem listViewItem = new ListViewItem(new string[3] { createCustomFilterByTemplateDialog.CurrentFilter.FilterName, (!string.IsNullOrEmpty(createCustomFilterByTemplateDialog.CurrentFilter.FilterDescription)) ? createCustomFilterByTemplateDialog.CurrentFilter.FilterDescription : string.Empty, createCustomFilterByTemplateDialog.CurrentFilter.Expression }); listViewItem.Tag = createCustomFilterByTemplateDialog.CurrentFilter; listFilters.Items.Add(listViewItem); } } }
public bool SaveProjectAs() { string filePath = null; using (SaveFileDialog saveFileDialog = new SaveFileDialog()) { saveFileDialog.Title = SR.GetString("PrjMgr_SaveTitle"); saveFileDialog.Filter = SR.GetString("PrjMgr_OpenFilter"); saveFileDialog.CheckPathExists = true; saveFileDialog.OverwritePrompt = true; if (userIP.ShowDialog(saveFileDialog, null) != DialogResult.OK) { return(true); } filePath = saveFileDialog.FileName; } try { if (SaveProjectToFile(filePath)) { currentProjectFilePath = filePath; ProjectNameChangedHelper(); return(true); } return(false); } catch (TraceViewerException e) { ExceptionManager.ReportCommonErrorToUser(e); return(true); } }
public bool SaveProject() { if (!string.IsNullOrEmpty(CurrentProjectFilePath)) { try { return(SaveProjectToFile(CurrentProjectFilePath)); } catch (TraceViewerException e) { ExceptionManager.ReportCommonErrorToUser(e); return(SaveProjectAs()); } } return(SaveProjectAs()); }
private string[] ExtraceFilePathsFromProject(string path) { try { List <string> list = new List <string>(); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(path); foreach (XmlNode childNode in xmlDocument.ChildNodes) { if (childNode.Name == "traceviewer_project") { foreach (XmlNode childNode2 in childNode.ChildNodes) { if (childNode2.Name == "e2efile" && childNode2.Attributes["path"] != null) { string text = CanonicalizeFilePath(childNode2.Attributes["path"].Value.Trim(), path); if (!IsAbsoluteFilePath(text)) { text = GetAbsolutePath(text, path); } text = text.ToLower(CultureInfo.CurrentCulture); if (!list.Contains(text)) { list.Add(text); } } } } } currentProjectFilePath = path; string[] array = new string[list.Count]; list.CopyTo(array); openedFilePaths = list; ProjectNameChangedHelper(); return(array); } catch (XmlException ex) { ExceptionManager.ReportCommonErrorToUser(new TraceViewerException(SR.GetString("PrjMgr_FailOpen") + ex.Message)); return(null); } catch (Exception ex2) { ExceptionManager.ReportCommonErrorToUser(new TraceViewerException(SR.GetString("PrjMgr_FailOpen") + ex2.Message)); return(null); } }