public static bool TryParse(string range, out IVersionSpecification specification)
        {
            bool startInclusive = false;
            bool endInclusive   = false;

            if (range.StartsWith("["))
            {
                startInclusive = true;
            }
            else if (!range.StartsWith("("))
            {
                specification = null;
                return(false);
            }

            if (range.EndsWith("]"))
            {
                endInclusive = true;
            }
            else if (!range.EndsWith(")"))
            {
                specification = null;
                return(false);
            }

            string[] parts = range.Split('-');
            if (parts.Length != 2)
            {
                specification = null;
                return(false);
            }

            string startVersion = parts[0].Substring(1);
            string endVersion   = parts[1].Substring(0, parts[1].Length - 1);

            if (IsWildcardVersion(startVersion) && IsWildcardVersion(endVersion))
            {
                specification = null;
                return(false);
            }
            else if (!IsWildcardVersion(startVersion) && !VersionStringHelpers.IsVersionWellFormed(startVersion))
            {
                specification = null;
                return(false);
            }
            else if (!IsWildcardVersion(endVersion) && !VersionStringHelpers.IsVersionWellFormed(endVersion))
            {
                specification = null;
                return(false);
            }

            specification = new RangeVersionSpecification(startVersion, endVersion, startInclusive, endInclusive);
            return(true);
        }
 public static bool TryParseVersionSpecification(string versionString, out IVersionSpecification specification)
 {
     if (string.IsNullOrEmpty(versionString))
     {
         specification = null;
         return(false);
     }
     else if (versionString.Contains("-"))
     {
         return(RangeVersionSpecification.TryParse(versionString, out specification));
     }
     else
     {
         return(ExactVersionSpecification.TryParse(versionString, out specification));
     }
 }