17 using erminas.SmartAPI.Exceptions;
18 using erminas.SmartAPI.Utils;
20 namespace erminas.SmartAPI.CMS
26 Version =
new Version(major, minor, build, rev);
29 public abstract void Validate(
ServerLogin login, Version actualVersion,
string method);
31 public Version Version {
get;
set; }
33 public string VersionName {
get;
set; }
36 [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, AllowMultiple =
false, Inherited =
false)]
40 : base(major, minor, build, rev)
44 public override void Validate(
ServerLogin login, Version actualVersion,
string method)
46 if (actualVersion < Version)
48 string versionNameString =
string.IsNullOrEmpty(VersionName) ?
"" :
" (" + VersionName +
")";
51 "Invalid server version. {0} only works on servers with version greater than or equal {1}{3}, but the current server version is {2}",
52 method, Version, actualVersion, versionNameString));
57 [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, AllowMultiple =
false, Inherited =
false)]
60 public VersionIsLessThan(
int major,
int minor = 0,
int build = 0,
int rev = 0) : base(major, minor, build, rev)
64 public override void Validate(
ServerLogin login, Version actualVersion,
string method)
66 if (actualVersion >= Version)
68 string versionNameString =
string.IsNullOrEmpty(VersionName) ?
"" :
" (" + VersionName +
")";
71 "Invalid server version. {0} only works on servers with version less than {1}{3}, but the current server version is {2}",
72 method, Version, actualVersion, versionNameString));