internal FtpFile(FtpDirectory parent, ref ItemInfo info) { m_parent = parent; m_name = info.name; m_size = info.size; m_permission= info.permission; }
private bool ParseListLine(string line, ref ItemInfo info) { Match m; if((m = MatchingListLine(line)) == null) return false; info.Init(); info.name = m.Groups["name"].Value; info.fullPath = m_fullPath + info.name; string dir = m.Groups["dir"].Value; if(dir != "" && dir != "-") { info.isDirectory = true; info.fullPath += "/"; }else info.size = long.Parse(m.Groups["size"].Value); string permission = m.Groups["permission"].Value; if(permission != "") info.permission = permission; return true; }
private void LoadDirecotryItems() { if(m_session.CurrentDirectory != this) throw new InvalidOperationException(m_name + " is not current active directory"); Queue lineQueue = m_session.ControlChannel.List(false); ItemInfo info = new ItemInfo(); foreach(string line in lineQueue) { if(ParseListLine(line, ref info)) { if(info.isDirectory) m_subDirectories.Add(info.name, new FtpDirectory(m_session, m_fullPath, info.name)); else m_files.Add(info.name, new FtpFile(this, ref info)); } } }