Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     MarkupCleaner cleaner = new MarkupCleaner();
     cleaner.ErrorOccured += new EventHandler(cleaner_ErrorOccured);
     cleaner.OptionFile = "foo.tidy";
     //cleaner.ErrorFile = "errors.txt";
     cleaner.CleanFile("foo.html", "foo.out.html");
     //Console.WriteLine("Press enter to end.");
     //Console.ReadLine();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// When overridden in a derived class, executes the task.
        /// </summary>
        /// <returns>
        /// true if the task successfully executed; otherwise, false.
        /// </returns>
        public override bool Execute()
        {
            List<string> inputFiles = new List<string>();
            foreach (ITaskItem item in InputFiles)
            {
                inputFiles.Add(item.ItemSpec);
            }
            List<string> outputFiles = new List<string>();
            foreach (ITaskItem item in OutputFiles)
            {
                outputFiles.Add(item.ItemSpec);
            }

            MarkupCleaner cleaner = new MarkupCleaner();
            cleaner.OptionFile = OptionFile;
            cleaner.ErrorFile = ErrorFile;

            for (int i = 0; i < inputFiles.Count; i++)
            {
                if (Verbose)
                {
                    Console.WriteLine("Cleaning: " + inputFiles[i] + " -> " + outputFiles[i]);
                }
                cleaner.CleanFile(inputFiles[i], outputFiles[i]);
            }

            return true;
        }