コード例 #1
0
 public Version(int major, int minor, int release, string type)
 {
     this.major   = major;
     this.minor   = minor;
     this.release = release;
     this.type    = type;
     this.crc     = new VersionCrc(string.Format("{0}.{1}.{2}{3}", this.major, this.minor, this.release, this.type));
 }
コード例 #2
0
        public Version(string value)
        {
            var pattern = @"^(\d+?)\.(\d+?)\.(\d+?)([a-z]*)$";
            var matches = Regex.Match(value.Trim(), pattern, RegexOptions.IgnoreCase);
            var groups  = matches.Groups;

            if (groups.Count == 5)
            {
                this.major   = int.Parse(groups[1].Value);
                this.minor   = int.Parse(groups[2].Value);
                this.release = int.Parse(groups[3].Value);
                this.type    = groups[4].Value;
            }
            else
            {
                this.major   = 0;
                this.minor   = 0;
                this.release = 0;
                this.type    = string.Empty;
            }

            this.crc = new VersionCrc(string.Format("{0}.{1}.{2}{3}", this.major, this.minor, this.release, this.type));
        }