コード例 #1
0
 // Methods
 internal ImplicitCounterInstance(PmcCategory Category, string instanceName)
 {
     m_Counters = null;
       m_InstanceName = null;
       m_Category = null;
       if (Category == null)
       {
     throw new InvalidOperationException("Category not set.");
       }
       if (instanceName.Trim() == "")
       {
     throw new InvalidOperationException("Instance name not set.");
       }
       m_Category = Category;
       m_InstanceName = instanceName;
       m_Counters = new ImplicitCounters(Category, m_InstanceName);
 }
コード例 #2
0
 // Methods
 public PmcImplicitCounter(string Name, string Help, PerformanceCounterType PmcType, PmcCategory HostCategory,
                       string InstanceName, Type declaringType)
 {
     m_Name = string.Empty;
       m_Help = string.Empty;
       m_Type = PerformanceCounterType.NumberOfItems32;
       m_HostCategory = null;
       m_InstanceName = null;
       m_DeclaringType = null;
       m_Bound = false;
       m_PerfCounter = null;
       if (declaringType.BaseType != typeof (ImplicitCounter))
       {
     throw new InvalidOperationException("Invalid DeclaringType. This type must be derived from ImplicitCounter");
       }
       m_Name = Name;
       m_Help = Help;
       m_Type = PmcType;
       m_HostCategory = HostCategory;
       m_InstanceName = InstanceName;
       m_DeclaringType = DeclaringType;
 }
コード例 #3
0
 public void Add(string TypeName, PmcCategory Instance)
 {
     m_Categories.Add(TypeName, Instance);
 }
コード例 #4
0
 // Methods
 internal ImplicitCounters(PmcCategory Category, string InstanceName)
 {
     m_Counters = new Hashtable();
       m_Category = null;
       m_InstanceName = null;
       if (Category == null)
       {
     throw new InvalidOperationException("Category not set.");
       }
       if (InstanceName == null)
       {
     throw new InvalidOperationException("Instance name not set.");
       }
       m_Category = Category;
       m_InstanceName = InstanceName;
 }
コード例 #5
0
ファイル: PmcManager.cs プロジェクト: bmadarasz/ndihelpdesk
 private static void ExploreImplicitPmcDefinitionOnMethods(MethodBase[] methods,
                                                       PmcHostCategoryDefinedEnum AttributeDefindedInAssembly,
                                                       PmcHostCategoryDefinedEnum AttributeDefiedInClass)
 {
     foreach (MethodBase base1 in methods)
       {
     PmcHostCategoryDefinedEnum enum1 = PmcHostCategoryDefinedEnum.CategoryInstanceDefinitionNotFound;
     object[] objArray1 = base1.GetCustomAttributes(typeof (ImplicitPmcAttribute), false);
     int num2 = 0;
     while (num2 < objArray1.Length)
     {
       ImplicitPmcAttribute attribute1 = (ImplicitPmcAttribute) objArray1[num2];
       if (attribute1.Enabled)
       {
     enum1 = PmcHostCategoryDefinedEnum.CategoryInstanceAllowed;
     break;
       }
       enum1 = PmcHostCategoryDefinedEnum.CategoryInstanceDenied;
       break;
     }
     if (((((enum1 == PmcHostCategoryDefinedEnum.CategoryInstanceAllowed) ||
        ((enum1 == PmcHostCategoryDefinedEnum.CategoryInstanceDefinitionNotFound) &&
         (AttributeDefiedInClass == PmcHostCategoryDefinedEnum.CategoryInstanceAllowed))) ||
       (((enum1 == PmcHostCategoryDefinedEnum.CategoryInstanceDefinitionNotFound) &&
         (AttributeDefiedInClass == PmcHostCategoryDefinedEnum.CategoryInstanceDefinitionNotFound)) &&
        (AttributeDefindedInAssembly == PmcHostCategoryDefinedEnum.CategoryInstanceAllowed))) &&
      (enum1 != PmcHostCategoryDefinedEnum.CategoryInstanceDenied)) &&
     (AttributeDefiedInClass != PmcHostCategoryDefinedEnum.CategoryInstanceDenied))
     {
       string text1 = ReflectionHelper.GetAssemblyName(base1.DeclaringType.Assembly);
       string text2 = GetPmcCategoryName(base1.DeclaringType.Assembly);
       if (!m_Categories.ContainsKey(text1))
       {
     PmcCategory category1 = new PmcCategory(text1, text1 + " generated category", text2);
     m_Categories.Add(text1, category1);
       }
       AddCategoryInstances(base1.DeclaringType.Assembly, base1);
     }
       }
 }