private void RenameFile(string newname, string oldname) { frm.Cursor = Cursors.WaitCursor; try { Ambertation.Ftp.FTPFactory f = FtpConnect(); f.chdir("files/"); string[] files = f.getFileList(newname); if (files.Length == 1) { files = f.getFileList("old_" + newname); if (files.Length == 1) { f.deleteRemoteFile("old_" + newname); } f.renameRemoteFile(newname, "old_" + newname); } f.renameRemoteFile(oldname, newname); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } frm.Cursor = Cursors.Default; }
private Ambertation.Ftp.FTPFactory FtpConnect() { Ambertation.Ftp.FTPFactory f = new Ambertation.Ftp.FTPFactory(); f.setRemoteHost(set.FtpServer); f.setRemoteUser(set.FtpUser); f.setRemotePass(set.FtpPassword); f.login(); f.setBinaryMode(true); return(f); }
private void UploadReleaseNfo(string flname) { frm.Cursor = Cursors.WaitCursor; try { Ambertation.Ftp.FTPFactory f = FtpConnect(); f.UploadProgress += new Ambertation.Ftp.FTPFactory.UploadProgressEventHandler(f_UploadProgress); f.chdir("/"); f.upload(System.IO.Path.Combine(set.UpdateInfoDir, flname)); f.UploadProgress -= new Ambertation.Ftp.FTPFactory.UploadProgressEventHandler(f_UploadProgress); frm.pb.Value = 0; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } frm.Cursor = Cursors.Default; }
internal void UploadFile(string srcname, string dstname) { frm.Cursor = Cursors.WaitCursor; try { Ambertation.Ftp.FTPFactory f = FtpConnect(); f.UploadProgress += new Ambertation.Ftp.FTPFactory.UploadProgressEventHandler(f_UploadProgress); f.chdir("files/"); f.upload(System.IO.Path.Combine(set.ReleaseDir, srcname), dstname); f.UploadProgress -= new Ambertation.Ftp.FTPFactory.UploadProgressEventHandler(f_UploadProgress); frm.pb.Value = 0; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } frm.Cursor = Cursors.Default; }