예제 #1
0
        private static void CompareLinks()
        {
            string fileName = ExcelHandler.GetLastFileName(_options.FolderPath, _options.Name + "AllLinksTable*.xlsx");

            if (!string.IsNullOrEmpty(fileName))
            {
                Dictionary <string, Object> lastParseLinks = ExcelHandler.LoadFileToDictionary(_options.FolderPath + "\\" + fileName);
                if (lastParseLinks != null)
                {
                    Dictionary <string, string> differentLinksMap = new Dictionary <string, string>();
                    foreach (var lastTimeVistLink in lastParseLinks.Keys)
                    {
                        if (!string.IsNullOrEmpty(lastTimeVistLink) && !pageVisitedURLMapping.ContainsKey(new Uri(lastTimeVistLink)))
                        {
                            differentLinksMap.Add(lastTimeVistLink, "Last Time has link");
                        }
                    }
                    foreach (var thisTimeVistLink in pageVisitedURLMapping.Keys)
                    {
                        if (!lastParseLinks.ContainsKey(thisTimeVistLink.ToString()))
                        {
                            differentLinksMap.Add(thisTimeVistLink.ToString(), "This Time has link");
                        }
                    }

                    ExcelHandler.DataTableToExcel(_options.FolderPath + "\\" + _options.Name + "Different" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx", ExcelHandler.DictToDatatTable(differentLinksMap), "Sheet1");
                }
            }
        }