/// <summary> /// Compare this version number with that of another version number. /// </summary> /// <param name="obj"> /// A <see cref="MigratorVersionStep"/> or <see cref="PackageVersion"/> cast as an /// object to be compared against. /// </param> /// <returns> /// 0 if the two version are the same; -1 if this version is less than the passed /// version and 1 if this version is greater than the passed verison. /// </returns> public new int CompareTo(object obj) { if (typeof(MigratorVersionStep).IsInstanceOfType(obj)) { MigratorVersionStep other = (MigratorVersionStep)obj; int result = base.CompareTo(obj); if (result != 0) { return(result); } return(this.Step.CompareTo(other.Step)); } else { int result = base.CompareTo(obj); if (result != 0) { return(result); } // // If the step is greater than 0 and the other object is a base version // number (without steps) then this object is greater than the other // object. // if (this.Step > 0) { return(1); } return(0); } }
/// <summary> /// Initialize a new MigratorVersionAttribute object with the specified version /// numbering. /// </summary> /// <param name="major"> /// A <see cref="Int32"/> value that specifies the major version number. /// </param> /// <param name="minor"> /// A <see cref="Int32"/> value that specifies the minor version number. /// </param> /// <param name="revision"> /// A <see cref="Int32"/> value that specifies the revision number. /// </param> /// <param name="step"> /// A <see cref="Int32"/> value that specifies which step in the upgrade/downgrade /// sequence. /// </param> public MigratorVersionAttribute(Int32 major, Int32 minor, Int32 revision, Int32 step) : base() { Version = new MigratorVersionStep(major, minor, revision, step); }