示例#1
0
		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();
		}
示例#2
0
        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");
        }
示例#3
0
        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");
        }
示例#5
0
        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");
        }
示例#6
0
        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");
        }