public bool LoadHistory(string path)
{
// check if the file exists
if(File.Exists(path) == false) {
Debug.ReportWarning("History file not found. Path: {0}", path);
return false;
}
try {
// create the store
FileStore.FileStore store = new FileStore.FileStore();
store.Encrypt = true;
store.UseDPAPI = true;
// load store
if(store.Load(path) == false) {
Debug.ReportError("Error while loading store from path {0}", path);
return false;
}
// deserialize
_categories = DeserializeHistory(store.ReadFile("history.dat"));
if(_categories == null) {
// load failed, allocate history categories
_categories = new Dictionary<Guid, HistoryCategory>();
return false;
}
return true;
}
catch(Exception e) {
Debug.ReportError("Error while loading task history. Exception: {0}", e.Message);
return false;
}
}