示例#1
0
文件: Job.cs 项目: sbraer/DiExample
 public Job(IConfiguration configuration, IDbHelper dbHelper, IFtpService ftpService, ILogs logs)
 {
     _configuration = configuration;
     _dbHelper      = dbHelper;
     _ftpService    = ftpService;
     _logs          = logs;
 }
 public void Setup()
 {
     _firestoreService = new FirestoreService(ConfigurationService);
     _ftpService       = new FtpService(ConfigurationService);
     _storageService   = new StorageService(UnitTestLoggerFactory, ConfigurationService);
     _igcReaderService = new IgcReaderService();
 }
示例#3
0
        public MainWin()
        {
            InitializeComponent();

            getSessionKeyForChatWorker.DoWork             += getSessionKeyWorker_DoWork;
            getSessionKeyForChatWorker.RunWorkerCompleted += getSessionKeyWorker_RunWorkerCompleted;

            getSessionKeyForFtpWorker.DoWork += getSessionKeyForFtpWorker_DoWork;

            ClientKdcCallBack.Instance.newConnectedUserEvnt += (sender, message_contant) =>
            {
                Dispatcher.Invoke(() => addUserToPartnerUsers(message_contant));
            };

            ClientKdcCallBack.Instance.openChatWindowEvnt += (sender, userPort) =>
            {
                Dispatcher.Invoke(() => openChatWindow(userPort));
            };


            kdcProxy = KdcProxy.Instance.GetProxy();
            List <string> allUsers = kdcProxy.getAllConnectedUsers();

            allUsers.Remove(ClientAllData.Instance.getMyUsername());
            addUserToPartnerUsers(allUsers);

            ftpProxy = FtpProxy.Instance.GetFtpProxy();

            ClientFtpCallBack.Instance.finishRequstConnectionProcessEvent += (sender, finishedProcess) =>
            {
                Dispatcher.Invoke(() => finishRequstConnectionProcessUI(finishedProcess));
            };
        }
示例#4
0
 public EtlService(IAmazonService amazonService, ICsvService csvService, IFtpService ftpService, ISqlService sqlService)
 {
     _amazonService = amazonService;
     _csvService    = csvService;
     _ftpService    = ftpService;
     _sqlService    = sqlService;
 }
 public TestableManager(
     ILogger logger,
     IFtpService ftpService,
     bool indicatesError = false) : base(logger, ftpService)
 {
     _indicatesError = indicatesError;
 }
示例#6
0
        public MainWindowViewModel(IDatabaseService databaseService, IMessenger messenger, IImageService imageService,
                                   IDataService dataService, IJsonService jsonService, IFtpService ftpService, IConfigService configService)
        {
            _databaseService = databaseService;
            _messenger       = messenger;
            _imageService    = imageService;
            _dataService     = dataService;
            _jsonService     = jsonService;
            _ftpService      = ftpService;
            _configService   = configService;

            //register for messages
            _messenger.Register <ChooseFilesConfirmMsg>(this, OnChooseFilesConfirmMsg);
            _messenger.Register <ImportConfirmMsg>(this, OnImportConfirmMsg);
            _messenger.Register <ExportViewClosedMsg>(this, OnExportviewClosedMsg);
            _messenger.Register <ChooseFilesGoogleDriveConfirmMsg>(this, OnChooseFilesGoogleDriveConfirmMsg);
            _messenger.Register <FileProcessFinishedMsg>(this, OnFileProcessFinishedMsg);

            IsGoogleDriveEnabled =
                Convert.ToBoolean(_configService.GetAppSettingsValue(AppSettingConstants.IsGoogleDriveEnabled));

            _mobileKey = _configService.GetAppSettingsValue(AppSettingConstants.MobileKey);

            if (!string.IsNullOrEmpty(_mobileKey))
            {
                HasMobileKey = true;
            }

            if (IsGoogleDriveEnabled)
            {
                _googleDriveService = Container.Resolve <IGoogleDriveService>();
                _googleDriveService.DownloadCompleted += GoogleDriveService_DownloadCompleted;
            }
        }
示例#7
0
        /// <summary>
        /// Executes the node.
        /// </summary>
        /// <param name="runtime"></param>
        /// <param name="scope"></param>
        /// <returns></returns>
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            if (ftpServerService == null)
            {
                ftpServerService = CommonServiceLocator.ServiceLocator.Current.GetInstance <IFtpServerConfigurationService>();
            }

            var servername = scope.GetValue <string>(InPinServer);
            var server     = ftpServerService.GetByName(servername);

            if (serviceCache.Keys.Contains(server.Type.ToString()))
            {
                ftpService = serviceCache[server.Type.ToString()];
            }
            else
            {
                ftpService = CommonServiceLocator.ServiceLocator.Current.GetInstance <IFtpService>(server.Type.ToString());
                serviceCache.Add(server.Type.ToString(), ftpService);
            }
            var filename    = scope.GetValue <string>(InPinFileName);
            var newFilename = scope.GetValue <string>(InPinNewFileName);
            var path        = scope.GetValue <string>(InPinPath);

            ftpService.RenameFile(server, path + filename, newFilename);
            runtime.EnqueueNode(OutNodeSuccess, scope);

            return(true);
        }
        /// <summary>
        /// Executes the node.
        /// </summary>
        /// <param name="runtime"></param>
        /// <param name="scope"></param>
        /// <returns></returns>
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            if (ftpServerService == null)
            {
                ftpServerService = CommonServiceLocator.ServiceLocator.Current.GetInstance <IFtpServerConfigurationService>();
            }

            var servername = scope.GetValue <string>(InPinServer);
            var server     = ftpServerService.GetByName(servername);

            if (serviceCache.Keys.Contains(server.Type.ToString()))
            {
                ftpService = serviceCache[server.Type.ToString()];
            }
            else
            {
                ftpService = CommonServiceLocator.ServiceLocator.Current.GetInstance <IFtpService>(server.Type.ToString());
                serviceCache.Add(server.Type.ToString(), ftpService);
            }
            var directory = scope.GetValue <string>(InPinDirectory);
            var dir       = ftpService.GetDirectoryContent(server, directory);

            scope.SetValue(OutPinDirectory, dir);
            runtime.EnqueueNode(OutNodeSuccess, scope);

            return(true);
        }
示例#9
0
        /// <summary>
        /// Executes the node.
        /// </summary>
        /// <param name="runtime"></param>
        /// <param name="scope"></param>
        /// <returns></returns>
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            if (ftpServerService == null)
            {
                ftpServerService = CommonServiceLocator.ServiceLocator.Current.GetInstance <IFtpServerConfigurationService>();
            }
            var servername = scope.GetValue <string>(InPinServer);
            var server     = ftpServerService.GetByName(servername);

            if (serviceCache.Keys.Contains(server.Type.ToString()))
            {
                ftpService = serviceCache[server.Type.ToString()];
            }
            else
            {
                ftpService = CommonServiceLocator.ServiceLocator.Current.GetInstance <IFtpService>(server.Type.ToString());
                serviceCache.Add(server.Type.ToString(), ftpService);
            }

            var file     = scope.GetValue <byte[]>(InPinFile);
            var path     = scope.GetValue <string>(InPinPath);
            var fileName = scope.GetValue <string>(InPinFileName);

            try
            {
                ftpService.UploadFile(server, file, path, fileName);
                runtime.EnqueueNode(OutNodeSuccess, scope);
            }
            catch (Exception ex)
            {
                runtime.EnqueueNode(OutNodeFaield, scope);
                Console.WriteLine(ex);
            }
            return(true);
        }
 public FtpDeployRunner(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools, IFtpService ftpService) : base(fileSystem, environment, processRunner, tools)
 {
     _fileSystem    = fileSystem;
     _environment   = environment;
     _processRunner = processRunner;
     _tools         = tools;
     _ftpService    = ftpService;
 }
示例#11
0
        public Program()
        {
            System.Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", "D:\\llauner\\GoogleCloud_Credentials\\Service_Account_Key-igcheatmap-f012be117f9c.json");

            _firestoreService = new FirestoreService(ConfigurationService);
            _ftpService       = new FtpService(ConfigurationService);
            _storageService   = new StorageService(ConfigurationService);
            _igcReaderService = new IgcReaderService();
        }
示例#12
0
 public SslCommunicationInfo(
     [NotNull] IFtpService transmitterService,
     [NotNull] IPausableFtpService receiverService,
     [NotNull] Stream sslStream)
 {
     TransmitterService = transmitterService;
     ReceiverService    = receiverService;
     SslStream          = sslStream;
 }
示例#13
0
 public PopupService(VmmDbContext dbContext,
                     IFtpService ftpService,
                     IFileCacheService fileCacheService,
                     IConfigurationProvider configurationProvider)
 {
     this.dbContext             = dbContext;
     this.ftpService            = ftpService;
     this.fileCacheService      = fileCacheService;
     this.configurationProvider = configurationProvider;
 }
示例#14
0
 public ExportWorker(IFtpService ftpService,
                     IExportService exportService,
                     IServiceProvider serviceProvider,
                     ILogger <ExportWorker> logger)
 {
     _ftpService      = ftpService;
     _exportService   = exportService;
     _serviceProvider = serviceProvider;
     _logger          = logger;
 }
示例#15
0
 public NeoLoader(IFtpService ftpService = null)
 {
     if (ftpService == null)
     {
         _ftpService = new FtpService();
     }
     else
     {
         _ftpService = ftpService;
     }
 }
示例#16
0
 public NetworkStreamFeature(
     [NotNull] IFtpSecureConnectionAdapter secureConnectionAdapter,
     [NotNull] IFtpService streamReaderService,
     [NotNull] IFtpService streamWriterService,
     [NotNull] PipeWriter output)
 {
     StreamReaderService = streamReaderService;
     StreamWriterService = streamWriterService;
     Output = output;
     SecureConnectionAdapter = secureConnectionAdapter;
 }
示例#17
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="fileSystem">The filesystem.</param>
        /// <param name="environment">The cake environment.</param>
        /// <param name="ftpService">The FTP Service.</param>
        public FtpClient(IFileSystem fileSystem, ICakeEnvironment environment, IFtpService ftpService)
        {
            fileSystem.NotNull(nameof(fileSystem));
            environment.NotNull(nameof(environment));
            ftpService.NotNull(nameof(ftpService));

            _fileSystem  = fileSystem;
            _environment = environment;
            _ftpService  = ftpService;
            _comparison  = environment.Platform.IsUnix() ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
        }
示例#18
0
 public DocumentService(VmmDbContext dbContext,
                        IDocumentTypeService documentTypeService,
                        IFtpService ftpService,
                        IFileCacheService fileCacheService,
                        IConfigurationProvider configurationProvider)
 {
     this.dbContext             = dbContext;
     this.documentTypeService   = documentTypeService;
     this.configurationProvider = configurationProvider;
     this.ftpService            = ftpService;
     this.fileCacheService      = fileCacheService;
 }
 public Application(
     IConfigService configService,
     IFtpService ftpService,
     ILogger logger,
     IWildCardService wildCardService,
     AppConfig appConfig)
 {
     this.configService   = configService;
     this.ftpService      = ftpService;
     this.logger          = logger;
     this.wildCardService = wildCardService;
     this.appConfig       = appConfig;
 }
示例#20
0
 public PhotoService(IFtpService ftpService,
                     IUnitOfWork unitOfWork,
                     IAlbumService albumService,
                     IClock clock,
                     IGuid guid,
                     IPermissionsService permissionsService)
 {
     _ftpService         = ftpService;
     _unitOfWork         = unitOfWork;
     _albumService       = albumService;
     _clock              = clock;
     _guid               = guid;
     _permissionsService = permissionsService;
 }
示例#21
0
 public FtpController(
     IExcelManager excelManager,
     ICacheManager cacheManager,
     IWorkContext workContext,
     IWebEventService webLogger,
     IFsuService fsuService,
     IFtpService ftpService)
 {
     this._excelManager = excelManager;
     this._cacheManager = cacheManager;
     this._workContext  = workContext;
     this._webLogger    = webLogger;
     this._fsuService   = fsuService;
     this._ftpService   = ftpService;
 }
 public AggregatorService(ILoggerFactory loggerFactory,
                          IConfigurationService configuration,
                          IFtpService ftpService,
                          IFirestoreService fireStoreService,
                          IStorageService storageService,
                          IIgcReaderService igcReaderService,
                          INetcoupeService netcoupeService)
 {
     _logger           = loggerFactory.CreateLogger <AggregatorService>();
     _configuration    = configuration;
     _ftpService       = ftpService;
     _firestoreService = fireStoreService;
     _storageService   = storageService;
     _igcReaderService = igcReaderService;
     _netcoupeService  = netcoupeService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PassThroughConnectionAdapter"/> class.
 /// </summary>
 /// <param name="socketPipe">The pipe for the socket.</param>
 /// <param name="connectionPipe">The pipe for the <see cref="IFtpConnection"/>.</param>
 /// <param name="connectionClosed">A cancellation token for a closed connection.</param>
 /// <param name="loggerFactory">The logger factory.</param>
 public PassThroughConnectionAdapter(
     [NotNull] IDuplexPipe socketPipe,
     [NotNull] IDuplexPipe connectionPipe,
     CancellationToken connectionClosed,
     [CanBeNull] ILoggerFactory loggerFactory = null)
 {
     _receiverService = new NonClosingNetworkPassThrough(
         socketPipe.Input,
         connectionPipe.Output,
         connectionClosed,
         loggerFactory?.CreateLogger(typeof(PassThroughConnectionAdapter).FullName + ":Receiver"));
     _transmitService = new NonClosingNetworkPassThrough(
         connectionPipe.Input,
         socketPipe.Output,
         connectionClosed,
         loggerFactory?.CreateLogger(typeof(PassThroughConnectionAdapter).FullName + ":Transmitter"));
 }
示例#24
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="fileSystem">The filesystem.</param>
 /// <param name="environment">The cake environment.</param>
 /// <param name="ftpService">The FTP Service.</param>
 public FtpClient(IFileSystem fileSystem, ICakeEnvironment environment, IFtpService ftpService)
 {
     if (fileSystem == null)
     {
         throw new ArgumentNullException(nameof(fileSystem));
     }
     if (environment == null)
     {
         throw new ArgumentNullException(nameof(environment));
     }
     if (ftpService == null)
     {
         throw new ArgumentNullException(nameof(ftpService));
     }
     _fileSystem  = fileSystem;
     _environment = environment;
     _ftpService  = ftpService;
     _comparison  = environment.Platform.IsUnix() ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
 }
示例#25
0
 public FtpHelperTest()
 {
     _ftp = new FtpService(new MyFtpService1(), new MyConfiguration1());
 }
示例#26
0
 private FtpProxy()
 {
     // creat a channel to comunicate with the game server
     channel = new DuplexChannelFactory <IFtpService>(ClientFtpCallBack.Instance, "FtpServiceEndpoint");
     proxy   = channel.CreateChannel();
 }
示例#27
0
 internal Manager(ILogger logger, IFtpService ftpService)
 {
     _logger     = logger ?? throw new ArgumentNullException(nameof(logger));
     _ftpService = ftpService ?? throw new ArgumentNullException(nameof(ftpService));
 }
示例#28
0
 public InventoryService(IFtpService ftpService, string localPath)
 {
     FtpService = ftpService;
     LocalPath  = localPath;
 }
示例#29
0
 public PhotoServiceBuilder WithFtpService(IFtpService ftpService)
 {
     _ftpService = ftpService;
     return(this);
 }
示例#30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FtpConnection"/> class.
        /// </summary>
        /// <param name="socketAccessor">The accessor to get the socket used to communicate with the client.</param>
        /// <param name="options">The options for the FTP connection.</param>
        /// <param name="portOptions">The <c>PORT</c> command options.</param>
        /// <param name="connectionAccessor">The accessor to get the connection that is active during the <see cref="FtpCommandHandler.Process"/> method execution.</param>
        /// <param name="catalogLoader">The catalog loader for the FTP server.</param>
        /// <param name="serverCommandExecutor">The executor for server commands.</param>
        /// <param name="serviceProvider">The service provider for the connection.</param>
        /// <param name="secureDataConnectionWrapper">Wraps a data connection into an SSL stream.</param>
        /// <param name="sslStreamWrapperFactory">The SSL stream wrapper factory.</param>
        /// <param name="logger">The logger for the FTP connection.</param>
        public FtpConnection(
            TcpSocketClientAccessor socketAccessor,
            IOptions <FtpConnectionOptions> options,
            IOptions <PortCommandOptions> portOptions,
            IFtpConnectionAccessor connectionAccessor,
            IFtpCatalogLoader catalogLoader,
            IServerCommandExecutor serverCommandExecutor,
            IServiceProvider serviceProvider,
            SecureDataConnectionWrapper secureDataConnectionWrapper,
            ISslStreamWrapperFactory sslStreamWrapperFactory,
            ILogger <FtpConnection>?logger = null)
        {
            var socket = socketAccessor.TcpSocketClient ?? throw new InvalidOperationException("The socket to communicate with the client was not set");

            ConnectionServices = serviceProvider;

            ConnectionId = "FTP-" + Guid.NewGuid().ToString("N");

            _dataPort = portOptions.Value.DataPort;
            var remoteEndPoint = _remoteEndPoint = (IPEndPoint)socket.Client.RemoteEndPoint;

#pragma warning disable 618
            RemoteAddress = new Address(remoteEndPoint.Address.ToString(), remoteEndPoint.Port);
#pragma warning restore 618

            var properties = new Dictionary <string, object?>
            {
                ["RemoteAddress"] = remoteEndPoint.ToString(),
                ["RemoteIp"]      = remoteEndPoint.Address.ToString(),
                ["RemotePort"]    = remoteEndPoint.Port,
                ["ConnectionId"]  = ConnectionId,
            };

            _loggerScope = logger?.BeginScope(properties);

            _socket                      = socket;
            _connectionAccessor          = connectionAccessor;
            _serverCommandExecutor       = serverCommandExecutor;
            _secureDataConnectionWrapper = secureDataConnectionWrapper;
            _serverCommandChannel        = Channel.CreateBounded <IServerCommand>(new BoundedChannelOptions(3));

            _logger = logger;

            var parentFeatures    = new FeatureCollection();
            var connectionFeature = new ConnectionFeature(
                (IPEndPoint)socket.Client.LocalEndPoint,
                remoteEndPoint);
            var secureConnectionFeature = new SecureConnectionFeature();

            var applicationInputPipe  = new Pipe();
            var applicationOutputPipe = new Pipe();
            var socketPipe            = new DuplexPipe(_socketCommandPipe.Reader, _socketResponsePipe.Writer);
            var connectionPipe        = new DuplexPipe(applicationOutputPipe.Reader, applicationInputPipe.Writer);

            var originalStream = socketAccessor.TcpSocketStream ?? socket.GetStream();
            _streamReaderService = new ConnectionClosingNetworkStreamReader(
                originalStream,
                _socketCommandPipe.Writer,
                _cancellationTokenSource);
            _streamWriterService = new StreamPipeWriterService(
                originalStream,
                _socketResponsePipe.Reader,
                _cancellationTokenSource.Token);

            _networkStreamFeature = new NetworkStreamFeature(
                new SecureConnectionAdapter(
                    socketPipe,
                    connectionPipe,
                    sslStreamWrapperFactory,
                    _cancellationTokenSource.Token),
                applicationOutputPipe.Writer);

            parentFeatures.Set <IConnectionFeature>(connectionFeature);
            parentFeatures.Set <ISecureConnectionFeature>(secureConnectionFeature);
            parentFeatures.Set <IServerCommandFeature>(new ServerCommandFeature(_serverCommandChannel));
            parentFeatures.Set <INetworkStreamFeature>(_networkStreamFeature);

            var features = new FeatureCollection(parentFeatures);
#pragma warning disable 618
            Data = new FtpConnectionData(
                options.Value.DefaultEncoding ?? Encoding.ASCII,
                features,
                catalogLoader);
#pragma warning restore 618

            Features = features;

            _commandReader = ReadCommandsFromPipeline(
                applicationInputPipe.Reader,
                _ftpCommandChannel.Writer,
                _cancellationTokenSource.Token);
        }