/// <summary>
 /// working constructor
 /// </summary>
 /// <param name="directory"></param>
 public RedirectJob(string directory)
 {
     urlUtils         = new UrlUtils();
     existing301Utils = new Existing301Utils();
     newUrlSiteMap    = new List <Tuple <string, string> >();
     jobIOProcessor   = new RedirectJobIOProcessor(directory);
     redirectMatcher  = new RedirectMatcher();
     subProjectMaps   = new List <Tuple <string, string> >();
     urlDtos          = new List <UrlDto>();
 }
Exemple #2
0
        internal void prepLostMatch(Existing301Utils existing301Utils, string url)
        {
            List <string> segments = new List <string>();
            Uri           uri      = new Uri((url.StartsWith("http")) ? url : "https://www.thisgoesnowhere.com" + url);

            segments = uri.Segments.ToList();
            if (uri.Host != "www.thisgoesnowhere.com")
            {
                segments[0] = uri.GetLeftPart(UriPartial.Scheme) + uri.Host + "/";
            }

            existing301Utils.iterateThroughAllCatchAllsInUrl(segments.ToArray(), segments.Count);

            //existing301Utils.updatePotentialCatchAllList(url);
            //existing301Utils.CatchAllCount++;
            //throw new NotImplementedException();
        }
Exemple #3
0
 internal void export301CatchAllCSV(Existing301Utils existing301Utils)
 {
     ExportToCSV(existing301Utils.ExportCatchAllsToList(), Output301CatchAllFile);
     addToLogDump($"total number of catchalls found: {existing301Utils.CatchAllCount}");
 }
Exemple #4
0
        /// <summary>
        /// Start the finder program
        /// Initialize stopwatch.
        /// Import both the old urls and new urls into lists
        /// compare the new urls to the old urs using FindUrlMatches
        /// Export all found catchalls to a CSV file
        /// Export the lost url list and found url list to their respective CSVs
        /// Stop and display the recorded time on the stopwatch.
        /// </summary>
        internal void Run(List <UrlDto> urlDtos, List <Tuple <string, string> > newUrlSiteMap, Existing301Utils existing301Utils)
        {
            Console.WriteLine("begin search: ");

            foreach (var urlDto in urlDtos)
            {
                if (!urlDto.OriginalUrl.Contains(".pdf") && !existing301Utils.checkExisting301Redirects(urlDto) && !findMatching301(urlDto, newUrlSiteMap))
                {
                    urlDto.Flag = "no match";
                    prepLostMatch(existing301Utils, urlDto.OriginalUrl);
                }
            }
            Console.WriteLine("end search");
        }