예제 #1
0
 /// <summary>
 /// Initializes a new <seealso cref="MediaWikiVersion"/> instance with major, minor, revision versions and
 /// dev-version.
 /// </summary>
 /// <param name="major">Major version. Should be between 0 and 32767.</param>
 /// <param name="minor">Minor version. Should be between 0 and 32767.</param>
 /// <param name="revision">Revision number. Should be between 0 and 32767.</param>
 /// <param name="devChannel">Channel of development.</param>
 /// <param name="devVersion">DevVersion. Should be between 0 and 4095.</param>
 /// <exception cref="ArgumentOutOfRangeException">Any one of the version numbers is out of range.</exception>
 /// <exception cref="ArgumentException">
 /// <paramref name="devChannel"/> is <see cref="MediaWikiDevChannel.None"/>,
 /// but <paramref name="devVersion"/> is non-zero.
 /// </exception>
 public MediaWikiVersion(int major, int minor, int revision, MediaWikiDevChannel devChannel, int devVersion)
 {
     if (major < 0 || major > short.MaxValue)
     {
         throw new ArgumentOutOfRangeException(nameof(major));
     }
     if (minor < 0 || minor > short.MaxValue)
     {
         throw new ArgumentOutOfRangeException(nameof(minor));
     }
     if (revision < 0 || revision > short.MaxValue)
     {
         throw new ArgumentOutOfRangeException(nameof(revision));
     }
     if (devChannel < MediaWikiDevChannel.None || devChannel > MediaWikiDevChannel.RC)
     {
         throw new ArgumentOutOfRangeException(nameof(devChannel));
     }
     if (devVersion < 0 || devVersion > 0x0FFF)
     {
         throw new ArgumentOutOfRangeException(nameof(devVersion));
     }
     _Major    = (short)major;
     _Minor    = (short)minor;
     _Revision = (short)revision;
     if (devChannel == MediaWikiDevChannel.None)
     {
         if (devVersion != 0)
         {
             throw new ArgumentException(Prompts.ExceptionDevVersionRequiresDevChannel, nameof(devVersion));
         }
         fullDevVersion = 0;
     }
     else
     {
         fullDevVersion = (short)(((int)devChannel << 12) | devVersion);
     }
 }
예제 #2
0
 private MediaWikiVersion(short major, short minor, short revision, MediaWikiDevChannel devChannel, int devVersion)
 {
     if (major < 0)
     {
         throw new ArgumentOutOfRangeException(nameof(major));
     }
     if (minor < 0)
     {
         throw new ArgumentOutOfRangeException(nameof(minor));
     }
     if (revision < 0)
     {
         throw new ArgumentOutOfRangeException(nameof(revision));
     }
     if (devVersion < 0 || devVersion > 0x0FFF)
     {
         throw new ArgumentOutOfRangeException(nameof(devVersion));
     }
     _Major         = major;
     _Minor         = minor;
     _Revision      = revision;
     fullDevVersion = (short)(((int)devChannel << 12) | devVersion);
 }
예제 #3
0
 /// <summary>
 /// Initializes a new <seealso cref="MediaWikiVersion"/> instance with major, minor versions and
 /// dev-version.
 /// </summary>
 /// <inheritdoc cref="MediaWikiVersion(int,int,int,MediaWikiDevChannel,int)"/>
 public MediaWikiVersion(int major, int minor, MediaWikiDevChannel devChannel, int devVersion)
     : this(major, minor, 0, devChannel, devVersion)
 {
 }
예제 #4
0
 /// <summary>
 /// Initializes a new <seealso cref="MediaWikiVersion"/> instance with major, minor, revision versions and
 /// dev-channel.
 /// </summary>
 /// <inheritdoc cref="MediaWikiVersion(int,int,int,MediaWikiDevChannel,int)"/>
 public MediaWikiVersion(int major, int minor, int revision, MediaWikiDevChannel devChannel)
     : this(major, minor, revision, devChannel, 0)
 {
 }