static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ExportRuntimePoliciesIfTheProtectOptionsHaveBeenModified(); string outputDir = string.Empty; List<string> filelist = ParseArgsAndGetFileList(args, ref outputDir); if (filelist.Count == 0) return; CleanerController controller = new CleanerController(); controller.Files.PasswordProtectedFile += OnPasswordProtectedFile; controller.WriteToFolder = outputDir; ReadProgressForm readProgress = new ReadProgressForm(controller, filelist); readProgress.ShowDialog(); if (controller.GetRealFileCount() == 0) return; ContainerForm optionsForm = new ContainerForm(controller); optionsForm.ShowDialog(); try { controller.Dispose(); } catch (Exception ex) { Workshare.Interop.Logging.Logger.LogError(ex); } }
public ContainerForm(CleanerController controller) : base(WorkshareFormUtility.DialogLevel.Primary, WorkshareFormUtility.BrandType.Protect, "Batch Clean") { InitializeComponent(); TopMost = true; m_controller = controller; m_controller.CleanProcessComplete += OnCleanProcessComplete; m_controller.CleanProcessCancelled += OnCleanProcessCancelled; m_controller.ProcessComplete += OnProcessComplete; m_optionCtl = new Options(controller); m_progessCtl = new Progress(controller); m_reportCtl = new Report(controller); m_optionCtl.Visible = true; m_optionCtl.ShowSavingGroupBox(true); m_progessCtl.Visible = false; m_reportCtl.Visible = false; pnlDetail.Controls.Add(m_optionCtl); pnlDetail.Controls.Add(m_progessCtl); pnlDetail.Controls.Add(m_reportCtl); if (!m_optionCtl.HasValidFiles()) btnClean_Click(this, new EventArgs()); }
public ReadProgressForm(CleanerController controller) : base(WorkshareFormUtility.DialogLevel.Tertiary, "Reading Files...") { _controller = controller; _controller.Files.ReadFile += OnReadFile; InitializeComponent(); }
static void Main(string[] args) { if (!Licensing.IsLicensed(Licensing.ProtectEnterpriseClient, ".", false)) { Console.WriteLine(Properties.Resources.UNLICENSED); return; } ParamParser parser = new ParamParser(); if (args == null || args.Length < 1) { Console.Write(parser.GetCommandLineHelp()); return; } if (!parser.Parse(args)) { Console.Write(parser.GetCommandLineHelp()); return; } InitializeSummary(); CleanerController controller = new CleanerController(); controller.WriteToFolder = parser.WriteToFolder; controller.FileProcessed += OnFileProcessed; controller.ProcessComplete += OnProcessComplete; controller.CleanProcessCancelled += OnCleanProcessCancelled; controller.Files.ReadFile += OnReadFile; List<string> allfiles = new List<string>(); allfiles.AddRange(parser.Files); allfiles.AddRange(parser.Folders); Console.Write(Properties.Resources.READING); controller.AddFilesForProcessing(allfiles, parser.IncludeSubDirectories); Console.Write(Environment.NewLine); controller.Options.UnCheckAll(); controller.Options.CheckById(parser.Options); controller.Process(); controller.Dispose(); }
public Options(IBatchCleanController controller) { m_controller = controller as CleanerController; notOverridableItems = new Dictionary<int, string>(); InitializeComponent(); // Hide this groupbox we get used as an options list in PDFCombine // ContainerForm will show it when loading this control. ShowSavingGroupBox(false); m_bInit = true; foreach (Option option in m_controller.Options) { if (m_controller.Options.ShouldShowOptionForFileList(option.ID, m_controller.Files)) { optionsList.Items.Add(option, option.Checked); m_controller.Options[option.ID].Checked = option.Checked; } } for (int index = 0; index < optionsList.Items.Count; index++) { var opt = optionsList.Items[index] as Option; if (opt != null && !opt.CanUserOverride) { notOverridableItems.Add(index, opt.ID); optionsList.DisableItem(index, opt.ID); } } if (!String.IsNullOrEmpty(m_controller.WriteToFolder)) { txtWriteToFolder.Text = m_controller.WriteToFolder; radSaveNewLocation.Checked = true; } if (!CanOwerwriteAllFiles(m_controller.Files)) { radOverwrite.Enabled = false; radSaveNewLocation.Checked = true; } m_bInit = false; }
public void Test02_DocumentStatistics_SUPPORTED_BUT_NOT_WORKING() { System.IO.File.Delete(TEST_OUTPUT_FOLDER + "dirty.doc"); string fileName = TEST_FOLDER + "dirty.doc"; IFile file = new File(fileName, "dirty.doc"); Assert.IsTrue(DoesFileHaveMetdata(file, "DocumentStatistic")); file.Dispose(); CleanerController cleaner = new CleanerController(); cleaner.Options.UnCheckAll(); cleaner.Options["DocumentStatistics"].Checked = true; cleaner.WriteToFolder = TEST_OUTPUT_FOLDER; cleaner.Files.AddRange(new string[] { fileName }, false); cleaner.Process(); file = new File(TEST_OUTPUT_FOLDER + "dirty.doc", "dirty.doc"); Assert.IsFalse(DoesFileHaveMetdata(file, "DocumentStatistic")); System.IO.File.Delete(TEST_OUTPUT_FOLDER + "dirty.doc"); }
public void Test01_Footnotes_SUPPORTED() { System.IO.File.Delete(TEST_OUTPUT_FOLDER + "footnotes.doc"); string fileName = TEST_FOLDER + "footnotes.doc"; IFile file = new File(fileName, "footnotes.doc"); Assert.IsTrue(DoesFileHaveMetdata(file, "Footnote")); file.Dispose(); CleanerController cleaner = new CleanerController(); cleaner.Options.UnCheckAll(); cleaner.Options["Footnotes"].Checked = true; cleaner.WriteToFolder = TEST_OUTPUT_FOLDER; cleaner.Files.AddRange(new string[]{fileName}, false); cleaner.Process(); file = new File(TEST_OUTPUT_FOLDER + "footnotes.doc", "footnotes.doc"); Assert.IsFalse(DoesFileHaveMetdata(file, "Footnote")); System.IO.File.Delete(TEST_OUTPUT_FOLDER + "footnotes.doc"); }
public void Test04_Headers_NOTAPPLICABLE() { System.IO.File.Delete(TEST_OUTPUT_FOLDER + "headers.docx"); string fileName = TEST_FOLDER + "headers.docx"; IFile file = new File(fileName, "headers.docx"); Assert.IsTrue(DoesFileHaveMetdata(file, "Header")); file.Dispose(); CleanerController cleaner = new CleanerController(); cleaner.Options.UnCheckAll(); cleaner.Options["Headers"].Checked = true; cleaner.WriteToFolder = TEST_OUTPUT_FOLDER; cleaner.Files.AddRange(new string[]{fileName}, false); cleaner.Process(); file = new File(TEST_OUTPUT_FOLDER + "headers.docx", "headers.docx"); Assert.IsTrue(DoesFileHaveMetdata(file, "Header")); System.IO.File.Delete(TEST_OUTPUT_FOLDER + "headers.docx"); }
public Report(CleanerController controller) { InitializeComponent(); controller.FileProcessed += OnFileProcessed; }
public void Test20_HiddenText_SUPPORTED() { System.IO.File.Delete(TEST_OUTPUT_FOLDER + "HiddenText.rtf"); string fileName = TEST_FOLDER + "HiddenText.rtf"; IFile file = new File(fileName, "HiddenText.rtf"); Assert.IsTrue(DoesFileHaveMetadata(file, "HiddenText")); file.Dispose(); CleanerController cleaner = new CleanerController(); cleaner.Options.UnCheckAll(); cleaner.Options["HiddenText"].Checked = true; cleaner.WriteToFolder = TEST_OUTPUT_FOLDER; cleaner.Files.AddRange(new string[]{fileName}, false); cleaner.Process(); file = new File(TEST_OUTPUT_FOLDER + "HiddenText.rtf", "HiddenText.rtf"); Assert.IsFalse(DoesFileHaveMetadata(file, "HiddenText")); System.IO.File.Delete(TEST_OUTPUT_FOLDER + "HiddenText.rtf"); }
public void Test12_RoutingSlip_SUPPORTED() { System.IO.File.Delete(TEST_OUTPUT_FOLDER + "testroutingslip.rtf"); IFile file = new File(TEST_FOLDER + "testroutingslip.rtf", "testroutingslip.rtf"); Assert.IsTrue(DoesFileHaveMetadata(file, "RoutingSlip")); CleanerController cleaner = new CleanerController(); cleaner.Files.Add(file); cleaner.Options.UnCheckAll(); cleaner.Options["RoutingSlip"].Checked = true; cleaner.WriteToFolder = TEST_OUTPUT_FOLDER; cleaner.Process(); file = new File(TEST_OUTPUT_FOLDER + "testroutingslip.rtf", "testroutingslip.rtf"); Assert.IsFalse(DoesFileHaveMetadata(file, "RoutingSlip")); System.IO.File.Delete(TEST_OUTPUT_FOLDER + "testroutingslip.rtf"); }