private void FillInstanceInfo(NetSingleInstanceCategory category, CategoryAggregatedInfo categoryInfo, List <InstanceAggregatedInfo> result)
        {
            var info = CreateInstanceAggregatedInfo(category, categoryInfo);

            FillCountersInfo(category, info.Counters);
            result.Add(info);
        }
        public CategoryAggregatedInfo(Category srcCategory, CategoryAggregatedInfo parent)
        {
            if (srcCategory == null)
            {
                throw new ArgumentNullException("srcCategory");
            }

            SourceCategory     = srcCategory;
            Parent             = parent;
            Instances          = new List <InstanceAggregatedInfo>();
            CounterDescriptors = new List <CounterDescriptorAggregatedInfo>();

            if (parent != null)
            {
                NamePath = new string[parent.NamePath.Length + 1];
                Array.Copy(parent.NamePath, NamePath, parent.NamePath.Length);
                NamePath[NamePath.Length - 1] = srcCategory.Name;
            }
            else
            {
                NamePath = new string[1] {
                    srcCategory.Name
                };
            }

            JoinedNamePath = String.Join(".", NamePath);
        }
 /// <summary>
 /// Заполнить список описателей счётчиков в категории
 /// </summary>
 private void FillCounterDescriptors(CategoryAggregatedInfo categoryInfo, List <CounterDescriptorAggregatedInfo> result)
 {
     if (categoryInfo.Type == CategoryTypes.SingleInstance)
     {
         FillCounterDescriptors(categoryInfo.SourceSingleInstanceCategory, result);
     }
     else if (categoryInfo.Type == CategoryTypes.MultiInstance)
     {
         FillCounterDescriptors(categoryInfo.SourceMultiInstanceCategory, result);
     }
 }
        private void FillInstanceInfo(NetMultiInstanceCategory category, CategoryAggregatedInfo categoryInfo, List <InstanceAggregatedInfo> result)
        {
            category.MarkChildInstancesChangedAsViewed();

            foreach (var instance in category.Instances.Cast <NetInstanceInMultiInstanceCategory>())
            {
                var info = CreateInstanceAggregatedInfo(instance, categoryInfo);
                FillCountersInfo(instance, info.Counters);
                result.Add(info);
            }
        }
 /// <summary>
 /// Заполнить информацию по инстансам категории
 /// </summary>
 private void FillInstanceInfo(CategoryAggregatedInfo categoryInfo, List <InstanceAggregatedInfo> result)
 {
     if (categoryInfo.Type == CategoryTypes.SingleInstance)
     {
         FillInstanceInfo(categoryInfo.SourceSingleInstanceCategory, categoryInfo, result);
     }
     else if (categoryInfo.Type == CategoryTypes.MultiInstance)
     {
         FillInstanceInfo(categoryInfo.SourceMultiInstanceCategory, categoryInfo, result);
     }
 }
        /// <summary>
        /// Заполнить информацию по категории (работает рекурсивно)
        /// </summary>
        /// <param name="category">Исходная категория</param>
        /// <param name="parent">Описатель родительской категории</param>
        /// <param name="result">Список для заполнения</param>
        private void FillCategotyInfo(Category category, CategoryAggregatedInfo parent, List <CategoryAggregatedInfo> result)
        {
            CategoryAggregatedInfo current = CreateCategoryAggregatedInfo(category, parent);

            current.SourceCategoryExtended.MarkChildCategoriesChangedAsViewed();
            FillInstanceInfo(current, current.Instances);
            FillCounterDescriptors(current, current.CounterDescriptors);
            result.Add(current);

            var childCategories = current.SourceCategoryExtended.ChildCategories;

            for (int i = 0; i < childCategories.Count; i++)
            {
                FillCategotyInfo(childCategories[i], current, result);
            }
        }
 protected virtual InstanceAggregatedInfo CreateInstanceAggregatedInfo(NetSingleInstanceCategory category, CategoryAggregatedInfo thisCategoryInfo)
 {
     return(new InstanceAggregatedInfo(category));
 }
 protected virtual InstanceAggregatedInfo CreateInstanceAggregatedInfo(NetInstanceInMultiInstanceCategory instance, CategoryAggregatedInfo parent)
 {
     return(new InstanceAggregatedInfo(instance));
 }
 protected virtual CategoryAggregatedInfo CreateCategoryAggregatedInfo(Category srcCategory, CategoryAggregatedInfo parent)
 {
     return(new CategoryAggregatedInfo(srcCategory, parent));
 }