PerformanceCounterPermissionEntry.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Services / Monitoring / system / Diagnosticts / PerformanceCounterPermissionEntry.cs / 1305376 / PerformanceCounterPermissionEntry.cs

                            //---------------------------------------------------- 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Diagnostics { 
    using System.ComponentModel; 
    using System.Security.Permissions;
 
    [
    Serializable()
    ]
    public class PerformanceCounterPermissionEntry { 
        private string categoryName;
        private string machineName; 
        private PerformanceCounterPermissionAccess permissionAccess; 

        public PerformanceCounterPermissionEntry(PerformanceCounterPermissionAccess permissionAccess, string machineName, string categoryName) { 
            if (categoryName == null)
                throw new ArgumentNullException("categoryName");
            if (( (int) permissionAccess & ~(0x7)) != 0)
                throw new ArgumentException(SR.GetString(SR.InvalidParameter,  "permissionAccess", permissionAccess)); 

            if (machineName == null) 
                throw new ArgumentNullException("machineName"); 
            if (!SyntaxCheck.CheckMachineName(machineName))
                throw new ArgumentException(SR.GetString(SR.InvalidParameter, "MachineName", machineName)); 

            this.permissionAccess = permissionAccess;
            this.machineName = machineName;
            this.categoryName = categoryName; 
        }
 
        /// 
        internal PerformanceCounterPermissionEntry(ResourcePermissionBaseEntry baseEntry) {
            this.permissionAccess = (PerformanceCounterPermissionAccess)baseEntry.PermissionAccess; 
            this.machineName = baseEntry.PermissionAccessPath[0];
            this.categoryName = baseEntry.PermissionAccessPath[1];
        }
 
        public string CategoryName {
            get { 
                return this.categoryName; 
            }
        } 

        public string MachineName {
            get {
                return this.machineName; 
            }
        } 
 
        public PerformanceCounterPermissionAccess PermissionAccess {
            get { 
                return this.permissionAccess;
            }
        }
 
        ///
        internal ResourcePermissionBaseEntry GetBaseEntry() { 
            ResourcePermissionBaseEntry baseEntry = new ResourcePermissionBaseEntry((int)this.PermissionAccess, new string[] {this.MachineName, this.CategoryName}); 
            return baseEntry;
        } 
    }
}


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK