private void EnterFileName()
        {
            string fileName = FilePrefix.ToString().ToLowerInvariant();

            _emailApp.EnterSubject(fileName);
            _emailApp.EnterFileName(fileName);
        }
Example #2
0
        public List <FileScan> ScanDirectory(string directoryName)
        {
            if (!Directory.Exists(directoryName))
            {
                return(new List <FileScan>());
            }
            string[]        files   = Directory.GetFiles(directoryName);
            List <FileScan> entries = new List <FileScan>(files.Length);

            foreach (string file in files)
            {
                if (Path.GetFileName(file).ToLower().StartsWith(FilePrefix.ToLower()) && file.ToLower().EndsWith(FileSuffix.ToLower()))
                {
                    entries.Add(ScanFile(file));
                }
            }

            if (ScanRecursively)
            {
                string[] directories = Directory.GetDirectories(directoryName);
                foreach (string directory in directories)
                {
                    entries.AddRange(ScanDirectory(directory));
                }
            }
            return(entries);
        }
        /// <summary>
        /// Sets up the copy job.
        /// </summary>
        /// <param name="device">The device.</param>
        protected override void SetupJob(IDevice device)
        {
            FilePrefix.MaxLength = maxLength;
            if (device == null)
            {
                throw new ArgumentNullException(nameof(device));
            }

            InitializeAuthenticator(_data.AuthProvider, device, ExecutionData);

            // Load the Job storage application
            _jobStorageScanApp = ScanJobStorageAppFactory.Create(device);

            _jobStorageScanApp.WorkflowLogger = Authenticator.WorkflowLogger = WorkflowLogger;
            _jobStorageScanApp.Pacekeeper     = Authenticator.Pacekeeper = new Pacekeeper(_data.AutomationPause);
            _jobStorageScanApp.Launch(Authenticator, !_data.ApplicationAuthentication ? AuthenticationMode.Eager : AuthenticationMode.Lazy);
            // Enter the job name
            if (_data.IsPinRequired)
            {
                _jobStorageScanApp.AddJobName(FilePrefix.ToString().ToLowerInvariant(), _data.Pin);
            }
            else
            {
                _jobStorageScanApp.AddJobName(FilePrefix.ToString().ToLowerInvariant());
            }
            //Sets the scan job options
            SetOptions(_data.ScanOptions, _jobStorageScanApp.Options.GetType(), _jobStorageScanApp.GetType(), device);

            // Set job build
            _jobStorageScanApp.Options.SetJobBuildState(UseJobBuild);
        }
Example #4
0
 protected override void Arrange()
 {
     base.Arrange();
     base.Act();
     FilePrefix.Stub(x => x.Get()).Return(Prefix);
     FileExtension.Stub(x => x.Get()).Return(Extension);
     CurrentDateString.Stub(x => x.Get()).Return(Contetnts);
 }
        /// <summary>
        /// Sets up the CloudConnector scan job.
        /// </summary>
        /// <param name="device">The device.</param>
        protected override void SetupJob(IDevice device)
        {
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }

            _cloudApp = new CloudConnectorApp(_data.CloudAppType, device);

            _cloudApp.WorkflowLogger         = WorkflowLogger;
            _cloudApp.ActivityStatusChanged += LinkAppsActivityStatusChanged;

            ConnectorLog.PageCount  = _data.PageCount;
            ConnectorLog.FilePrefix = FilePrefix.ToString();
            ConnectorLog.FilePath   = _data.FolderPath + "/" + FilePrefix + "." + EnumUtil.GetDescription((FileType)_data.CloudScanOptions.FileType).ToLowerInvariant();
            ConnectorLog.LoginID    = _data.ID;

            UpdateStatus($"Starting App Launch :: {_data.CloudAppType.GetDescription()}");
            _cloudApp.Launch(_data.SIO);

            UpdateStatus($"Starting Log in :: {_data.CloudAppType.GetDescription()}");
            if (!_data.SIO.Equals(SIOMethod.SIOWithoutIDPWD))
            {
                _cloudApp.Login(_data.CloudAppType, _data.ID, _data.PWD);
            }
            else
            {
                UpdateStatus($"Skip Login");
            }

            UpdateStatus($"Starting navigate to destination :: {_data.CloudAppType.GetDescription()}");
            if (_data.CloudAppType.Equals(ConnectorName.SharePoint))
            {
                _cloudApp.SelectSharePointSite(_data.SharePointSite);
            }

            if (!String.IsNullOrEmpty(_data.FolderPath))
            {
                _cloudApp.NavigateToDestination(_data.FolderPath);
            }

            UpdateStatus($"Starting selection options :: {_data.CloudAppType.GetDescription()}");
            _cloudApp.SelectJobForSetOptions(EnumUtil.GetByDescription <ConnectorJobType>(LinkJobType));

            try
            {
                SetOptions(_cloudApp.ScanOptionManager, _data.CloudScanOptions);
            }
            catch (DeviceWorkflowException ex)
            {
                DeviceWorkflowException e = new DeviceWorkflowException($"Fail to set options: {ex.Message} :: {_data.CloudAppType.GetDescription()}", ex);
                e.Data.Add(_exceptionCategoryData, ConnectorExceptionCategory.SelectOptions.GetDescription());
                throw e;
            }
        }
Example #6
0
        /// <summary>
        /// Sets up the Clio scan job.
        /// </summary>
        /// <param name="device">The de vice.</param>
        protected override void SetupJob(IDevice device)
        {
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }
            _device = device;
            _clio   = new ClioApp(device);
            _clio.WorkflowLogger    = WorkflowLogger;
            ConnectorLog.PageCount  = _data.PageCount;
            ConnectorLog.FilePrefix = FilePrefix.ToString();

            UpdateStatus($"Starting App Launch");
            _clio.Launch(_data.SIO);

            // Login
            UpdateStatus($"Starting Log in");
            if (!_data.SIO.Equals(SIOMethod.SIOWithoutIDPWD))
            {
                _clio.Login(_data.ID, _data.PW);
            }
            else
            {
                UpdateStatus($"Skip Login");
            }

            //Select storage type
            UpdateStatus($"Select location :: {_data.Location}");
            _clio.SelectStorageLocation(_data.Location);

            //Matter
            UpdateStatus($"Select matter :: {_data.Matter}");
            _clio.SelectMatter(_data.Matter);

            // Do Navigate to destination
            if (!string.IsNullOrEmpty(_data.FolderPath))
            {
                UpdateStatus($"Navigating destination :: {_data.FolderPath}");
                _clio.NavigateToDestination(_data.FolderPath, _data.JobType);
            }
            _clio.PressScanButton();
            _clio.ScanDocumentOptions(FilePrefix.ToString().ToLowerInvariant());
            _clio.SelectJobForSetOptions(EnumUtil.GetByDescription <ClioJobType>(LinkJobType));
            // Select JobType(Scan or Print Button in the folder manager)
            try
            {
                SetOptions(_clio.ScanOptionManager, _data.ScanOptions);
            }
            catch (DeviceWorkflowException ex)
            {
                DeviceWorkflowException e = new DeviceWorkflowException($"Fali to set options: {ex.Message} :: Clio", ex);
                e.Data.Add(_exceptionCategoryData, ConnectorExceptionCategory.SelectOptions.GetDescription());
                throw e;
            }
        }
Example #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AutoStoreScanManager"/> class.
        /// </summary>
        /// <param name="executionData"></param>
        /// <!-- Badly formed XML comment ignored for member "M:HP.ScalableTest.PluginSupport.Scan.ScanActivityManager.#ctor(HP.ScalableTest.Framework.Plugin.PluginExecutionData)" -->
        public AutoStoreScanManager(PluginExecutionData executionData) : base(executionData)
        {
            _activityData = ExecutionData.GetMetadata <AutoStoreActivityData>();

            _activityData.AuthProvider = (_activityData.AutoStoreAuthentication == true) ? AuthenticationProvider.AutoStore : AuthenticationProvider.Auto;

            ScanOptions   = _activityData.ScanOptions;
            _documentName = FilePrefix.ToString();

            if (ScanLog != null)
            {
                ScanLog.Ocr = _activityData.UseOcr;
            }
        }
Example #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HpcrScanManager"/> class.
        /// </summary>
        public HpcrScanManager(PluginExecutionData executionData, ScanOptions scanOptions)
            : base(executionData)
        {
            _pluginExecutionData = executionData;
            _activityData        = _pluginExecutionData.GetMetadata <ScanToHpcrActivityData>();

            _documentName = FilePrefix.ToString();

            if (ScanLog != null)
            {
                ScanLog.Ocr = false;
            }
            ScanOptions = scanOptions;
        }
Example #9
0
        /// <summary>
        /// Finishes the job.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="configuration">The configuration.</param>
        protected override PluginExecutionResult FinishJob(IDevice device)
        {
            string wf           = GetWorkFlowEnum().GetDescription();
            string documentName = FilePrefix.ToString();

            UpdateStatus(string.Format("Pressing HPEC workflow button {0}.", wf));

            PluginExecutionResult result = new PluginExecutionResult(PluginResult.Failed, "Error occurred After Login and Job Configuration.", "Device automation error.");

            try
            {
                _hpecApp.ExecuteJob(wf, documentName);

                UpdateStatus("Start scanning the document.");

                _hpecApp.HpecStartScan(_data.PageCount);

                UpdateStatus("Processing the HPEC Workflow.");
                if (_hpecApp.ProcessJobAfterScan())
                {
                    result = new PluginExecutionResult(PluginResult.Passed);
                }

                UpdateStatus("Signing out...");
                _hpecApp.JobFinished();

                ScanLog.ScanType         = wf;
                ScanLog.DestinationCount = (short)_hpecApp.ReportedHpecPageCount;
                ScanLog.JobEndStatus     = "Success";
            }
            catch (DeviceWorkflowException ex)
            {
                UpdateStatus(ex.Message);
                ScanLog.JobEndStatus = "Failed";
                throw;
            }
            catch
            {
                UpdateStatus("Error executing activity");
                ScanLog.JobEndStatus = "Failed";
                throw;
            }
            finally
            {
                ExecutionServices.DataLogger.Submit(ScanLog);
            }
            return(result);
        }
Example #10
0
        /// <summary>
        /// Sets up the scan job.
        /// </summary>
        /// <param name="device">The device.</param>
        protected override void SetupJob(IDevice device)
        {
            ScanLog.JobEndStatus = "Failed";
            if (device == null)
            {
                throw new ArgumentNullException(nameof(device));
            }

            // Update the destination type
            ScanLog.ScanType = _data.DestinationType;

            UpdateStatus($"Setting up device at address {device.Address} for user {ExecutionData.Credential.UserName}");

            InitializeAuthenticator(_data.AuthProvider, device, ExecutionData);
            // Load the network folder application
            _folderApp = NetworkFolderAppFactory.Create(device);

            _folderApp.WorkflowLogger = Authenticator.WorkflowLogger = WorkflowLogger;
            _folderApp.Pacekeeper     = Authenticator.Pacekeeper = new Pacekeeper(_data.AutomationPause);
            _folderApp.Launch(Authenticator, !_data.ApplicationAuthentication ? AuthenticationMode.Eager : AuthenticationMode.Lazy);

            // Apply settings from the configuration
            if (_data.UseQuickset)
            {
                _folderApp.SelectQuickset(_data.QuickSetName);
            }
            else
            {
                //Network credential being passed as parameter to access the folder and it is used by jediomninetworkfolderapp now
                _folderApp.AddFolderPath(_data.FolderPath, ExecutionData.Credential, _data.ApplyCredentialsOnVerification);
            }

            // Update the destination count
            ScanLog.DestinationCount = (_data.DestinationCount > 0 ?
                                        (short)_data.DestinationCount :
                                        (short)_folderApp.GetDestinationCount());

            // Enter the file name
            _folderApp.EnterFileName(FilePrefix.ToString().ToLowerInvariant());

            //Sets the scan job options
            SetOptions(_data.ScanOptions, _folderApp.Options.GetType(), _folderApp.GetType(), device);
            ScanLog.Ocr = _data.UseOcr;

            // Set job build
            _folderApp.Options.SetJobBuildState(UseJobBuild);
        }
        /// <summary>
        /// Set options for the scan job.
        /// </summary>
        /// <param name="scanOptionsManager">The JetAdvantageLinkScanOptionManager.</param>
        /// <param name="scanOptions">The LinkScanOptions.</param>
        /// <returns>The result of the scan.</returns>
        protected override void SetOptions(JetAdvantageLinkScanOptionManager scanOptionsManager, LinkScanOptions scanOptions)
        {
            UpdateStatus($"Select option activity with File Name {FilePrefix.ToString().ToLowerInvariant()} is being started");
            scanOptionsManager.SetFileName(FilePrefix.ToString().ToLowerInvariant(), "et_filename");
            UpdateStatus($"Select option activity with File Name {FilePrefix.ToString().ToLowerInvariant()} is being completed");

            UpdateStatus($"Set the options screen");
            scanOptionsManager.SetOptionsScreen();

            if (scanOptions.UseFileTypeandResolution)
            {
                UpdateStatus($"Select option activity with File Type {scanOptions.FileType.GetDescription()}, Resolution {scanOptions.Resolution.GetDescription()} is being started");
                scanOptionsManager.SetFileTypeAndResolution(scanOptions.FileType, scanOptions.Resolution);
                UpdateStatus($"Select option activity with File Type {scanOptions.FileType.GetDescription()}, Resolution {scanOptions.Resolution.GetDescription()} is being completed");
            }

            if (scanOptions.UseOriginalSides)
            {
                UpdateStatus($"Select option activity with Original Sides {scanOptions.OriginalSides.GetDescription()} is being started");
                scanOptionsManager.SetOriginalSides(scanOptions.OriginalSides);
                UpdateStatus($"Select option activity with Original Sides {scanOptions.OriginalSides.GetDescription()} is being completed");
            }

            if (scanOptions.UseColorBlack)
            {
                UpdateStatus($"Select option activity with Color/Black {scanOptions.ColorBlack.GetDescription()} is being started");
                scanOptionsManager.SetColorBlack(scanOptions.ColorBlack);
                UpdateStatus($"Select option activity with Color/Black {scanOptions.ColorBlack.GetDescription()} is being completed");
            }

            if (scanOptions.UseOriginalSize)
            {
                UpdateStatus($"Select option activity with Original Size {scanOptions.OriginalSize.GetDescription()} is being started");
                scanOptionsManager.SetOriginalSize(scanOptions.OriginalSize);
                UpdateStatus($"Select option activity with Original Size {scanOptions.OriginalSize.GetDescription()} is being completed");
            }

            if (scanOptions.UseContentOrientation)
            {
                UpdateStatus($"Select option activity with ContentOrientation {scanOptions.ContentOrientation.GetDescription()} is being started");
                scanOptionsManager.SetOrientation(scanOptions.ContentOrientation);
                UpdateStatus($"Select option activity with ContentOrientation {scanOptions.ContentOrientation.GetDescription()} is being completed");
            }
        }
        /// <summary>
        /// Set options for the scan job.
        /// </summary>
        /// <returns>The result of the scan.</returns>
        private void SetOptions()
        {
            TimeSpan timeout    = TimeSpan.FromSeconds(5);
            string   optionText = string.Empty;

            if (_activityData.AppName == GeniusBytesScanType.Scan2Mail)
            {
                _geniusBytesApp.AddDocument(timeout);
            }

            _geniusBytesApp.SetFileName(FilePrefix.ToString(), _activityData.AppName);
            _geniusBytesApp.SetImagePreview(_activityData.ImagePreview);

            optionText = _activityData.ColourOption.GetDescription();
            if (!_geniusBytesApp.ExistElementText(optionText))
            {
                UpdateStatus($"Setting color option to {optionText}.");
                _geniusBytesApp.SelectColorOption(_activityData.ColourOption, timeout);
            }

            optionText = _activityData.SidesOption.GetDescription();
            if (!_geniusBytesApp.ExistElementText(optionText))
            {
                UpdateStatus($"Setting sides option to {optionText}.");
                _geniusBytesApp.SelectSidesOption(_activityData.SidesOption, timeout);
            }

            optionText = _activityData.ResolutionOption.GetDescription();
            if (!_geniusBytesApp.ExistElementText(optionText))
            {
                UpdateStatus($"Setting resolution option to {optionText}.");
                _geniusBytesApp.SelectResolutionOption(_activityData.ResolutionOption, timeout);
            }

            if (_activityData.FileType != GeniusByteScanFileTypeOption.Multipage_PDF)
            {
                _geniusBytesApp.SetFileType(_activityData.FileType, timeout);
            }
        }
Example #13
0
 public override int GetHashCode()
 {
     return(Ratio.GetHashCode() ^ Path.GetHashCode() ^ FilePrefix.GetHashCode() ^ FileSuffix.GetHashCode());
 }
Example #14
0
        /// <summary>
        /// Sets up the Fax job.
        /// </summary>
        /// <param name="device">The device.</param>
        private void SendFaxSetupJob(IDevice device)
        {
            UpdateStatus("Setting up Fax Send job...");
            ScanLog.JobEndStatus = "Failed";
            if (device == null)
            {
                throw new ArgumentNullException(nameof(device));
            }

            UpdateStatus(string.Format("Setting up device at address {0} for user {1}", device.Address, ExecutionData.Credential.UserName));

            InitializeAuthenticator(_data.AuthProvider, device, ExecutionData);
            // Load the fax application
            _faxApp = FaxAppFactory.Create(device);

            // need to add the ability for user to set eager or lazy authentication
            AuthenticationMode am = (_data.ApplicationAuthentication == false) ? AuthenticationMode.Eager : AuthenticationMode.Lazy;

            _faxApp.WorkflowLogger = Authenticator.WorkflowLogger = WorkflowLogger;
            _faxApp.Pacekeeper     = Authenticator.Pacekeeper = new Pacekeeper(_data.AutomationPause);
            _faxApp.Launch(Authenticator, am);

            if (!_data.UseSpeedDial)
            {
                if (string.IsNullOrEmpty(_data.FaxNumber) || string.IsNullOrWhiteSpace(_data.FaxNumber))
                {
                    // Apply settings from configuration
                    _faxApp.AddRecipient(FilePrefix.ToFaxCode());
                }
                else
                {
                    _faxApp.AddRecipient(_data.FaxNumber);
                }
            }
            else
            {
                Dictionary <string, string> recipients = new Dictionary <string, string>();
                string[] FaxNums;
                if (_data.FaxNumber == null || string.IsNullOrWhiteSpace(_data.FaxNumber))
                {
                    // Apply settings from configuration
                    FaxNums = FilePrefix.ToFaxCode().Split(',');
                    foreach (string FaxNum in FaxNums)
                    {
                        recipients[FaxNum] = string.Empty;
                    }
                    _faxApp.AddRecipients(recipients, false);
                }
                else
                {
                    FaxNums = _data.FaxNumber.Split(',');
                    string[] PINs = new string[FaxNums.Length];
                    _data.PIN.Split(',', (char)StringSplitOptions.None).CopyTo(PINs, 0);
                    for (int i = 0; i < FaxNums.Count(); i++)
                    {
                        recipients[FaxNums[i]] = PINs[i];
                    }

                    _faxApp.AddRecipients(recipients, _data.UseSpeedDial);
                }
            }

            if (_data.EnableNotification)
            {
                EmailBuilder emailAddress = new EmailBuilder(_data.NotificationEmail, ExecutionData);
                //sending false parameter for thumbNail as it is unchecked bydefault
                _faxApp.Options.EnableEmailNotification(NotifyCondition.Always, emailAddress.ToString(), false);
            }

            //Sets the scan job options
            SetOptions(_data.ScanOptions, _faxApp.Options.GetType(), _faxApp.GetType(), device);
            _faxApp.Options.SetJobBuildState(this.UseJobBuild);

            // OCR is not applicable for fax jobs
            ScanLog.Ocr = false;
            UpdateStatus("Job setup complete");
            _pacekeeper.Pause();
        }
Example #15
0
        /// <summary>
        /// Sets up the scan job.
        /// </summary>
        /// <param name="device">The device.</param>
        protected override void SetupJob(IDevice device)
        {
            ScanLog.JobEndStatus = "Failed";
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }

            // Update the destination type
            ScanLog.ScanType = _data.DestinationType;
            ScanLog.Ocr      = _data.UseOcr;

            UpdateStatus(string.Format("Setting up device at address {0} for user {1}", device.Address, ExecutionData.Credential.UserName));

            InitializeAuthenticator(_data.AuthProvider, device, ExecutionData);
            // Load the workflow application
            _workflowApp = DssWorkflowAppFactory.Create(device);

            _workflowApp.WorkflowLogger = Authenticator.WorkflowLogger = WorkflowLogger;
            _workflowApp.Pacekeeper     = Authenticator.Pacekeeper = new Pacekeeper(_data.AutomationPause);

            _workflowApp.Launch(Authenticator, !_data.ApplicationAuthentication ? AuthenticationMode.Eager : AuthenticationMode.Lazy);

            // Select the workflow and enter the parameters
            _workflowApp.SelectWorkflow(_data.WorkflowName);
            foreach (WorkflowPromptValue item in _data.PromptValues)
            {
                EnterPromptValue(_workflowApp, item);
            }

            if (!_data.ExcludeFileNamePrompt)
            {
                // Set the file name (required for validation)
                WorkflowPromptValue fileNamePrompt = new WorkflowPromptValue(FileNamePrompt, FilePrefix.ToString().ToLowerInvariant());
                EnterPromptValue(_workflowApp, fileNamePrompt);
            }

            // Set job build
            _workflowApp.Options.SetJobBuildState(this.UseJobBuild);
        }
Example #16
0
        /// <summary>
        /// Sets up the scan job.
        /// </summary>
        /// <param name="device">The device.</param>
        protected override void SetupJob(IDevice device)
        {
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }

            InitializeAuthenticator(_data.AuthProvider, device, ExecutionData);

            // Update the destination type
            ScanLog.ScanType = _data.UsbName;

            UpdateStatus(string.Format("Setting up device at address {0} for user {1}", device.Address, ExecutionData.Credential.UserName));

            // Load the network folder application

            _usbApp = UsbAppFactory.Create(device);

            _usbApp.WorkflowLogger = Authenticator.WorkflowLogger = WorkflowLogger;
            _usbApp.Pacekeeper     = Authenticator.Pacekeeper = new Pacekeeper(_data.AutomationPause);

            // need to add the ability for user to set eager or lazy authentication
            AuthenticationMode am = (_data.ApplicationAuthentication == false) ? AuthenticationMode.Eager : AuthenticationMode.Lazy;

            if (device is JediOmniDevice)
            {
                _usbApp.LaunchScanToUsb(Authenticator, am);

                // Apply settings from the configuration
                if (_data.UseQuickset)
                {
                    _usbApp.SelectQuickset(_data.QuickSetName);
                }
                else
                {
                    _usbApp.SelectUsbDevice(_data.UsbName);
                }
            }
            else if (device is JediWindjammerDevice)
            {
                if (!_data.UseQuickset)
                {
                    _usbApp.LaunchScanToUsb(Authenticator, am);
                    _usbApp.SelectUsbDevice(_data.UsbName);
                }
                else
                {
                    _usbApp.LaunchScanToUsbByQuickSet(Authenticator, am, _data.QuickSetName);
                }
            }


            // Enter the file name
            _usbApp.AddJobName(FilePrefix.ToString().ToLowerInvariant());

            // Select the appropriate file type
            //_usbApp.Options.SelectFileType(_data.UseOcr ? "Searchable PDF (OCR)" : "PDF");
            //Sets the scan job options
            SetOptions(_data.ScanOptions, _usbApp.Options.GetType(), _usbApp.GetType(), device);
            ScanLog.Ocr = _data.UseOcr;

            // Set job build
            _usbApp.Options.SetJobBuildState(this.UseJobBuild);
        }
Example #17
0
 protected override void Act()
 {
     Sut = new FilePrefix();
 }
        /// <summary>
        /// Sets up the LinkScanApps scan job.
        /// </summary>
        /// <param name="device">The de vice.</param>
        protected override void SetupJob(IDevice device)
        {
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }

            _device = device;

            _linkScanApp = new LinkScanApp(_data.ScanDestination, device);
            _linkScanApp.WorkflowLogger         = WorkflowLogger;
            _linkScanApp.ActivityStatusChanged += LinkAppsActivityStatusChanged;

            UpdateStatus($"Starting App Launch :: {EnumUtil.GetDescription(_data.ScanDestination)}");
            _linkScanApp.Launch();

            UpdateStatus($"Starting navigate to destination :: {EnumUtil.GetDescription(_data.ScanDestination)}");

            if (!_data.FileNameIsChecked)
            {
                _data.FileName = FilePrefix.ToString();
            }
            if (!_data.SubjectIsChecked)
            {
                _data.Subject = FilePrefix.ToString();
            }
            if (!_data.MessageIsChecked)
            {
                _data.Message = "";
            }
            try
            {
                switch (_data.ScanDestination)
                {
                case LinkScanDestination.Email:
                    UpdateStatus($"Starting Email Job Setting");
                    ScanToEmailInfo emailInfo = new ScanToEmailInfo()
                    {
                        From    = _data.From,
                        To      = _data.To,
                        Cc      = _data.Cc,
                        Bcc     = _data.Bcc,
                        Subject = _data.Subject,
                        Message = _data.Message
                    };
                    _linkScanApp.EmailJobSetting(_data.FileName, emailInfo);
                    break;

                case LinkScanDestination.FTP:
                    UpdateStatus($"Starting FTP Job Setting");
                    ScanToSMBFTPInfo ftpInfo = new ScanToSMBFTPInfo()
                    {
                        Server     = _data.Server,
                        UserName   = _data.UserName,
                        Password   = _data.Password,
                        DomainPort = _data.DomainPort,
                        FolderPath = _data.FolderPath
                    };
                    _linkScanApp.FileNameFolderPathSetting(_data.FileName, ftpInfo);
                    break;

                case LinkScanDestination.SMB:
                    UpdateStatus($"Starting SMB Job Setting");
                    ScanToSMBFTPInfo smbInfo = new ScanToSMBFTPInfo()
                    {
                        Server     = _data.Server,
                        UserName   = _data.UserName,
                        Password   = _data.Password,
                        DomainPort = _data.DomainPort
                    };
                    _linkScanApp.FileNameFolderPathSetting(_data.FileName, smbInfo);
                    break;

                default:
                    throw new DeviceWorkflowException($"Scan destination is not valid: {EnumUtil.GetDescription(_data.ScanDestination)}");
                }

                UpdateStatus($"Starting selection options :: {EnumUtil.GetDescription(_data.ScanDestination)}");

                SetOptions(_linkScanApp.ScanOptionManager, _data.ScanOptions);
            }
            catch (DeviceWorkflowException ex)
            {
                if (ex.Data.Contains(_exceptionCategoryData))
                {
                    throw;
                }

                DeviceWorkflowException e = new DeviceWorkflowException(ex.Message + $" :: {EnumUtil.GetDescription(_data.ScanDestination)}", ex);
                e.Data.Add(_exceptionCategoryData, ConnectorExceptionCategory.SelectOptions.GetDescription());
                throw e;
            }
        }
Example #19
0
 protected override void Act()
 {
     Sut = new FilePrefix();
 }