Exemplo n.º 1
0
        public override IEnumerable <Issue> GetIssues()
        {
            XmlNodeList issues = doc.SelectNodes("/report/assemblies/assembly/issue");

            foreach (XmlNode node in issues)
            {
                string    type_str   = node.Attributes ["type"].Value;
                IssueType issue_type = GetIssueTypeFromString(type_str);
                Issue     issue;
                if (issue_type == IssueType.PInvoke)
                {
                    XmlNode function = node.SelectSingleNode("method");
                    XmlNode library  = node.SelectSingleNode("data");
                    string  lib      = library.InnerText;
                    if (!String.IsNullOrEmpty(lib))
                    {
                        lib = lib.ToLowerInvariant();
                    }
                    string func = function.InnerText;
                    if (!String.IsNullOrEmpty(func))
                    {
                        func = func.ToLowerInvariant();
                    }

                    issue = new PInvokeIssue(lib, func);
                }
                else
                {
                    XmlNode name = node.SelectSingleNode("raw");
                    issue = new MemberIssue(issue_type, name.InnerText, null);
                }

                yield return(issue);
            }
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
0
        public override IEnumerable<Issue> GetIssues()
        {
            XmlNodeList issues = doc.SelectNodes ("/report/assemblies/assembly/issue");
            foreach (XmlNode node in issues) {
                string type_str = node.Attributes ["type"].Value;
                IssueType issue_type = GetIssueTypeFromString (type_str);
                Issue issue;
                if (issue_type == IssueType.PInvoke) {
                    XmlNode function = node.SelectSingleNode ("method");
                    XmlNode library = node.SelectSingleNode ("data");
                    string lib = library.InnerText;
                    if (!String.IsNullOrEmpty (lib))
                        lib = lib.ToLowerInvariant ();
                    string func = function.InnerText;
                    if (!String.IsNullOrEmpty (func))
                        func = func.ToLowerInvariant ();

                    issue = new PInvokeIssue (lib, func);
                } else  {
                    XmlNode name = node.SelectSingleNode ("raw");
                    issue = new MemberIssue (issue_type, name.InnerText, null);
                }

                yield return issue;
            }
        }