コード例 #1
0
 public ActiveDirectorySubnet(DirectoryContext context, string subnetName, string siteName) : this(context, subnetName)
 {
     if (siteName != null)
     {
         if (siteName.Length != 0)
         {
             try
             {
                 this.site = ActiveDirectorySite.FindByName(this.context, siteName);
             }
             catch (ActiveDirectoryObjectNotFoundException activeDirectoryObjectNotFoundException)
             {
                 object[] objArray = new object[1];
                 objArray[0] = siteName;
                 throw new ArgumentException(Res.GetString("SiteNotExist", objArray), "siteName");
             }
             return;
         }
         else
         {
             throw new ArgumentException(Res.GetString("EmptyStringParameter"), "siteName");
         }
     }
     else
     {
         throw new ArgumentNullException("siteName");
     }
 }
コード例 #2
0
 internal ActiveDirectorySubnet(DirectoryContext context, string subnetName, string siteName, bool existing)
 {
     this.context = context;
     this.name    = subnetName;
     if (siteName != null)
     {
         try
         {
             this.site = ActiveDirectorySite.FindByName(context, siteName);
         }
         catch (ActiveDirectoryObjectNotFoundException)
         {
             throw new ArgumentException(Res.GetString("SiteNotExist", new object[] { siteName }), "siteName");
         }
     }
     this.existing = true;
 }
コード例 #3
0
 public ActiveDirectorySubnet(DirectoryContext context, string subnetName, string siteName) : this(context, subnetName)
 {
     if (siteName == null)
     {
         throw new ArgumentNullException("siteName");
     }
     if (siteName.Length == 0)
     {
         throw new ArgumentException(Res.GetString("EmptyStringParameter"), "siteName");
     }
     try
     {
         this.site = ActiveDirectorySite.FindByName(this.context, siteName);
     }
     catch (ActiveDirectoryObjectNotFoundException)
     {
         throw new ArgumentException(Res.GetString("SiteNotExist", new object[] { siteName }), "siteName");
     }
 }
コード例 #4
0
        internal ActiveDirectorySubnet(DirectoryContext context, string subnetName, string siteName, bool existing)
        {
            Debug.Assert(existing == true);

            this.context = context;
            _name        = subnetName;

            if (siteName != null)
            {
                try
                {
                    _site = ActiveDirectorySite.FindByName(context, siteName);
                }
                catch (ActiveDirectoryObjectNotFoundException)
                {
                    throw new ArgumentException(Res.GetString(Res.SiteNotExist, siteName), "siteName");
                }
            }

            this.existing = true;
        }
コード例 #5
0
        public ActiveDirectorySubnet(DirectoryContext context, string subnetName, string siteName) : this(context, subnetName)
        {
            if (siteName == null)
            {
                throw new ArgumentNullException("siteName");
            }

            if (siteName.Length == 0)
            {
                throw new ArgumentException(Res.GetString(Res.EmptyStringParameter), "siteName");
            }

            // validate that siteName is valid
            try
            {
                _site = ActiveDirectorySite.FindByName(this.context, siteName);
            }
            catch (ActiveDirectoryObjectNotFoundException)
            {
                throw new ArgumentException(Res.GetString(Res.SiteNotExist, siteName), "siteName");
            }
        }