-
Notifications
You must be signed in to change notification settings - Fork 100
/
Copy pathHistoryUrl.cs
46 lines (41 loc) · 1.48 KB
/
HistoryUrl.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
namespace SharpChromium
{
public class HistoricUrl
{
string Url;
string Title;
int VisitCount;
HostCookies Cookies;
public HistoricUrl(DataRow row, HostCookies[] cookies)
{
Url = row["url"].ToString();
Title = row["title"].ToString();
int.TryParse(row["visit_count"].ToString(), out VisitCount);
Cookies = HostCookies.FilterHostCookies(cookies, Url);
}
private string SpaceGenerator(int numSpaces)
{
string result = "";
for (int i = 0; i < numSpaces; i++)
result += " ";
return result;
}
public void Print()
{
string user = Environment.GetEnvironmentVariable("USERNAME");
Console.WriteLine("--- Chromium History (User: {0}) ---", user);
int spaces = 15;
Console.WriteLine("{0}{1}: {2}", "URL", SpaceGenerator(spaces - 3), Url);
Console.WriteLine("{0}{1}: {2}", "Title", SpaceGenerator(spaces - 5), Title == "" ? "No Title" : Title);
Console.WriteLine("{0}{1}: {2}", "Visit Count", SpaceGenerator(spaces - 11), VisitCount);
Console.WriteLine("{0}{1}: {2}", "Cookies", SpaceGenerator(spaces - 7), Cookies == null ? "": Cookies.ToJSON());
Console.WriteLine();
}
}
}