private void rightSplitter_SplitterMoving(object sender, SplitterEventArgs e) { try { ObjectStateController.SwitchState("AdjustingTimeRangeByScroller"); if (e.SplitX < leftEmptyPanel.Size.Width + 3) { e.SplitX = leftEmptyPanel.Size.Width + 3; } if (e.SplitX == leftEmptyPanel.Size.Width + 3) { RefreshEndDateTime(StartDateTime); } else { int value = e.SplitX - 3; DateTime dateTime = CalculateDateTimeByStepValue(value); RefreshEndDateTime(dateTime); } } catch (Exception e2) { ExceptionManager.GeneralExceptionFilter(e2); } }
protected override int Compare(object x, object y) { int result = 0; try { if (x == null) { return(result); } if (y == null) { return(result); } long num = long.Parse((string)x, CultureInfo.InvariantCulture); long num2 = long.Parse((string)y, CultureInfo.InvariantCulture); if (num > num2) { return((!base.IsAscendingSortOrder) ? (result = -1) : (result = 1)); } if (num < num2) { return((!base.IsAscendingSortOrder) ? (result = 1) : (result = -1)); } return(result); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); return(result); } }
private void CreateNodeByXmlNode(XmlNode node, TreeNode treeNode, string xpathRoot) { try { TreeNode treeNode2 = new TreeNode(node.Name); TreeXmlNodeNodeTag treeXmlNodeNodeTag = new TreeXmlNodeNodeTag(); treeXmlNodeNodeTag.XpathExpression0 = xpathRoot + "/" + GetNamespacePrefix(node) + NormalizeXPathElementName(node.Name); treeXmlNodeNodeTag.XpathExpression1 = xpathRoot + "/" + GetNamespacePrefix(node) + NormalizeXPathElementName(node.Name) + "[text()='{0}']"; treeXmlNodeNodeTag.XmlNode = node; treeNode2.Tag = treeXmlNodeNodeTag; if (node.Attributes != null && node.Attributes.Count != 0) { TreeNode treeNode3 = new TreeNode(SR.GetString("CF_Attr2")); treeNode3.Tag = null; foreach (XmlAttribute attribute in node.Attributes) { if (!attribute.Name.Contains("xmlns")) { TreeNode treeNode4 = new TreeNode(attribute.Name + SR.GetString("CF_Equal") + attribute.Value); TreeAttributeNodeTag treeAttributeNodeTag = new TreeAttributeNodeTag(); treeAttributeNodeTag.XpathExpression0 = xpathRoot + "/" + GetNamespacePrefix(node) + NormalizeXPathElementName(node.Name) + "[@" + GetNamespacePrefix(attribute) + NormalizeXPathElementName(attribute.Name) + "]"; treeAttributeNodeTag.XpathExpression1 = xpathRoot + "/" + GetNamespacePrefix(node) + NormalizeXPathElementName(node.Name) + "[@" + GetNamespacePrefix(attribute) + NormalizeXPathElementName(attribute.Name) + "='{0}']"; treeAttributeNodeTag.Name = attribute.Name; treeAttributeNodeTag.Value = attribute.Value; treeAttributeNodeTag.XmlNode = node; treeNode4.Tag = treeAttributeNodeTag; treeNode3.Nodes.Add(treeNode4); } } if (treeNode3.Nodes.Count != 0) { treeNode2.Nodes.Add(treeNode3); } } if (node.HasChildNodes) { foreach (XmlNode childNode in node.ChildNodes) { if (!(childNode.Name == "#text")) { CreateNodeByXmlNode(childNode, treeNode2, xpathRoot + "/" + GetNamespacePrefix(node) + NormalizeXPathElementName(node.Name)); } } } if (treeNode == null) { treeView.Nodes.Add(treeNode2); } else { treeNode.Nodes.Add(treeNode2); } } catch (Exception ex) { ExceptionManager.GeneralExceptionFilter(ex); throw new AppSettingsException(SR.GetString("CF_Err17"), ex); } }
private void ProjectNameChangedHelper() { try { ProjectChangedCallback(CurrentProjectFilePath); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } }
public void IndicateProgress(int activities, int traces) { RuntimeHelpers.PrepareConstrainedRegions(); try { traceViewerForm.Invoke(traceViewerForm.InternalIndicateToolStripProgressBarProxy, activities, traces); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } }
public void Step() { RuntimeHelpers.PrepareConstrainedRegions(); try { traceViewerForm.Invoke(traceViewerForm.InternalStepToolStripProgressBarProxy); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } }
private void btnAdjust_Click(object sender, EventArgs e) { if (timeRangeChangedCallback != null) { try { timeRangeChangedCallback(rangeControl.StartDateTime, rangeControl.EndDateTime); } catch (Exception e2) { ExceptionManager.GeneralExceptionFilter(e2); } } }
private void InternalEventTriggerHelper() { if (timeRangeChangeCallback != null) { try { timeRangeChangeCallback(StartDateTime, EndDateTime); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } } }
private void leftSplitter_SplitterMoving(object sender, SplitterEventArgs e) { try { ObjectStateController.SwitchState("AdjustingTimeRangeByScroller"); int splitX = e.SplitX; DateTime dateTime = CalculateDateTimeByStepValue(splitX); RefreshStartDateTime(dateTime); } catch (Exception e2) { ExceptionManager.GeneralExceptionFilter(e2); } }
public void Initialize(List <TraceViewerException> exceptionList) { this.exceptionList = exceptionList; foreach (TraceViewerException exception in exceptionList) { try { AppendExceptionToList(exception); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } } }
public void Close() { try { if (fileStream != null) { fileStream.Close(); } UnRegisterFileChangeCallback(); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } }
private void ReGroupTraceListByIO() { try { listTraces.BeginUpdate(); listTraces.VirtualMode = false; listTraces.Items.Clear(); listTraces.Groups.Clear(); Dictionary <int, ListViewGroup> dictionary = new Dictionary <int, ListViewGroup>(); foreach (ListViewItem currentListViewItem in currentListViewItems) { TraceRecord traceRecord = (TraceRecord)currentListViewItem.Tag; ListViewItem listViewItem = ComposeTraceListItem(traceRecord); int messageProperties = (int)traceRecord.MessageProperties; if (!dictionary.ContainsKey(messageProperties)) { switch (messageProperties) { case 0: dictionary.Add(messageProperties, new ListViewGroup(SR.GetString("GP_MsgIn"))); break; case 1: dictionary.Add(messageProperties, new ListViewGroup(SR.GetString("GP_MsgOut"))); break; case 2: dictionary.Add(messageProperties, new ListViewGroup(SR.GetString("GP_MsgUnkn"))); break; } listTraces.Groups.Add(dictionary[messageProperties]); } listViewItem.Group = dictionary[messageProperties]; listTraces.Items.Add(listViewItem); } SortByColumn(true, 1); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } finally { listTraces.EndUpdate(); traceCountStatusLabel.Text = SR.GetString("MsgView_Count") + listTraces.Items.Count.ToString(CultureInfo.InvariantCulture); } }
public object InvokeOnUIThread(Delegate d, params object[] props) { if ((object)d == null) { return(null); } RuntimeHelpers.PrepareConstrainedRegions(); try { return(traceViewerForm.Invoke(d, props)); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } return(null); }
private void fileSysWatcher_Changed(object sender, FileSystemEventArgs e) { lock (ThisLock) { if (e.ChangeType == WatcherChangeTypes.Changed && !string.IsNullOrEmpty(e.FullPath) && e.FullPath.Trim().ToLowerInvariant() == FilePath.Trim().ToLowerInvariant()) { try { sourceFileChangedCallback(e.FullPath); } catch (Exception e2) { ExceptionManager.GeneralExceptionFilter(e2); } } } }
public static Stream GetResourceFileStreamByName(string name) { if (!string.IsNullOrEmpty(name)) { try { if (!name.StartsWith("SvcTraceViewer.", StringComparison.Ordinal)) { name = "SvcTraceViewer." + name; } return(Assembly.GetExecutingAssembly().GetManifestResourceStream(name)); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } } return(null); }
private void EventCallback(ref NativeMethods.EventTrace et) { string text = null; RuntimeHelpers.PrepareConstrainedRegions(); try { text = MofUtils.GetXml(et); if (!string.IsNullOrEmpty(text)) { processor(new TraceEntry(text)); } } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); processor(new TraceEntry(null)); } }
static AppConfigManager() { instance = null; configFilePath = null; registeredPersistObjects = new List <IPersistStatus>(); try { string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); configFilePath = (folderPath.EndsWith(new string(new char[1] { Path.DirectorySeparatorChar }), StringComparison.CurrentCultureIgnoreCase) ? (folderPath + Path.GetFileName(Assembly.GetExecutingAssembly().CodeBase) + ".settings") : (folderPath + Path.DirectorySeparatorChar.ToString() + Path.GetFileName(Assembly.GetExecutingAssembly().CodeBase) + ".settings")); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); configFilePath = null; } }
protected void InvokeTaskFinishCallback() { lock (ThisLock) { if (taskFinishedCallback != null) { RuntimeHelpers.PrepareConstrainedRegions(); try { taskFinishedCallback(this); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } taskFinishedCallback = null; } } }
public DialogResult ShowMessageBox(string message, string title, MessageBoxIcon icon, MessageBoxButtons btn) { string caption = (!string.IsNullOrEmpty(title)) ? (traceViewerForm.DefaultWindowTitle + "-" + title) : traceViewerForm.DefaultWindowTitle; traceViewerForm.TraceDataSourceStateController.SwitchState("TraceDataSourceValidatingState"); RuntimeHelpers.PrepareConstrainedRegions(); try { return(MessageBox.Show(traceViewerForm, message, caption, btn, icon, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0)); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } finally { traceViewerForm.TraceDataSourceStateController.SwitchState("TraceDataSourceIdleState"); } return(DialogResult.Cancel); }
public void Clear() { try { listTraces.SuspendLayout(); listTraces.SelectedIndices.Clear(); listTraces.VirtualMode = false; listTraces.Items.Clear(); listTraces.Groups.Clear(); currentListViewItems.Clear(); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } finally { listTraces.ResumeLayout(); traceCountStatusLabel.Text = SR.GetString("MsgView_Count"); } }
public static object UIThreadInvokeHelper(IUserInterfaceProvider userIP, Delegate d, params object[] props) { if (userIP != null && (object)d != null) { RuntimeHelpers.PrepareConstrainedRegions(); try { if (props == null) { return(userIP.InvokeOnUIThread(d)); } return(userIP.InvokeOnUIThread(d, props)); } catch (Exception ex) { ExceptionManager.GeneralExceptionFilter(ex); ExceptionManager.LogAppError(new TraceViewerException(SR.GetString("MsgInvokeExceptionOccur"), ex.GetType().ToString() + SR.GetString("MsgReturnBack") + ex.ToString())); } } return(null); }
private void ReGroupTraceListByActivity() { try { listTraces.BeginUpdate(); listTraces.VirtualMode = false; listTraces.Items.Clear(); listTraces.Groups.Clear(); Dictionary <string, ListViewGroup> dictionary = new Dictionary <string, ListViewGroup>(); foreach (ListViewItem currentListViewItem in currentListViewItems) { TraceRecord traceRecord = (TraceRecord)currentListViewItem.Tag; ListViewItem listViewItem = ComposeTraceListItem(traceRecord); if (!string.IsNullOrEmpty(traceRecord.MessageActivityID)) { if (!dictionary.ContainsKey(traceRecord.MessageActivityID)) { ListViewGroup value = listTraces.Groups.Add(TraceViewerForm.GetActivityDisplayName(traceRecord.MessageActivityID), TraceViewerForm.GetActivityDisplayName(traceRecord.MessageActivityID)); dictionary.Add(traceRecord.MessageActivityID, value); } listViewItem.Group = dictionary[traceRecord.MessageActivityID]; } listTraces.Items.Add(listViewItem); } SortByColumn(true, 1); } catch (ArgumentOutOfRangeException) { } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } finally { listTraces.EndUpdate(); traceCountStatusLabel.Text = SR.GetString("MsgView_Count") + listTraces.Items.Count.ToString(CultureInfo.InvariantCulture); } }
private void ReGroupTraceListByProcess() { try { listTraces.BeginUpdate(); listTraces.VirtualMode = false; listTraces.Items.Clear(); listTraces.Groups.Clear(); Dictionary <int, ListViewGroup> dictionary = new Dictionary <int, ListViewGroup>(); foreach (ListViewItem currentListViewItem in currentListViewItems) { TraceRecord traceRecord = (TraceRecord)currentListViewItem.Tag; ListViewItem listViewItem = ComposeTraceListItem(traceRecord); int executionID = traceRecord.Execution.ExecutionID; if (!dictionary.ContainsKey(executionID)) { dictionary.Add(executionID, new ListViewGroup(traceRecord.Execution.ComputerName + SR.GetString("CF_Sep") + traceRecord.Execution.ProcessName + (TraceViewerForm.IsThreadExecutionMode ? (SR.GetString("CF_LeftB") + traceRecord.Execution.ThreadID + SR.GetString("CF_RightB")) : string.Empty))); listTraces.Groups.Add(dictionary[executionID]); } listViewItem.Group = dictionary[executionID]; listTraces.Items.Add(listViewItem); } SortByColumn(true, 1); } catch (ArgumentOutOfRangeException) { } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } finally { listTraces.EndUpdate(); traceCountStatusLabel.Text = SR.GetString("MsgView_Count") + listTraces.Items.Count.ToString(CultureInfo.InvariantCulture); } }
public ActivityTraceModeAnalyzer(Activity activeActivity, TraceDataSource dataSource, bool containsActivityBoundary, bool containsVerboseTraces, ActivityTraceModeAnalyzerParameters parameters, IErrorReport errorReport) { if (activeActivity != null && dataSource != null) { this.containsActivityBoundary = containsActivityBoundary; this.containsVerboseTraces = containsVerboseTraces; this.activeActivity = activeActivity; this.dataSource = dataSource; this.parameters = parameters; this.errorReport = errorReport; RuntimeHelpers.PrepareConstrainedRegions(); try { AnalysisRootActivity(ActiveActivity); ExpandTransfers(); CollapseTransfers(); ExpandActivities(); CheckSuppressedActivities(); SortResults(); UpdateParameters(); } catch (LogFileException e) { throw new TraceViewerException(SR.GetString("SL_ERROR_LOAD_TRACE"), e); } catch (TraceViewerException ex) { throw ex; } catch (Exception e2) { ExceptionManager.GeneralExceptionFilter(e2); throw new TraceViewerException(SR.GetString("SL_UnknownException"), e2); } } }
public override void GetTraces() { RuntimeHelpers.PrepareConstrainedRegions(); try { if (!isTraceOpen) { try { OpenLogFile(); } catch (Win32Exception) { throw new TraceViewerException(SR.GetString("MsgInvalidInputFile")); } } else if (handle == 0L) { throw new TraceViewerException(SR.GetString("MsgNullHandle")); } if (startTimeFilter != DateTime.MinValue || endTimeFilter != DateTime.MaxValue) { filterTimeRange = true; } else { filterTimeRange = false; } ulong[] handles = new ulong[1] { handle }; uint num; if (filterTimeRange) { NativeMethods.FileTime start = new NativeMethods.FileTime(startTimeFilter.ToFileTime()); NativeMethods.FileTime end = new NativeMethods.FileTime(endTimeFilter.ToFileTime()); num = NativeMethods.ProcessTrace(handles, 1u, ref start, ref end); if (num != 0) { throw new Win32Exception(Marshal.GetLastWin32Error()); } } else { num = NativeMethods.ProcessTrace(handles, 1u, IntPtr.Zero, IntPtr.Zero); if (num != 0) { throw new Win32Exception(Marshal.GetLastWin32Error()); } } if (num != 0 && num != 1223) { throw new TraceViewerException(SR.GetString("MsgProcessTraceFailed")); } } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); throw new TraceViewerException(SR.GetString("MsgUnhandledExceptionInEtwGetTraces")); } }
public void RefreshByTimeRange(DateTime start, DateTime end) { if (fileDescriptor != null && end >= start) { try { if (fileDescriptor.FileBlockCount == 0) { lblLoadSize.Text = SR.GetString("FileBlockInfo_LoadingSize") + SR.GetString("FileBlockInfo_EmptyFile"); lblLoadPercentage.Text = string.Empty; graphics.FillRectangle(selectedItemBrush, new Rectangle(new Point(0, 0), DrawPanel.Size)); } else { long num = 0L; long num2 = 0L; long num3 = 0L; if (end > start) { foreach (FileBlockInfo fileBlock in fileDescriptor.FileBlocks) { long num4 = fileBlock.EndFileOffset - fileBlock.StartFileOffset; if (num4 > 0) { if ((fileBlock.StartDate >= start && fileBlock.EndDate <= end) || (fileBlock.StartDate <= start && fileBlock.EndDate >= start) || (fileBlock.StartDate <= end && fileBlock.EndDate >= end)) { num2 += num4; } else if (fileBlock.EndDate < start) { num += num4; } else if (fileBlock.StartDate > end) { num3 += num4; } } else if (fileBlock.StartDate == fileBlock.EndDate) { if (fileBlock.StartDate >= start && fileBlock.StartDate <= end) { num2 += ((fileDescriptor.FileSize <= 5000000) ? fileDescriptor.FileSize : 5000000); } else if (fileBlock.StartDate < start) { num += ((fileDescriptor.FileSize <= 5000000) ? fileDescriptor.FileSize : 5000000); } else if (fileBlock.StartDate > end) { num3 += ((fileDescriptor.FileSize <= 5000000) ? fileDescriptor.FileSize : 5000000); } } else { num2 += ((fileDescriptor.FileSize <= 5000000) ? fileDescriptor.FileSize : 5000000); } } } else { num = fileDescriptor.FileSize; num3 = 0L; num2 = 0L; } graphics.FillRectangle(unselectedItemBrush, new Rectangle(new Point(0, 0), DrawPanel.Size)); if (num2 != 0L) { int num5 = (int)((double)num / (double)fileDescriptor.FileSize * (double)DrawPanel.Size.Width); int num6 = (int)((double)num3 / (double)fileDescriptor.FileSize * (double)DrawPanel.Size.Width); graphics.FillRectangle(selectedItemBrush, new Rectangle(num5, 0, DrawPanel.Size.Width - num5 - num6, DrawPanel.Size.Height)); } lblLoadSize.Text = SR.GetString("FileBlockInfo_LoadingSize") + Utilities.GetFileSizeString(num2); double num7 = 0.0; num7 = ((num2 + num + num3 == 0L) ? 0.0 : ((double)num2 / (double)(num2 + num + num3) * 100.0)); lblLoadPercentage.Text = SR.GetString("FileBlockInfo_LoadingPre") + num7.ToString("###.##", CultureInfo.CurrentCulture); startDateTime = start; endDateTime = end; } } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } } }
private void FilterNowAction() { FilterCriteria filterCriteria = new FilterCriteria(); filterCriteria.FilterSourceLevel = FilterEngine.ParseLevel((traceLevelList.SelectedItem != null) ? traceLevelList.SelectedItem.ToString() : SR.GetString("AppFilterItem1")); if (searchInList.SelectedIndex >= 12) { filterCriteria.SearchOption = SearchOptions.CustomFilter; } else { filterCriteria.SearchOption = FilterEngine.ParseSearchOption((searchInList.SelectedItem != null) ? searchInList.SelectedItem.ToString() : SR.GetString("AppFilterItem13")); } switch (filterCriteria.SearchOption) { case SearchOptions.EventID: case SearchOptions.SourceName: case SearchOptions.ProcessName: case SearchOptions.TraceCode: case SearchOptions.Description: case SearchOptions.EndpointAddress: case SearchOptions.AppDataSection: case SearchOptions.EntireRawData: filterCriteria.searchCondition = toolStripTextBoxLookFor.Text; break; case SearchOptions.StartTime: { DateTime value4 = dtpTime.Value; DateTime dateTime2 = new DateTime(value4.Year, value4.Month, value4.Day, value4.Hour, value4.Minute, value4.Second, 0, value4.Kind); filterCriteria.searchCondition = dateTime2; break; } case SearchOptions.StopTime: { DateTime value3 = dtpTime.Value; DateTime dateTime = new DateTime(value3.Year, value3.Month, value3.Day, value3.Hour, value3.Minute, value3.Second, 999, value3.Kind); filterCriteria.searchCondition = dateTime; break; } case SearchOptions.TimeRange: { DateTime value = dtpTimeFrom.Value; DateTime startTime = new DateTime(value.Year, value.Month, value.Day, value.Hour, value.Minute, value.Second, 0, value.Kind); DateTime value2 = dtpTimeTo.Value; DateTime endTime = new DateTime(value2.Year, value2.Month, value2.Day, value2.Hour, value2.Minute, value2.Second, 999, value2.Kind); filterCriteria.searchCondition = new DateTimePair(startTime, endTime); break; } case SearchOptions.CustomFilter: if (customFilterMap.ContainsKey(searchInList.SelectedIndex)) { filterCriteria.searchCondition = new CustomFilterCondition(); ((CustomFilterCondition)filterCriteria.searchCondition).customFilter = customFilterMap[searchInList.SelectedIndex]; if (((CustomFilterCondition)filterCriteria.searchCondition).customFilter.ContainsParameters) { string text = ((CustomFilterCondition)filterCriteria.searchCondition).customFilter.ParseXPathExpression(toolStripTextBoxLookFor.Text); if (string.IsNullOrEmpty(text)) { errorReport.ReportErrorToUser(SR.GetString("CF_IPError")); return; } ((CustomFilterCondition)filterCriteria.searchCondition).parsedXPathExpress = text; } } break; } FilterEngine.CurrentFilterCriteria = filterCriteria; try { if (this.TraceFilterChangedEvent != null) { this.TraceFilterChangedEvent(this, new TraceFilterChangedEventArgs(filterCriteria)); } } catch (Exception ex) { ExceptionManager.GeneralExceptionFilter(ex); ExceptionManager.LogAppError(new TraceViewerException(SR.GetString("MsgTraceFilterChangeCallbackError") + ex.Message)); } }
private void EtlToE2e(string sourceFileName, string convertedFilename) { string text = null; int num = 0; if (!string.IsNullOrEmpty(convertedFilename)) { TracesCollection tracesCollection = null; try { tracesCollection = new TracesCollection(sourceFileName, errorReport); } catch (FileNotFoundException e) { text = SR.GetString("MsgCannotFindFile") + sourceFileName; throw new FileConverterException(sourceFileName, convertedFilename, text, e); } catch (LogFileException e2) { text = SR.GetString("MsgCannotOpenFile") + sourceFileName + SR.GetString("MsgFilePathEnd"); throw new FileConverterException(sourceFileName, convertedFilename, text, e2); } DateTime startTime = tracesCollection.StartTime; XmlTextWriter xmlTextWriter = null; try { xmlTextWriter = new XmlTextWriter(convertedFilename, Encoding.UTF8); } catch (UnauthorizedAccessException e3) { text = SR.GetString("MsgCannotOpenFileReturn") + convertedFilename + SR.GetString("MsgReturnBack") + SR.GetString("MsgAccessDenied"); throw new FileConverterException(sourceFileName, convertedFilename, text, e3); } catch (SecurityException e4) { text = SR.GetString("MsgCannotOpenFileReturn") + convertedFilename + SR.GetString("MsgAccessDenied"); throw new FileConverterException(sourceFileName, convertedFilename, text, e4); } xmlTextWriter.Formatting = Formatting.Indented; int num2 = 100; int num3 = 0; progressReport.Begin(num2); foreach (TraceEntry item in tracesCollection) { if (item != null) { if (!item.IsErrorTrace) { try { xmlTextWriter.WriteRaw(item.Xml); } catch (Exception e5) { ExceptionManager.GeneralExceptionFilter(e5); num++; } } else { num++; } progressReport.Step(); if (++num3 > num2) { progressReport.Begin(num2); } } } xmlTextWriter.Flush(); xmlTextWriter.Close(); if (num != 0) { errorReport.ReportErrorToUser(new FileConverterException(sourceFileName, convertedFilename, SR.GetString("MsgFileConvertTraceErr"), null)); } } }
protected override int Compare(object x, object y) { int result = 0; try { if (tagComparison == ListViewItemTagComparerTarget.TraceTime && x is TraceRecord && y is TraceRecord) { result = traceLocationComparer.Compare(((TraceRecord)x).TraceRecordPos, ((TraceRecord)y).TraceRecordPos); int result2; if (!base.IsAscendingSortOrder) { switch (result) { default: result2 = 1; goto IL_0055; case 1: result2 = -1; goto IL_0055; case 0: { return(result); } IL_0055: return(result2); } } return(result); } if (!(x is Activity)) { return(result); } if (y is Activity) { DateTime startTime = ((Activity)x).StartTime; DateTime endTime = ((Activity)x).EndTime; DateTime startTime2 = ((Activity)y).StartTime; DateTime endTime2 = ((Activity)y).EndTime; switch (tagComparison) { case ListViewItemTagComparerTarget.ActivityDuration: if (!(endTime >= startTime)) { return(result); } if (endTime2 >= startTime2) { TimeSpan t = endTime - startTime; TimeSpan t2 = endTime2 - startTime2; if (t == t2) { return(0); } if (t > t2) { return(base.IsAscendingSortOrder ? 1 : (-1)); } return((!base.IsAscendingSortOrder) ? 1 : (-1)); } return(result); case ListViewItemTagComparerTarget.ActivityStartTime: if (startTime == startTime2) { if (endTime > endTime2) { return(-1); } if (endTime < endTime2) { return(1); } return(0); } if (startTime > startTime2) { return(base.IsAscendingSortOrder ? 1 : (-1)); } return((!base.IsAscendingSortOrder) ? 1 : (-1)); case ListViewItemTagComparerTarget.ActivityEndTime: if (endTime == endTime2) { if (startTime < startTime2) { return(-1); } if (startTime > startTime2) { return(1); } return(0); } if (endTime > endTime2) { return(base.IsAscendingSortOrder ? 1 : (-1)); } return((!base.IsAscendingSortOrder) ? 1 : (-1)); default: return(result); } } return(result); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); return(0); } }
private void InternalWriterTargetTraceRecord(InternalTargetTraceRecord trace, XmlWriter writer) { if (trace != null && writer != null) { try { writer.WriteStartElement("E2ETraceEvent", "http://schemas.microsoft.com/2004/06/E2ETraceEvent"); writer.WriteStartElement("System", "http://schemas.microsoft.com/2004/06/windows/eventlog/system"); writer.WriteStartElement("EventID"); writer.WriteString((!string.IsNullOrEmpty(trace.eventID)) ? trace.eventID : "0"); writer.WriteEndElement(); writer.WriteStartElement("Type"); writer.WriteString("3"); writer.WriteEndElement(); writer.WriteStartElement("SubType"); writer.WriteAttributeString("Name", trace.level.ToString()); writer.WriteEndElement(); writer.WriteStartElement("Level"); int level = (int)trace.level; writer.WriteString(level.ToString(CultureInfo.CurrentCulture)); writer.WriteEndElement(); writer.WriteStartElement("TimeCreated"); writer.WriteAttributeString("SystemTime", trace.createdDateTime.ToString(CultureInfo.CurrentUICulture)); writer.WriteEndElement(); writer.WriteStartElement("Source"); writer.WriteAttributeString("Name", trace.sourceName); if (!string.IsNullOrEmpty(trace.guid)) { writer.WriteAttributeString("Id", trace.guid); } writer.WriteEndElement(); writer.WriteStartElement("Correlation"); writer.WriteAttributeString("ActivityID", trace.activityID); if (!string.IsNullOrEmpty(trace.relatedActivityID)) { writer.WriteAttributeString("RelatedActivityID", trace.relatedActivityID); } writer.WriteEndElement(); writer.WriteStartElement("Execution"); writer.WriteAttributeString("ProcessID", trace.processID); writer.WriteAttributeString("ThreadID", trace.threadID); writer.WriteEndElement(); writer.WriteStartElement("Channel"); writer.WriteString(trace.channel); writer.WriteEndElement(); writer.WriteStartElement("Computer"); writer.WriteString(trace.computerName); writer.WriteEndElement(); writer.WriteStartElement("Security"); if (!string.IsNullOrEmpty(trace.userSid)) { writer.WriteAttributeString("UserSid", trace.userSid); } writer.WriteEndElement(); if (trace.sbUndefinedXmlInSystemXmlElement.Length != 0) { try { writer.WriteRaw(trace.sbUndefinedXmlInSystemXmlElement.ToString()); } catch (Exception e) { ExceptionManager.GeneralExceptionFilter(e); } } writer.WriteEndElement(); writer.WriteStartElement("ApplicationData"); writer.WriteStartElement("TraceData"); writer.WriteStartElement("DataItem"); if (trace.isTraceRecord) { writer.WriteRaw(trace.recordText); } else { writer.WriteStartElement("TraceRecord", "http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord"); writer.WriteAttributeString("Severity", trace.level.ToString()); writer.WriteStartElement("TraceIdentifier"); writer.WriteString(""); writer.WriteEndElement(); writer.WriteStartElement("Description"); writer.WriteString((!string.IsNullOrEmpty(trace.description)) ? trace.description : trace.sourceName); writer.WriteEndElement(); if (trace.eventDataSections.Count != 0 || trace.sbXmlExt.Length != 0) { writer.WriteStartElement("ExtendedData"); if (trace.eventDataSections.Count != 0) { foreach (string key in trace.eventDataSections.Keys) { writer.WriteStartElement(key); writer.WriteString(trace.eventDataSections[key]); writer.WriteEndElement(); } } if (trace.sbXmlExt.Length != 0) { try { writer.WriteRaw(trace.sbXmlExt.ToString()); } catch (Exception e2) { ExceptionManager.GeneralExceptionFilter(e2); } } writer.WriteEndElement(); } writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); } catch (InvalidOperationException) { } catch (ArgumentException) { } } }