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); }
static void LoadReport(string filename) { DateTime webparts_date = new DateTime(2008, 1, 1); Loader loader = null; try { loader = new XmlFileLoader(filename); } catch { } if (loader == null) { loader = new TextFileLoader(filename); } DataAccess da = GetDataAccess(); da.BeginTransaction(); try { bool have_wpf; int report_id; using (loader) { have_wpf = false; report_id = da.InsertReportMaster(loader.ReportDate, loader.IPAddress.ToString(), loader.Definitions, loader.UserName, loader.Email, loader.Organization, loader.HomePage, loader.Comments, loader.Guid); foreach (Issue issue in loader.GetIssues()) { if (issue.IssueType == IssueType.PInvoke) { PInvokeIssue p = (PInvokeIssue)issue; da.InsertOrUpdatePInvoke(report_id, p.Library, p.Function); } else { MemberIssue m = (MemberIssue)issue; bool is_missing, is_todo, is_niex; GetAsBooleans(m.IssueType, out is_missing, out is_todo, out is_niex); // Ignore most of the WPF types if (!IsWpf(m.Name)) { // Ignore reports submitted prior to 2008-01-01 that are using WebParts. if (loader.ReportDate < webparts_date && m.Name.IndexOf(" System.Web.UI.WebControls.WebParts") != -1) { Console.WriteLine("Ignoring report {0} (uses WebParts and older than 2008-01-01)", loader.Guid); da.Rollback(); return; } da.InsertOrUpdateMember(report_id, m.Name, is_missing, is_todo, is_niex, m.Comment); } else { have_wpf = true; } } } } da.InitReportCounts(report_id); if (have_wpf) { da.SetWpf(report_id); } da.Commit(); } catch (Exception) { if (da.InTransaction) { da.Rollback(); } throw; //Console.WriteLine (exc); //Environment.Exit (1); } }