Example #1
0
        public int CompareTo(object obj)
        {
            if (obj is not VersionString other)
            {
                if (obj is not string otherStr)
                {
                    return(1);
                }
                other = new VersionString(otherStr);
            }

            if (RawVersion.Equals(other.RawVersion))
            {
                return(0);
            }

            return(IsGreaterThan(other) ? 1 : -1);
        }
Example #2
0
        private bool IsGreaterThan(VersionString other)
        {
            if (VersionDate != other.VersionDate)
            {
                return(VersionDate > other.VersionDate);
            }

            if (IsGa)
            {
                return(!other.IsGa);
            }

            if (other.IsGa)
            {
                return(false);
            }

            return(PreviewString.CompareTo(other.PreviewString) > 0);
        }