예제 #1
0
        /// <summary>
        /// working constructor
        /// </summary>
        /// <param name="directory"></param>
        public RedirectJobIOProcessor(string directory)
        {
            Directory = directory;

            if (System.IO.Directory.GetFiles(Directory, "*.xlsx").Length != 0)
            {
                Console.WriteLine("WARNING: Folder contains one or more xlsx files. Please change any xlsx file types to csv.");
                Gremlin.SendEmail("*****@*****.**", "xlsx files detected", "WARNING: Folder contains one or more xlsx files. Please change any xlsx file types to csv.");
            }

            InputOldUrlFile      = System.IO.Directory.GetFiles(Directory, "OldSiteUrls.csv")[0];
            InputNewUrlFile      = System.IO.Directory.GetFiles(Directory, "NewSiteUrls.csv")[0];
            InputExisting301File = System.IO.Directory.GetFiles(Directory, "Existing301s.csv")[0];
            if (File.Exists(Path.Combine(Directory, @"SubProjects.csv")))
            {
                InputSubProjectFile = System.IO.Directory.GetFiles(Directory, "SubProjects.csv")[0];
            }
            LogFile               = Directory + @"\Log.txt";
            OutputFolder          = Path.Combine(Directory, @"Output");
            OutputFoundUrlFile    = Path.Combine(OutputFolder, @"FoundRedirects.csv");
            OutputLostUrlFile     = Path.Combine(OutputFolder, @"LostRedirects.csv");
            Output301CatchAllFile = Path.Combine(OutputFolder, @"Possible301Catchalls.csv");

            checkForLog();
        }
예제 #2
0
        private void startJobs(List <RedirectJob> jobList)
        {
            string emailAddresses = "";

            foreach (var job in jobList)
            {
                job.Start();
                emailAddresses += job.EmailAddresses + ";";
            }
            if (jobList.Count > 0)
            {
                Gremlin.SendEmail("*****@*****.**", $"There are {jobList.Count} new jobs.", $"Emails are being sent to {emailAddresses}");
            }
        }
예제 #3
0
        public void Start()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            EmailAddresses = jobIOProcessor.getEmailAddresses();
            jobIOProcessor.addToLogDump($"job started at {DateTime.Now.ToString("MM/dd/yyyy HH:mm")}");
            jobIOProcessor.CreateOutputDirectory();
            Console.WriteLine("starting");
            importExisting301s();
            importUrlHeaderMaps();

            startRedirectFinder();

            jobIOProcessor.writeToLogDump();
            Console.WriteLine($"Sending email to {EmailAddresses}");
            Gremlin.SendEmail(EmailAddresses, $"Your redirect job for {Path.GetFileName(jobIOProcessor.Directory)} is done.", $"Your redirect job for {jobIOProcessor.Directory} is done. Please retrieve it within 24 hours");
        }
        /// <summary>
        /// start redirect job methods
        /// </summary>
        public void Start()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            EmailAddresses = jobIOProcessor.getEmailAddresses();
            jobIOProcessor.addToLogDump($"job started at {DateTime.Now.ToString("MM/dd/yyyy HH:mm")}");
            jobIOProcessor.CreateOutputDirectory();
            Console.WriteLine("starting");
            importListsFromFiles();
            startRedirectFinder();
            exportListsToFiles();
            Console.WriteLine($"Sending email to {EmailAddresses}");
            stopwatch.Stop();
            TimeSpan ts          = stopwatch.Elapsed;
            string   elapsedTime = "Elapsed time: " + String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);

            jobIOProcessor.addToLogDump(elapsedTime);
            jobIOProcessor.writeToLogDump();

            Gremlin.SendEmail(EmailAddresses, $"Your redirect job for {Path.GetFileName(jobIOProcessor.Directory)} is done.", $"Your redirect job for {jobIOProcessor.Directory} is done. Please retrieve it within 24 hours");
        }