private void m_btnDownloadMem_Click(object sender, System.Windows.RoutedEventArgs e) { if (m_sLastFile.Length == 0) { return; } if (m_bLastFileIsFolder) { return; } if (m_lLastFileSize < 0) { return; } if (m_ftpc.WorkingDirectory.Length == 0) { return; } string sPath = m_ftpc.WorkingDirectory; sPath += m_sLastFile; RscFtpClientCommand cmd = RscFtpClientCommand.DownloadBin(sPath, m_lLastFileSize); _SendAutoPASV(cmd); }
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 btnSendJpg_Click(object sender, System.Windows.RoutedEventArgs e) { DateTime dNow = DateTime.Now; m_bLastFileIsFolder = false; 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 + ".jpg"; SetLastFile(sFile, false); WriteableBitmap wbmp = new WriteableBitmap(ContentPanel, new System.Windows.Media.MatrixTransform()); System.IO.MemoryStream ms = new System.IO.MemoryStream(4096); System.Windows.Media.Imaging. Extensions.SaveJpeg(wbmp, ms, wbmp.PixelWidth, wbmp.PixelHeight, 0, 100); ms.Seek(0, System.IO.SeekOrigin.Begin); RscFtpClientCommand cmd = RscFtpClientCommand.UploadBin(sFile, ms); _SendAutoPASV(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 btnNoopSup_Click(object sender, System.Windows.RoutedEventArgs e) { RscFtpClientCommand cmd = RscFtpClientCommand.NOOP(true); //_Log("21", "NOOP - with supressing (200) Ok response"); _Log("", ""); m_ftpc.SendCommandToServer(cmd); }
private void m_btnRemoteDateTime_Click(object sender, System.Windows.RoutedEventArgs e) { if (m_sLastFile.Length == 0) { return; } RscFtpClientCommand cmd; cmd = RscFtpClientCommand.GetLastModifiedFileDateTime(m_sLastFile); _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 m_btnRemoteList_Click(object sender, System.Windows.RoutedEventArgs e) { if (m_sLastFile.Length == 0) { return; } if (!m_bLastFileIsFolder) { return; } RscFtpClientCommand cmd = RscFtpClientCommand.ListFilesAndFolders( m_sLastFile + m_ftpc.BackSlashInPath); _SendAutoPASV(cmd); }
private void m_btnDownloadFile_Click(object sender, System.Windows.RoutedEventArgs e) { if (m_sLastFile.Length == 0) { return; } if (m_bLastFileIsFolder) { return; } if (m_lLastFileSize < 0) { return; } if (m_ftpc.WorkingDirectory.Length == 0) { return; } string sPath = m_ftpc.WorkingDirectory; sPath += m_sLastFile; RscStore store = new RscStore(); string sLocalPath = "A:\\FTP"; if (!store.FolderExists(sLocalPath)) { store.CreateFolder(sLocalPath); } sLocalPath += "\\" + m_sLastFile; if (store.FileExists(sLocalPath)) { store.DeleteFile(sLocalPath); } System.IO.Stream stream = store.CreateFile(sLocalPath); RscFtpClientCommand cmd = RscFtpClientCommand.DownloadBin(sPath, m_lLastFileSize, "", null, stream); _SendAutoPASV(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 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); }
private void btnSendTxt_Click(object sender, System.Windows.RoutedEventArgs e) { DateTime dNow = DateTime.Now; m_bLastFileIsFolder = false; 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 + ".txt"; SetLastFile(sFile, false); string sTxt = dNow.ToLongDateString( ) + "\r\n" + dNow.ToLongTimeString( ) + "\r\n" + "Áá Éé Íí Óó Öö Őő Úú Üü Űű"; RscFtpClientCommand cmd = RscFtpClientCommand.UploadTxt(sFile, sTxt); _SendAutoPASV(cmd); }
private void m_btnRemoteDel_Click(object sender, System.Windows.RoutedEventArgs e) { if (m_sLastFile.Length == 0) { return; } RscFtpClientCommand cmd; if (m_bLastFileIsFolder) { cmd = RscFtpClientCommand.DeleteFolder(m_sLastFile); } else { cmd = RscFtpClientCommand.DeleteFile(m_sLastFile); } SetLastFile("", false); _Log("21", cmd.ToString()); m_ftpc.SendCommandToServer(cmd); }
private void btnList_Click(object sender, System.Windows.RoutedEventArgs e) { RscFtpClientCommand cmd = RscFtpClientCommand.ListFilesAndFolders(); _SendAutoPASV(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(); } }