static int Main(string [] args)
{
if (args.Length != 1)
return 1;
string base_path = args [0];
if (!Directory.Exists (base_path)) {
Console.Error.WriteLine ("Directory {0} not found.", base_path);
return 2;
}
DataAccess da = GetDataAccess ();
da.BeginTransaction ();
try {
int version_id = LoadVersion (da, base_path);
LoadTodo (da, version_id, base_path);
LoadMissing (da, version_id, base_path);
LoadException (da, version_id, base_path);
if (da.InTransaction) // Should always be true
da.Commit ();
Console.WriteLine ("Done. Version ID: {0}", version_id);
} catch (Exception exc) {
if (da.InTransaction)
da.Rollback ();
Console.WriteLine (exc);
}
return 0;
}