private void TransferManager(string logFile) { if (currentDataLoggerConfig.IsLogRemote()) { TransferBase transferUtil = new FTPTransfer(); if (currentDataLoggerConfig.IsLogToFTP()) { transferUtil = new FTPTransfer(); } if (currentDataLoggerConfig.IsLogToSFTP()) { transferUtil = new SFTPTransfer(); } transferUtil.Host = currentDataLoggerConfig.RemoteHost; transferUtil.Port = currentDataLoggerConfig.RemotePort; transferUtil.Username = currentDataLoggerConfig.Username; transferUtil.Password = currentDataLoggerConfig.Password; transferUtil.SourceDirectory = currentDataLoggerConfig.LocalDirectory; transferUtil.DestinationDirectory = currentDataLoggerConfig.RemoteDirectory; transferUtil.UploadFile(logFile); } }
private void LoadConfigButton_Click(object sender, EventArgs e) { Stream ioStream; this.openFileDialog = new OpenFileDialog { RestoreDirectory = true, Filter = "DataLogger config files (*.dlconf)|*.dlconf|All files (*.*)|*.*", FilterIndex = 1 }; if (openFileDialog.ShowDialog() == DialogResult.OK) { if ((ioStream = openFileDialog.OpenFile()) != null) { recordReplayService.StopRecording(); UpdateButtons(); // Not using the instance here DataLogger dataLoggerConfig = CanRecordReplayDebugService.LoadConfig(ioStream); if (dataLoggerConfig.IsLogToLocalDisk()) { logLocally.Checked = true; } else if (dataLoggerConfig.IsLogToFTP()) { logViaFTP.Checked = true; } else if (dataLoggerConfig.IsLogToSFTP()) { logViaSFTP.Checked = true; } if (dataLoggerConfig.ArchiveLogs) { archive.Checked = true; } if (dataLoggerConfig.CompressLogs) { compress.Checked = true; } if (dataLoggerConfig.LimitArchive) { limitArchive.Checked = true; ArchiveLimitTextBox.Text = dataLoggerConfig.LimitArchiveFileNum.ToString(); } if (dataLoggerConfig.IsRotateByMin()) { timeRotate.Checked = true; } else if (dataLoggerConfig.IsRotateByMB()) { sizeRotate.Checked = true; } minutesTextBox.Text = dataLoggerConfig.RotateMinutes.ToString(); MBtextBox.Text = dataLoggerConfig.RotateMB.ToString(); localDirTextBox.Text = dataLoggerConfig.LocalDirectory; archiveDirTextBox.Text = dataLoggerConfig.ArchiveDirectory; remoteHostTextBox.Text = dataLoggerConfig.RemoteHost; remotePortTextBox.Text = dataLoggerConfig.RemotePort.ToString(); remoteDirTextBox.Text = dataLoggerConfig.RemoteDirectory; usernameTextBox.Text = dataLoggerConfig.Username; passwordTextBox.Text = dataLoggerConfig.Password; } } UpdatePanels(); }