/// <summary> /// Send a whole folder to a remote client /// </summary> /// <param name="ftp">The directory to send</param> /// <param name="pathOfFile">The location of the directory</param> /// <param name="pathToGo">Where to store it in the remote machine</param> /// <param name="client">The current client</param> /// <param name="oppositeFolderControl">The folder control that dropped it</param> private void SendFolderToClient(FTPDirectory ftp, string pathOfFile, string pathToGo, ClientThread client, FolderControl oppositeFolderControl) { if (ftp.IsFile) { pathToGo = pathToGo.Replace("\\", "\\\\"); oppositeFolderControl.client.SendFileToOtherClient(pathOfFile, ftp.kbSize, pathToGo, client); } else { ftp.GetChildren(); foreach (FTPDirectory f in ftp.Children) { SendFolderToClient(f, f.Path, pathToGo + "\\" + f.Name, client, oppositeFolderControl); } } }
private void SendFolder(FTPDirectory ftp, ClientThread client, string pathToGo, FTP par) { if (Directory.Exists(ftp.Path)) { ftp.GetChildren(); foreach (FTPDirectory f in ftp.Children) { SendFolder(f, client, pathToGo + "\\\\" + f.Name, par); } } else { Messaging.SendCommand("RemoteAcceptFTP(" + client.GetPort() + ",'" + pathToGo + "', " + new FileInfo(ftp.Path).Length + ");", client.GetClientSocket()); //Messaging.RemoteAcceptFTP(client.GetClientSocket(), pathToGo); Messaging.FTPFile(ftp.Path, client.GetClientSocket()); log.Text += ("\nFile successfully sent.\n"); par.Refresh(); } }