private void SetFromMatchGroups(GroupCollection groups) { var major = groups[MajorName]; var minor = groups[MinorName]; var patch = groups[PatchName]; var release = groups[ReleaseSymbolName]; var edition = groups[ReleaseEditionName]; Major = Convert.ToInt32(major.Value); Minor = Convert.ToInt32(minor.Value); Patch = patch.Success ? Convert.ToInt32(patch.Value) : 0; if (release.Success) { ReleaseSymbol = ConvertToReleaseSymbol(release.Value); if (edition.Success) { Edition = Convert.ToInt32(edition.Value); } } }
private static string GetReleaseConfiguration(ReleaseSymbol releaseSymbol, bool shorten = false) { var type = typeof(ReleaseSymbol); var attr = type .GetField(Enum.GetName(type, releaseSymbol)) .GetCustomAttribute<System.ComponentModel.DataAnnotations.DisplayAttribute>(); return shorten ? attr.ShortName : attr.Name; }