Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new feature info object with the specified impact and description
 /// </summary>
 /// <param name="impact">The impact of the feature</param>
 /// <param name="description">The description of the feature</param>
 public FeatureInfo(FeatureImpact impact, string description)
 {
     _impact      = impact;
     _description = description;
 }
Ejemplo n.º 2
0
        private static List <VersionUpdateInfo> ParseChanges(Stream s)
        {
            Regex versionRx = new Regex(@"^\[((\d+)\.(\d+)\.(\d+)\.(\d+))\]");
            Regex propRx    = new Regex(@"^((\w+)(\((\w+)\))?)\s*\=\s*(.*)$");
            Regex dateRx    = new Regex(@"(\d\d\d\d)\-(\d\d)\-(\d\d)");

            List <VersionUpdateInfo> res = new List <VersionUpdateInfo>();

            using (StreamReader reader = new StreamReader(s))
            {
                VersionUpdateInfo vinfo = null;
                while (!reader.EndOfStream)
                {
                    string line = reader.ReadLine();
                    Match  m    = versionRx.Match(line);
                    if (m.Success)
                    {
                        if (vinfo != null)
                        {
                            res.Add(vinfo);
                        }

                        vinfo         = new VersionUpdateInfo();
                        vinfo.Version = m.Groups[1].Value;
                    }
                    else
                    {
                        m = propRx.Match(line);
                        if (m.Success)
                        {
                            string pname = m.Groups[2].Value.ToLower();
                            if (pname == "bug")
                            {
                                if (m.Groups[4].Success)
                                {
                                    string      sev      = m.Groups[4].Value.ToLower();
                                    BugSeverity severity = BugSeverity.None;
                                    if (sev == "minor")
                                    {
                                        severity = BugSeverity.Minor;
                                    }
                                    else if (sev == "major")
                                    {
                                        severity = BugSeverity.Major;
                                    }
                                    else if (sev == "critical")
                                    {
                                        severity = BugSeverity.Critical;
                                    }
                                    if (severity != BugSeverity.None)
                                    {
                                        BugFixInfo bug = new BugFixInfo(severity, m.Groups[5].Value);
                                        vinfo.FixedBugs.Add(bug);
                                    }
                                } // if
                            }
                            else if (pname == "feature")
                            {
                                if (m.Groups[4].Success)
                                {
                                    string        imp    = m.Groups[4].Value.ToLower();
                                    FeatureImpact impact = FeatureImpact.None;
                                    if (imp == "minor")
                                    {
                                        impact = FeatureImpact.Minor;
                                    }
                                    else if (imp == "major")
                                    {
                                        impact = FeatureImpact.Major;
                                    }
                                    if (impact != FeatureImpact.None)
                                    {
                                        FeatureInfo feature = new FeatureInfo(impact, m.Groups[5].Value);
                                        vinfo.AddedFeatures.Add(feature);
                                    }
                                } // if
                            }
                            else if (pname == "release")
                            {
                                string datestr = m.Groups[5].Value;
                                m = dateRx.Match(datestr);
                                if (m.Success)
                                {
                                    int year  = int.Parse(m.Groups[1].Value);
                                    int month = int.Parse(m.Groups[2].Value);
                                    int day   = int.Parse(m.Groups[3].Value);
                                    vinfo.ReleaseDate = new DateTime(year, month, day);
                                }
                            }
                        }
                    } // else
                }     // while
                if (vinfo != null)
                {
                    res.Add(vinfo);
                }
            } // using

            if (res.Count == 0)
            {
                return(null);
            }
            else
            {
                return(res);
            }
        }