예제 #1
0
        public IISFTPServer GetFTPServer(string sWerServerName)
        {
            DirectoryEntry directoryEntry2;

            DirectoryEntry directoryEntry3;

            IISFTPServer iISFTPServer = null;
            var          iEnumerator  = new DirectoryEntry("IIS://localhost/MSFTPSVC").Children.GetEnumerator();

            try
            {
                while (iEnumerator.MoveNext())
                {
                    directoryEntry2 = (DirectoryEntry)iEnumerator.Current;
                    if (directoryEntry2.SchemaClassName == "IIsFtpServer" &&
                        ((String)directoryEntry2.Properties["ServerComment"].Value).Equals(sWerServerName))
                    {
                        iISFTPServer = new IISFTPServer
                        {
                            iID             = Convert.ToInt32(directoryEntry2.Name),
                            sServerName     = (String)directoryEntry2.Properties["ServerComment"].Value,
                            bAllowAnonymous =
                                (bool)directoryEntry2.Properties["AllowAnonymous"].Value,
                            sGreetingMessage =
                                (String)directoryEntry2.Properties["GreetingMessage"].Value,
                            sExitMessage       = (String)directoryEntry2.Properties["ExitMessage"].Value,
                            sMaxClientsMessage =
                                (String)directoryEntry2.Properties["MaxClientsMessage"].Value,
                            iMaxConnections =
                                (int)directoryEntry2.Properties["MaxConnections"].Value
                        };
                        directoryEntry3 =
                            new DirectoryEntry(String.Concat("IIS://localhost/MSFTPSVC/", iISFTPServer.ID, "/Root"));
                        iISFTPServer.sRootPath = directoryEntry3.Properties["Path"][0] as String;
                        break;
                    }
                }
            }
            finally
            {
                var iDisposable = iEnumerator as IDisposable;
                if (iDisposable != null)
                {
                    iDisposable.Dispose();
                }
            }
            return(iISFTPServer);
        }
예제 #2
0
 public IISFTPServerCollection GetFTPServers()
 {
     var iISFTPServerCollection = new IISFTPServerCollection();
     IEnumerator iEnumerator = new DirectoryEntry("IIS://localhost/MSFTPSVC").Children.GetEnumerator();
     try
     {
         while (iEnumerator.MoveNext())
         {
             var directoryEntry2 = (DirectoryEntry) iEnumerator.Current;
             if (directoryEntry2.SchemaClassName == "IIsFtpServer")
             {
                 var iISFTPServer = new IISFTPServer
                                        {
                                            iID = Convert.ToInt32(directoryEntry2.Name),
                                            sServerName =
                                                (String) directoryEntry2.Properties["ServerComment"].Value,
                                            bAllowAnonymous =
                                                (bool) directoryEntry2.Properties["AllowAnonymous"].Value,
                                            sGreetingMessage =
                                                (String) directoryEntry2.Properties["GreetingMessage"].Value,
                                            sExitMessage =
                                                (String) directoryEntry2.Properties["ExitMessage"].Value,
                                            sMaxClientsMessage =
                                                (String) directoryEntry2.Properties["MaxClientsMessage"].Value,
                                            iMaxConnections =
                                                (int) directoryEntry2.Properties["MaxConnections"].Value
                                        };
                 var directoryEntry3 =
                     new DirectoryEntry(String.Concat("IIS://localhost/MSFTPSVC/", iISFTPServer.ID, "/Root"));
                 iISFTPServer.sRootPath = directoryEntry3.Properties["Path"][0] as String;
                 iISFTPServerCollection.Add(iISFTPServer);
             }
         }
     }
     finally
     {
         var iDisposable = iEnumerator as IDisposable;
         if (iDisposable != null)
         {
             iDisposable.Dispose();
         }
     }
     return iISFTPServerCollection;
 }
예제 #3
0
 public void Remove(IISFTPServer value)
 {
     List.Remove(value);
 }
예제 #4
0
 public void Insert(int index, IISFTPServer value)
 {
     List.Insert(index, value);
 }
예제 #5
0
 public int IndexOf(IISFTPServer value)
 {
     return List.IndexOf(value);
 }
예제 #6
0
 public bool Contains(IISFTPServer value)
 {
     return List.Contains(value);
 }
예제 #7
0
 public int Add(IISFTPServer value)
 {
     return List.Add(value);
 }
예제 #8
0
 public bool Contains(IISFTPServer value)
 {
     return(List.Contains(value));
 }
예제 #9
0
 public void Remove(IISFTPServer value)
 {
     List.Remove(value);
 }
예제 #10
0
 public void Insert(int index, IISFTPServer value)
 {
     List.Insert(index, value);
 }
예제 #11
0
 public int IndexOf(IISFTPServer value)
 {
     return(List.IndexOf(value));
 }
예제 #12
0
 public int Add(IISFTPServer value)
 {
     return(List.Add(value));
 }