예제 #1
0
 public FTPDirectory(FTPLink self)
 {
     this.Name    = self.GetLinkName();
     this.Date    = default;
     _directories = new List <FTPDirectory>();
     _files       = new List <FTPFile>();
     this.URL     = self.URL.TrimEnd('/');
 }
예제 #2
0
 public FTPDirectory(string name, DateTime date, FTPLink parent)
 {
     this.Name    = name;
     this.Date    = date;
     _directories = new List <FTPDirectory>();
     _files       = new List <FTPFile>();
     this.URL     = parent.URL + "/" + (name ?? "");
 }
예제 #3
0
 public FTPManager(string server)
 {
     _enUS             = new CultureInfo("en-US");
     _currentCulture   = Thread.CurrentThread.CurrentCulture;
     _currentUICulture = Thread.CurrentThread.CurrentUICulture;
     _rxDate           = new Regex(@"^(?<date>\d{1,2}\-\d{1,2}\-\d{2,4})(\s|\t)+(?<time>\d{1,2}\:\d{2}(\:\d{2})?([a-z]{2})?)", RegexOptions.IgnoreCase);
     _rxDir            = new Regex(_rxDate.ToString() + @"(\s|\t)+\<DIR\>(\s|\t)+(?<dir>.+)$", RegexOptions.IgnoreCase);
     _rxFile           = new Regex(_rxDate.ToString() + @"(\s|\t)+(?<size>\d+)(\s|\t)+(?<file>\w.+)$", RegexOptions.IgnoreCase);
     LastError         = null;
     this._server      = server;
 }
예제 #4
0
        /*
         * FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://servername/filepath"));
         * request.Proxy = null;
         * request.Credentials = new NetworkCredential("user", "password");
         * request.Method = WebRequestMethods.Ftp.GetFileSize;
         *
         * FtpWebResponse response = (FtpWebResponse)request.GetResponse();
         * long size = response.ContentLength;
         * response.Close();
         */



        /*public FTPDirectory GoBack()
         * {
         *  if (_parent != null)
         *  {
         *      _currentContent = _parent;
         *      _parent = _parent?.Parent as FTPDirectory;
         *  }
         *  return _currentContent;
         * }*/

        public FTPDirectory Load(FTPLink link = null)
        {
            FillContent(link?.URL ?? _server.URL);
            return(_currentDirectory);
        }