private void btnCwdBack_Click(object sender, System.Windows.RoutedEventArgs e) { string sPath = m_txtRemotePath.Text; if (sPath.Length == 0) { return; } sPath = sPath.Substring(0, sPath.Length - 1); if (sPath.Length == 0) { return; } int iPos = sPath.LastIndexOf(m_ftpc.BackSlashInPath); if (iPos < 0) { return; } SetLastFile("", false); sPath = sPath.Substring(0, iPos + 1); RscFtpClientCommand cmd = new RscFtpClientCommand(1, "CWD", sPath); _Log("21", cmd.ToString()); m_ftpc.SendCommandToServer(cmd); }
private void m_btnRemoteEnter_Click(object sender, System.Windows.RoutedEventArgs e) { if (m_sLastFile.Length == 0) { return; } if (!m_bLastFileIsFolder) { return; } if (m_ftpc.WorkingDirectory.Length == 0) { return; } string sPath = m_ftpc.WorkingDirectory; sPath += m_sLastFile; sPath += m_ftpc.BackSlashInPath; SetLastFile("", false); RscFtpClientCommand cmd = RscFtpClientCommand.ChangeWorkingDirecory(sPath); _Log("21", cmd.ToString()); m_ftpc.SendCommandToServer(cmd); }
private void btnNoop_Click(object sender, System.Windows.RoutedEventArgs e) { RscFtpClientCommand cmd = RscFtpClientCommand.NOOP(); _Log("21", cmd.ToString()); m_ftpc.SendCommandToServer(cmd); }
private void btnPasv_Click(object sender, System.Windows.RoutedEventArgs e) { RscFtpClientCommand cmd = RscFtpClientCommand.EnterPassiveMode(); _Log("21", cmd.ToString()); m_ftpc.SendCommandToServer(cmd); }
private void btnLogPw_Click(object sender, System.Windows.RoutedEventArgs e) { RscFtpClientCommand cmd = RscFtpClientCommand.LogInPassWord(m_ftpc.PassWord); _Log("21", cmd.ToString()); m_ftpc.SendCommandToServer(cmd); }
// // // // private void _SendAutoPASV(RscFtpClientCommand cmd) { if (m_ftpc.AutoPassiveMode) { RscFtpClientCommand cmdPasv = RscFtpClientCommand.EnterPassiveMode(); cmdPasv.Parent = cmd; _Log("21", "(auto-PASV) " + cmd.ToString()); m_ftpc.SendCommandToServer(cmdPasv); } else { _Log("21", cmd.ToString()); m_ftpc.SendCommandToServer(cmd); } }
// // // // private void btnSnd_Click(object sender, System.Windows.RoutedEventArgs e) { string sCmd = txCmd.Text.ToString( ); if (sCmd.Length == 0) { return; } txCmd.Text = ""; RscFtpClientCommand cmd = new RscFtpClientCommand(1, sCmd); _Log("21", "custom command: " + cmd.ToString()); m_ftpc.SendCommandToServer(cmd); }
private void btnMkD_Click(object sender, System.Windows.RoutedEventArgs e) { DateTime dNow = DateTime.Now; m_bLastFileIsFolder = true; string sFile = dNow.Year.ToString() + "_" + RscUtils.pad60(dNow.Month) + "_" + RscUtils.pad60(dNow.Day) + "_" + RscUtils.pad60(dNow.Hour) + "_" + RscUtils.pad60(dNow.Minute) + "_" + RscUtils.pad60(dNow.Second) + NationalChrsToTestFileNames; SetLastFile(sFile, true); RscFtpClientCommand cmd = RscFtpClientCommand.CreateFolder(sFile); _Log("21", cmd.ToString()); m_ftpc.SendCommandToServer(cmd); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { if (m_AppArgs.Waiting) { RscPageArgsRet appOutput = m_AppArgs.GetOutput(); if (appOutput != null) { switch (appOutput.ID) { case "FtpHost": txSvrIP.Text = appOutput.GetData(0); LoadFromReg(); break; case "txNewFolder": { if (appOutput.GetFlag(0) == "Ok") { m_bLastFileIsFolder = true; string sFile = appOutput.GetData(0); SetLastFile(sFile, true); RscFtpClientCommand cmd = RscFtpClientCommand.CreateFolder(sFile); _Log("21", cmd.ToString()); m_ftpc.SendCommandToServer(cmd); } break; } case "BrowseForFile_MEM": { if (appOutput.GetFlag(0) == "Ok") { string sFilePath = appOutput.GetData(0); string sFile = RscStore.FileOfPath(sFilePath); RscStore store = new RscStore(); System.IO.Stream stream = store.GetReaderStream(sFilePath); SetLastFile(sFile, false, stream.Length); System.IO.MemoryStream ms = new System.IO.MemoryStream((int)stream.Length); stream.CopyTo(ms); stream.Close(); ms.Seek(0, System.IO.SeekOrigin.Begin); RscFtpClientCommand cmd = RscFtpClientCommand.UploadBin(sFile, ms); _SendAutoPASV(cmd); } else { //NOP... } m_AppArgs.Vipe(); break; } case "BrowseForFile_FLE": { if (appOutput.GetFlag(0) == "Ok") { string sFilePath = appOutput.GetData(0); string sFile = RscStore.FileOfPath(sFilePath); RscStore store = new RscStore(); System.IO.Stream stream = store.GetReaderStream(sFilePath); SetLastFile(sFile, false, stream.Length); /* * MemoryStream ms = new MemoryStream((int) stream.Length); * stream.CopyTo(ms); * stream.Close(); * ms.Seek(0, SeekOrigin.Begin); */ RscFtpClientCommand cmd = RscFtpClientCommand.UploadBin(sFile, null, stream); _SendAutoPASV(cmd); } else { //NOP... } m_AppArgs.Vipe(); break; } } } m_AppArgs.Clear(); } }