public bool IsNewerThan(VersionInfo other) { if (A > other.A) return true; if (A < other.A) return false; if (B > other.B) return true; if (B < other.B) return false; if (C > other.C) return true; if (C < other.C) return false; if (D > other.D) return true; return false; }
// Expects "number.number.number.number" public static VersionInfo FromString(string str) { VersionInfo ret = new VersionInfo(); ret._str = str; String[] parts = str.Split(new char[] { '.' }); if (parts.Length != 4) throw new Exception("Expecting 4 dot-separated numbers in version string: " + str); try { ret.A = int.Parse(parts[0]); ret.B = int.Parse(parts[1]); ret.C = int.Parse(parts[2]); ret.D = int.Parse(parts[3]); } catch (Exception e) { throw new Exception(e.Message); } return ret; }