public static T DownloadObject <T>(this IFileTransferClient client, string alias) { client.DownloadFile(alias); using (var streamReader = new StreamReader(client.LocalStore.OpenRead(alias))) { return(XmlProvider.Read <T>(streamReader)); } }
public PrintingJsonCreator( IAggregateLogger aggregateLogger, IFileTransferClient fileTransferClient, IWebConfiguration webConfiguration) { _aggregateLogger = aggregateLogger; _fileTransferClient = fileTransferClient; _webConfiguration = webConfiguration; }
public static string UploadObject <T>(this IFileTransferClient client, T @object, bool compress = false) { var fileAlias = client.LocalStore.NewFile(); using (var streamWriter = new StreamWriter(client.LocalStore.OpenWrite(fileAlias))) { XmlProvider.Write(@object, Encoding.Unicode, streamWriter); } client.UploadFile(fileAlias, client.LocalStore.GetFilePath(fileAlias)); return(fileAlias); }
public PrintProcessCommand(IAggregateLogger aggregateLogger, IPrintingJsonCreator printingJsonCreator, IPrintingSpreadsheetCreator printingSpreadsheetCreator, IAssessorServiceApi assessorServiceApi, INotificationService notificationService, IFileTransferClient fileTransferClient, IConfigurationWrapper configurationWrapper) { _aggregateLogger = aggregateLogger; _printingSpreadsheetCreator = printingSpreadsheetCreator; _assessorServiceApi = assessorServiceApi; _notificationService = notificationService; _fileTransferClient = fileTransferClient; _printingJsonCreator = printingJsonCreator; _configurationWrapper = configurationWrapper; }
internal void Connect(FTPClient ftpClient, int timeout) { ftp = ftpClient; ftp.RemoteHost = host; ftp.ControlPort = FTPControlSocket.CONTROL_PORT; ftp.Timeout = timeout; log.Debug("Using timeout= " + timeout + " ms"); ((FTPClient)ftp).ServerWakeupInterval = serverWakeupInterval; log.Debug("Using server wakeup interval= " + serverWakeupInterval + " sec"); ((FTPClient)ftp).ConnectMode = connectMode; ftp.TransferStartedEx += new TransferHandler(LogTransferStarted); ftp.TransferCompleteEx += new TransferHandler(LogTransferComplete); ftp.BytesTransferred += new BytesTransferredHandler(BytesTransferred); if (!strictReplies) { log.Warn("Strict replies not enabled"); ((FTPClient)ftp).StrictReturnCodes = false; } log.Debug("Connecting to " + host); ftp.Connect(); log.Debug("Connected to " + host); }
/// <summary> /// Create an FTPConnection using the given FTP client. /// </summary> /// <param name="ftpClient"><see cref="FTPClient"/>-instance to use.</param> protected internal FTPConnection(FTPClient ftpClient) { log.Info(VersionDetails.GetVersionDetails(this.GetType())); log.Info("Built: " + BuildTimestamp); lock (instanceCountMutex) { this.instanceNumber = instanceCount++; } this.ftpClient = ftpClient; this.activeClient = ftpClient; this.ftpClient.AutoPassiveIPSubstitution = true; this.ftpClient.BytesTransferred += new BytesTransferredHandler(ftpClient_BytesTransferred); fileTransferType = FTPTransferType.BINARY; ftpClient.CommandSent += new FTPMessageHandler(ftpClient_CommandSent); ftpClient.ReplyReceived += new FTPMessageHandler(ftpClient_ReplyReceived); ftpClient.CommandError += new FTPErrorEventHandler(ftpClient_CommandError); ftpClient.ActivePortRange.PropertyChangeHandler = new PropertyChangedEventHandler(OnActivePortRangeChanged); ftpClient.FileNotFoundMessages.PropertyChangeHandler = new PropertyChangedEventHandler(OnFileNotFoundMessagesChanged); ftpClient.TransferCompleteMessages.PropertyChangeHandler = new PropertyChangedEventHandler(OnFileNotFoundMessagesChanged); ftpClient.DirectoryEmptyMessages.PropertyChangeHandler = new PropertyChangedEventHandler(OnDirectoryEmptyMessagesChanged); }
internal virtual void TestTearDown() { ftp = null; }
internal virtual void FixtureTearDown() { Logger.Shutdown(); ftp = null; }
protected internal FTPConnection(FTPClient ftpClient) { this.components = null; this.log = Logger.GetLogger("FTPConnection"); this.clientLock = new object(); this.useAutoLogin = true; this.areEventsEnabled = true; this.isTransferringData = false; this.guiControl = null; this.haveQueriedForControl = false; this.currentFileSize = -1L; this.useGuiThread = true; this.localDir = null; this.remoteDir = null; this.lastTransferCancel = false; lock (instanceCountMutex) { this.instanceNumber = instanceCount++; } this.ftpClient = ftpClient; this.activeClient = ftpClient; this.ftpClient.AutoPassiveIPSubstitution = true; this.ftpClient.BytesTransferred += new BytesTransferredHandler(this.ftpClient_BytesTransferred); this.fileTransferType = FTPTransferType.BINARY; ftpClient.CommandSent += new FTPMessageHandler(this.ftpClient_CommandSent); ftpClient.ReplyReceived += new FTPMessageHandler(this.ftpClient_ReplyReceived); ftpClient.ActivePortRange.PropertyChangeHandler = new PropertyChangedEventHandler(this.OnActivePortRangeChanged); ftpClient.FileNotFoundMessages.PropertyChangeHandler = new PropertyChangedEventHandler(this.OnFileNotFoundMessagesChanged); ftpClient.TransferCompleteMessages.PropertyChangeHandler = new PropertyChangedEventHandler(this.OnFileNotFoundMessagesChanged); ftpClient.DirectoryEmptyMessages.PropertyChangeHandler = new PropertyChangedEventHandler(this.OnDirectoryEmptyMessagesChanged); }