public FormSiteScanner( FormFtpClient formMain, Site site, SiteEntry dirStart ) { InitializeComponent(); this.formMain = formMain; this.site = site; this.dirStart = dirStart; //this.ftp = new FtpClient( site.uri, site.cred ); //this.outputQueue = new ConcurrentQueue<AccItem>(); // prep grid gridDirs.Columns.Add( "Path", "Path" ); gridDirs.Columns.Add( "Files", "#Files" ); gridDirs.Columns.Add( "Dirs", "#Dirs" ); gridDirs.Columns.Add( "Links", "#Links" ); gridDirs.Columns.Add( "Size", "Size(b)" ); gridDirs.Columns["Path"].Width = 200; gridDirs.Columns["Files"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; gridDirs.Columns["Dirs"] .DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; gridDirs.Columns["Links"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; gridDirs.Columns["Size"] .DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; // give user instructions HandleMessageDebug( "Please click Start to begin recursive FTP space usage evaluation."); }
public FormItemDetails( SiteEntry entry ) { InitializeComponent(); InitGrid(); Populate( entry ); }
private void Populate( SiteEntry entry ) { AddRow( "Name", entry.Name ); AddRow( "Type", entry.Type ); AddRow( "Path", entry.Path ); AddRow( "Size", entry.myFtpEntry.Size ); AddRow( "Target", entry.myFtpEntry.Target ); AddRow( "Date", entry.myFtpEntry.Date ); if ( entry.Type != FtpEntryType.File) AddRow( "IsExplored", entry.IsExplored ); }
public SiteEntry Connect() { // make root entry if ( root == null ) { root = new SiteEntry( null, null ); map.Add( "/", root ); } else { // TODO: doing this check just in case something is out of sync... if ( !map.ContainsKey( "/" ) ) throw new Exception( "Expecting a / entry in the map, since root is already cached from before" ); } // get subitems of root SiteEntry rootEntry = GotoDir( addressBookEntry.iniDir ); return rootEntry; }
//TODO: add bool param forceRefresh public SiteEntry GotoDir( string dir ) { SiteEntry entry = GetDir( dir ); currentDir = entry; return entry; }
public void LearnSubitems( IEnumerable<FtpEntry> subItems, Dictionary<string,SiteEntry> map ) { // TODO: when refreshing a directory, we may need to update this rather than build anew this.subItems = new List<SiteEntry>(); foreach ( FtpEntry item in subItems ) { SiteEntry entryNew = new SiteEntry( item, this ); this.subItems.Add( entryNew ); map.Add( item.Path.ToString(), entryNew ); //TODO: seen an error here... } }
public SiteEntry( FtpEntry ftpEntry, SiteEntry up ) { this.myFtpEntry = ftpEntry; this.up = up; this.subItems = null; }
private void TreeUpdate( SiteEntry entry ) { TreeNode treeNode = null; foreach ( KeyValuePair<TreeNode,SiteEntry> pair in mapTree ) if ( pair.Value == entry) { treeNode = pair.Key; break; } if ( treeNode == null ) { DebugPrintln( "Tree trying to update an entry which was not found" ); return; } // clear subitems and repopulate //TODO: when we clear out subnodes, corresponding items will still remain in the map. that could be a problem. treeNode.Nodes.Clear(); TreeBuildRecursive( treeNode, entry ); treeNode.ForeColor = Color.Black; }
private void TreeBuildRecursive( TreeNode treeNode, SiteEntry entry ) { foreach( SiteEntry entry2 in entry.subItems ) { if ( entry2.Type != FtpEntryType.Directory ) continue; TreeNode treeNode2 = treeNode.Nodes.Add( entry2.Name ); //treeNode2.NodeFont = new Font( treeNode2.NodeFont, FontStyle.Bold ); if ( ! entry2.IsExplored ) treeNode2.ForeColor = Color.Gray; mapTree.Add( treeNode2, entry2 ); if ( entry2.subItems != null && entry2.subItems.Count > 0 ) TreeBuildRecursive( treeNode2, entry2 ); } }
private void HandleSiteUpdatedEvent( SiteEntry entry ) { if ( treeDirs.InvokeRequired ) { MethodInvoker4 d = new MethodInvoker4( TreeUpdate ); treeDirs.Invoke( d, new object[] { entry } ); } else TreeUpdate( entry ); }