public override void list(string path, CallbackOnList callback = null) { try { if (this.connect()) { this.client.ChangeDirectory(path); foreach (var entry in client.ListDirectory(".")) { if (callback != null) { if (entry.Name != "." && entry.Name != "..") { callback(new DirInfo() { name = entry.Name, full = entry.FullName, isdir = entry.IsDirectory, ext = System.IO.Path.GetExtension(entry.Name), path = path }); } } } this.disconnect(); } } catch (Exception error) { if (this.log != null) { this.log(error.Message.ToString()); } } }
public void list(string path, CallbackOnList callback = null) { var driver = this.getDriver(); if (driver != null) { driver.list(path, callback); } }
public override void list(string path, CallbackOnList callback = null) { StreamReader reader = null; try { if (this.connect(path)) { request.Method = WebRequestMethods.Ftp.ListDirectoryDetails; reader = new StreamReader(request.GetResponse().GetResponseStream()); } } catch (Exception error) { reader = null; if (this.log != null) { this.log(error.Message.ToString()); } } if (reader != null && callback != null) { while (!reader.EndOfStream) { string line = reader.ReadLine(); string name = line.Substring(line.LastIndexOf(" ") + 1); if (callback != null) { callback(new DirInfo() { name = name, full = path + name, ext = System.IO.Path.GetExtension(name), // isdir = this.exists(path + name), //... lenta isdir = (System.IO.Path.GetExtension(name) == string.Empty), //... rapida no segura path = path }); } } } }
public abstract void list(string path, CallbackOnList callback = null);