Esempio n. 1
0
 internal void AddCompletedRecorderItem(RecorderItem recorderItem)
 {
     if (recorderItem != null && recorderItem.IsCompleted)
     {
         _recorderItemList.Add(recorderItem);
     }
 }
Esempio n. 2
0
        private void BuildChildRecorderItemTree(RecorderItem parentRecorderItem)
        {
            var childRecorderItems = GetChildRecorderItems(parentRecorderItem);

            foreach (var childRecorderItem in childRecorderItems)
            {
                childRecorderItem.TreeNodeDeepLevel  = parentRecorderItem.TreeNodeDeepLevel + 1;
                childRecorderItem.ParentRecorderItem = parentRecorderItem;
                parentRecorderItem.ChildRecorderItems.Add(childRecorderItem);
                BuildChildRecorderItemTree(childRecorderItem);
            }
        }
Esempio n. 3
0
 private string GetTimePercent(RecorderItem recorderItem)
 {
     if (recorderItem.TreeNodeDeepLevel == 1)
     {
         var totalTicks = GetTotalTicks();
         return((int)totalTicks == 0 ? "0.00%" : (recorderItem.TotalTicks / totalTicks).ToString("##.##%"));
     }
     if (recorderItem.TreeNodeDeepLevel >= 2)
     {
         return((int)recorderItem.ParentRecorderItem.TotalTicks == 0 ? "0.00%" : (recorderItem.TotalTicks / recorderItem.ParentRecorderItem.TotalTicks).ToString("##.##%"));
     }
     return("0.00%");
 }
Esempio n. 4
0
        private void GenerateRecorderItemTimeStrings(RecorderItem recorderItem, string leftSpace, string unitIndentString, List <string> recorderItemTimeStrings)
        {
            const string recorderItemTimeStringFormat    = "{0}{1}({2})  {3}  {4}  {5}";
            var          recorderItemTimeLeftSpaceString = leftSpace;

            for (var i = 0; i <= recorderItem.TreeNodeDeepLevel - 1; i++)
            {
                recorderItemTimeLeftSpaceString += unitIndentString;
            }

            recorderItemTimeStrings.Add(string.Format(recorderItemTimeStringFormat, new object[] { recorderItemTimeLeftSpaceString, (recorderItem.TotalTicks / 10000) + "ms", GetTimePercent(recorderItem), recorderItem.Description, recorderItem.StartTime + ":" + recorderItem.StartTime.Millisecond, recorderItem.EndTime + ":" + recorderItem.EndTime.Millisecond }));

            foreach (var childRecorderItem in recorderItem.ChildRecorderItems)
            {
                GenerateRecorderItemTimeStrings(childRecorderItem, leftSpace, unitIndentString, recorderItemTimeStrings);
            }
        }
Esempio n. 5
0
 private bool IsTopLevelRecorderItem(RecorderItem recorderItem)
 {
     return recorderItem != null && _recorderItemList.Where(a => a.Id != recorderItem.Id).All(a => !(a.StartTicks < recorderItem.StartTicks) || !(a.EndTicks > recorderItem.EndTicks));
 }
Esempio n. 6
0
 private string GetTimePercent(RecorderItem recorderItem)
 {
     if (recorderItem.TreeNodeDeepLevel == 1)
     {
         var totalTicks = GetTotalTicks();
         return (int)totalTicks == 0 ? "0.00%" : (recorderItem.TotalTicks / totalTicks).ToString("##.##%");
     }
     if (recorderItem.TreeNodeDeepLevel >= 2)
     {
         return (int)recorderItem.ParentRecorderItem.TotalTicks == 0 ? "0.00%" : (recorderItem.TotalTicks / recorderItem.ParentRecorderItem.TotalTicks).ToString("##.##%");
     }
     return "0.00%";
 }
Esempio n. 7
0
 private RecorderItem GetDirectParent(RecorderItem recorderItem)
 {
     return recorderItem == null ? null : _recorderItemList.Where(a => recorderItem.Id != a.Id).FirstOrDefault(a => a.StartTicks < recorderItem.StartTicks && a.EndTicks > recorderItem.EndTicks);
 }
Esempio n. 8
0
 private IEnumerable<RecorderItem> GetChildRecorderItems(RecorderItem parentRecorderItem)
 {
     return parentRecorderItem == null ? new List<RecorderItem>() : (from recorderItem in _recorderItemList where recorderItem.Id != parentRecorderItem.Id where recorderItem.StartTicks > parentRecorderItem.StartTicks && recorderItem.EndTicks < parentRecorderItem.EndTicks let directParent = GetDirectParent(recorderItem) where directParent != null && directParent.Id == parentRecorderItem.Id select recorderItem).ToList();
 }
Esempio n. 9
0
        private void GenerateRecorderItemTimeStrings(RecorderItem recorderItem, string leftSpace, string unitIndentString, List<string> recorderItemTimeStrings)
        {
            const string recorderItemTimeStringFormat = "{0}{1}({2})  {3}  {4}  {5}";
            var recorderItemTimeLeftSpaceString = leftSpace;
            for (var i = 0; i <= recorderItem.TreeNodeDeepLevel - 1; i++)
            {
                recorderItemTimeLeftSpaceString += unitIndentString;
            }

            recorderItemTimeStrings.Add(string.Format(recorderItemTimeStringFormat, new object[] { recorderItemTimeLeftSpaceString, (recorderItem.TotalTicks / 10000) + "ms", GetTimePercent(recorderItem), recorderItem.Description, recorderItem.StartTime + ":" + recorderItem.StartTime.Millisecond, recorderItem.EndTime + ":" + recorderItem.EndTime.Millisecond }));

            foreach (var childRecorderItem in recorderItem.ChildRecorderItems)
            {
                GenerateRecorderItemTimeStrings(childRecorderItem, leftSpace, unitIndentString, recorderItemTimeStrings);
            }
        }
Esempio n. 10
0
 private void BuildChildRecorderItemTree(RecorderItem parentRecorderItem)
 {
     var childRecorderItems = GetChildRecorderItems(parentRecorderItem);
     foreach (var childRecorderItem in childRecorderItems)
     {
         childRecorderItem.TreeNodeDeepLevel = parentRecorderItem.TreeNodeDeepLevel + 1;
         childRecorderItem.ParentRecorderItem = parentRecorderItem;
         parentRecorderItem.ChildRecorderItems.Add(childRecorderItem);
         BuildChildRecorderItemTree(childRecorderItem);
     }
 }
Esempio n. 11
0
 internal void AddCompletedRecorderItem(RecorderItem recorderItem)
 {
     if (recorderItem != null && recorderItem.IsCompleted)
     {
         _recorderItemList.Add(recorderItem);
     }
 }
Esempio n. 12
0
 private IEnumerable <RecorderItem> GetChildRecorderItems(RecorderItem parentRecorderItem)
 {
     return(parentRecorderItem == null ? new List <RecorderItem>() : (from recorderItem in _recorderItemList where recorderItem.Id != parentRecorderItem.Id where recorderItem.StartTicks > parentRecorderItem.StartTicks && recorderItem.EndTicks < parentRecorderItem.EndTicks let directParent = GetDirectParent(recorderItem) where directParent != null && directParent.Id == parentRecorderItem.Id select recorderItem).ToList());
 }
Esempio n. 13
0
 private RecorderItem GetDirectParent(RecorderItem recorderItem)
 {
     return(recorderItem == null ? null : _recorderItemList.Where(a => recorderItem.Id != a.Id).FirstOrDefault(a => a.StartTicks < recorderItem.StartTicks && a.EndTicks > recorderItem.EndTicks));
 }
Esempio n. 14
0
 private bool IsTopLevelRecorderItem(RecorderItem recorderItem)
 {
     return(recorderItem != null && _recorderItemList.Where(a => a.Id != recorderItem.Id).All(a => !(a.StartTicks < recorderItem.StartTicks) || !(a.EndTicks > recorderItem.EndTicks)));
 }