static long GetRegisteredBootTime (string path)
{
if (!File.Exists (path))
return -1;
string line = null;
try {
using (StreamReader reader = new StreamReader (path, Encoding.ASCII))
line = reader.ReadLine ();
} catch (Exception e) {
Console.Error.WriteLine ("While reading registry data at {0}: {1}", path, e);
}
if (line == null)
return -1;
long res;
if (!Int64.TryParse (line, out res))
return -1;
return res;
}