コード例 #1
0
ファイル: AutomatedScanning.cs プロジェクト: damieng/naps2
        private void ReorderScannedImages()
        {
            var sep = options.SplitPatchT ? SaveSeparator.PatchT
                : options.SplitScans ? SaveSeparator.FilePerScan
                    : options.SplitSize > 0 || options.Split ? SaveSeparator.FilePerPage
                        : SaveSeparator.None;

            scanList = SaveSeparatorHelper.SeparateScans(scanList, sep, options.SplitSize).Where(x => x.Count > 0).ToList();

            foreach (var scan in scanList)
            {
                var imageList = new ScannedImageList(scan);
                var e         = new List <int>();

                if (options.AltDeinterleave)
                {
                    imageList.AltDeinterleave(e);
                }
                else if (options.Deinterleave)
                {
                    imageList.Deinterleave(e);
                }
                else if (options.AltInterleave)
                {
                    imageList.AltInterleave(e);
                }
                else if (options.Interleave)
                {
                    imageList.Interleave(e);
                }
                else if (options.DividedScanBooklet)
                {
                    imageList.DividedScanBooklet(e);
                }
                if (options.Reverse)
                {
                    imageList.Reverse(e);
                }
            }
        }
コード例 #2
0
        public void Execute()
        {
            try
            {
                if (!ValidateOptions())
                {
                    return;
                }

                startTime = DateTime.Now;
                ConsoleOverwritePrompt.ForceOverwrite = options.ForceOverwrite;

                if (options.Install != null)
                {
                    InstallComponents();
                    if (options.OutputPath == null && options.EmailFileName == null && !options.AutoSave)
                    {
                        return;
                    }
                }

                if (!PreCheckOverwriteFile())
                {
                    return;
                }

                imageList = new ScannedImageList();

                if (options.ImportPath != null)
                {
                    ImportImages();
                }

                if (options.Number > 0)
                {
                    ScanProfile profile;
                    if (!GetProfile(out profile))
                    {
                        return;
                    }

                    PerformScan(profile);
                }

                ReorderScannedImages();

                if (options.OutputPath != null)
                {
                    ExportScannedImages();
                }

                if (options.EmailFileName != null)
                {
                    EmailScannedImages();
                }

                foreach (var image in imageList.Images)
                {
                    image.Dispose();
                }

                imageList = null;
            }
            catch (Exception ex)
            {
                Log.FatalException("An error occurred that caused the console application to close.", ex);
                Console.WriteLine(ConsoleResources.UnexpectedError);
            }
            finally
            {
                if (options.WaitForEnter)
                {
                    Console.ReadLine();
                }
            }
        }