public static bool TryParse(string rawstring, out PSO2Version result) { string[] spplitted = null; if (rawstring.IndexOf(underline[0]) > -1) { spplitted = rawstring.Split(underline, StringSplitOptions.RemoveEmptyEntries); } if (spplitted != null && spplitted.Length == 3) { if (spplitted.Length == 3) { result = new PSO2Version(rawstring, spplitted[0], spplitted[2]); return(true); } else if (spplitted.Length == 4) { result = new PSO2Version(rawstring, spplitted[0], spplitted[2], spplitted[3]); return(true); } else { result = null; return(false); } } else { result = null; return(false); } }
public bool IsEqual(PSO2Version version) { if (this.MajorVersion == version.MajorVersion && this.ReleaseCandidateVersion == version.ReleaseCandidateVersion) { return(true); } else { return(false); } }
/// <summary> /// Compare two version. 0 if equal, 1 if this version is higher than compared version, -1 if this version is lower than compared version. /// </summary> /// <param name="pso2ver">PSO2Version. The version to be compared.</param> /// <returns>int. 0 if equal, 1 if this version is higher than compared version, -1 if this version is lower than compared version.</returns> public int CompareTo(PSO2Version pso2ver) { if (this.MajorVersion < pso2ver.MajorVersion) { return(-1); } else if (this.MajorVersion > pso2ver.MajorVersion) { return(1); } else { if (this.ReleaseCandidateVersion < pso2ver.ReleaseCandidateVersion) { return(-1); } else if (this.ReleaseCandidateVersion > pso2ver.ReleaseCandidateVersion) { return(1); } else { if (this.BuildVersion < pso2ver.BuildVersion) { return(-1); } else if (this.BuildVersion > pso2ver.BuildVersion) { return(1); } else { return(0); } } } }