/// <summary> /// Getting web browsing history. /// </summary> /// <returns>Lists with browsing history.</returns> public BrowsingHistoryLists GetBrowsingHistory() { var configModel = _configurationManagement.GetConfigModel(); var browsing = BrowsingHistory.GetInstance("Default", configModel.WebHistoryPath); var browsingHistoryLists = new BrowsingHistoryLists(); List <BrowsingHistoryTab> browsingHistoryTabs = new List <BrowsingHistoryTab>(); foreach (var f in browsing.GetHistoryFromDatabase(configModel.WebHistoryQueryLimit)) { browsingHistoryTabs.Add(new BrowsingHistoryTab(f.GetUrl(), f.GetTitle(), f.GetLastVisitTime(), f.GetDurationTime())); } browsingHistoryLists.BrowsingHistoryList = browsingHistoryTabs; browsingHistoryLists.Timestamp = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds(); return(browsingHistoryLists); }
public string GenerateTable <T>(Stack <T> stack, int option) { ComboModel comboModel = new ComboModel(); string _table = ""; int itelator = 0; while (stack.Count > 0) { if (option == 0) { ProcessList processList = (ProcessList)(object)stack.Pop(); if (processList == null) { _table += ""; } _table += "<h4>Data raportu: " + DateTimeOffset.FromUnixTimeSeconds(processList.Timestamp) + "</h4>"; _table += @"<div class=""table-responsive""><table class=""table table-striped table-sm""><thead><tr><th scope=""col"">#</th><th scope=""col"">ID</th><th scope=""col"">Nazwa</th><th scope=""col"">Data startu</th></tr></thead><tbody>"; foreach (var modelProcessList in processList.ProcessObjectList) { itelator++; StringBuilder tempBuilder = new StringBuilder(); tempBuilder.AppendFormat( @"<tr><th scope=""row"">{0}</th><td>{1}</td><td>{2}</td><td>{3}</td></tr>", itelator, modelProcessList.Id, modelProcessList.Name, modelProcessList.StartTime); _table += tempBuilder.ToString(); } _table += "</table> </div>"; itelator = 0; } if (option == 1) { BrowsingHistoryLists browsingHistory = (BrowsingHistoryLists)(object)stack.Pop(); _table += "<h4>Data raportu: " + DateTimeOffset.FromUnixTimeSeconds(browsingHistory.Timestamp) + "</h4>"; _table += @"<div class=""table-responsive""><table class=""table table-striped table-sm""><thead><tr><th scope=""col"">#</th><th scope=""col"">Nazwa strony www</th><th scope=""col"">Adres URL</th><th scope=""col"">Czas spędzony na witrynie</th><th scope=""col"">Czas ostatniej wizyty</th></tr></thead><tbody>"; foreach (var moBrowsingHistoryTab in browsingHistory.BrowsingHistoryList) { itelator++; StringBuilder tempBuilder = new StringBuilder(); tempBuilder.AppendFormat( @"<tr><th scope=""row"">{0}</th><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td></tr>", itelator, moBrowsingHistoryTab.GetTitle, moBrowsingHistoryTab.GetUrl, moBrowsingHistoryTab.GetDurationTime, DateTimeOffset.FromUnixTimeSeconds(moBrowsingHistoryTab.GetLastVisitTime)); _table += tempBuilder.ToString(); } _table += "</table> </div>"; itelator = 0; } if (option == 2) { FileDirectoryList fileDirectory = (FileDirectoryList)(object)stack.Pop(); _table += "<h4>Data raportu: " + DateTimeOffset.FromUnixTimeSeconds(fileDirectory.Timestamp) + "</h4>"; _table += @"<div class=""table-responsive""><table class=""table table-striped table-sm""><thead><tr><th scope=""col"">#</th><th scope=""col"">Ścieżka dostępu</th><th scope=""col"">Data utworzenia </th><th scope=""col"">Data ostatniego dostępu</th><th scope=""col"">Data ostatniego zapisu</th></tr></thead><tbody>"; foreach (var moFileDirectory in fileDirectory.FileDirectories) { itelator++; StringBuilder tempBuilder = new StringBuilder(); tempBuilder.AppendFormat( @"<tr><th scope=""row"">{0}</th><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td></tr>", itelator, moFileDirectory.FullName, moFileDirectory.CreationTimeUtc, moFileDirectory.LastAccessTimeUtc, moFileDirectory.LastWriteTimeUtc); _table += tempBuilder.ToString(); } _table += "</table> </div>"; itelator = 0; } } return(_table); }