Exemple #1
0
        private void OnModify(object sender, FileSystemEventArgs e)
        {
            Utilities.Files fileUtil = new Utilities.Files();

            while (fileUtil.IsFileLocked(e.FullPath))
            {
                Thread.Sleep(500);
            }

            if (e.Name.StartsWith("SR")) // cannot use Config.Filter cause the * at the end of string...
            {
                Console.WriteLine("[INFO] New Structured Report");
                Console.WriteLine(e.FullPath);
                Console.WriteLine();

                Report report = new Report();
                report.CreateFullReport(new FileInfo(e.FullPath), Config.tempOut);
            }

            File.Delete(e.FullPath);
        }
Exemple #2
0
        static void ParseFilesOnFolder(DirectoryInfo sourceDir)
        {
            // Search for SR on folder
            foreach (FileInfo file in sourceDir.EnumerateFiles(Config.fileFilter))
            {
                Report report = new Report();
                try
                {
                    report.CreateFullReport(file, Config.tempOut);
                    file.Delete();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("[ERROR] Main -> There was an error trying to create the report:\n{0}", file.FullName);
                    continue;
                }
            }

            // Remove garbage
            foreach (FileInfo file in sourceDir.EnumerateFiles())
            {
                Report report = new Report();
                try
                {
                    file.Delete();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("[ERROR] Main -> There was an error trying to delete garbage:\n{0}\n{1}", file.FullName, ex.Message);
                    continue;
                }
            }
        }