Example #1
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);
        }
        /// <summary>
        /// Executes the node.
        /// </summary>
        /// <param name="runtime"></param>
        /// <param name="scope"></param>
        /// <returns></returns>
        public override bool Execute(IFlowRuntimeService runtime, DataPinScope scope)
        {
            if (ftpServerConfigurationService == null)
            {
                ftpServerConfigurationService = CommonServiceLocator.ServiceLocator.Current.GetInstance <IFtpServerConfigurationService>();
            }

            var groupName   = scope.GetValue <string>(InPinGroupName);
            var serverNames = new List <string>();

            if (!string.IsNullOrWhiteSpace(groupName))
            {
                var servers = ftpServerConfigurationService.GetActiveByGroupName(groupName);
                foreach (var server in servers)
                {
                    serverNames.Add(server.InternalName);
                }
            }
            else
            {
                var servers = ftpServerConfigurationService.GetAllActive();
                foreach (var server in servers)
                {
                    serverNames.Add(server.InternalName);
                }
            }
            scope.SetValue(OutPinServerNames, serverNames);
            runtime.EnqueueNode(OutNodeSuccess, scope);

            return(true);
        }
Example #4
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);
        }
Example #5
0
 /// <summary>
 /// Initializes a new instance of FtpServerWindow
 /// </summary>
 /// <param name="ftpServerService"></param>
 public FtpServerWindow(IFtpServerConfigurationService ftpServerService)
     : base(ftpServerService)
 {
     InitializeComponent();
 }