2020-08-16 11:03:10 +02:00
|
|
|
|
namespace Giants.DataContract.V1
|
2020-08-09 11:10:33 +02:00
|
|
|
|
{
|
|
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
2020-08-11 10:29:45 +02:00
|
|
|
|
public class AppVersion
|
2020-08-09 11:10:33 +02:00
|
|
|
|
{
|
|
|
|
|
[Required]
|
|
|
|
|
public int Build { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public int Major { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public int Minor { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public int Revision { get; set; }
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object obj)
|
|
|
|
|
{
|
2020-08-11 10:29:45 +02:00
|
|
|
|
return obj is AppVersion info &&
|
2020-09-06 01:47:00 +02:00
|
|
|
|
this.Build == info.Build &&
|
|
|
|
|
this.Major == info.Major &&
|
|
|
|
|
this.Minor == info.Minor &&
|
|
|
|
|
this.Revision == info.Revision;
|
2020-08-09 11:10:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
2020-09-06 01:47:00 +02:00
|
|
|
|
return HashCode.Combine(this.Build, this.Major, this.Minor, this.Revision);
|
2020-08-09 11:10:33 +02:00
|
|
|
|
}
|
2020-08-10 09:22:33 +02:00
|
|
|
|
|
|
|
|
|
public Version ToVersion()
|
|
|
|
|
{
|
|
|
|
|
return new Version(this.Major, this.Minor, this.Build, this.Revision);
|
|
|
|
|
}
|
2022-09-05 22:42:41 +02:00
|
|
|
|
|
|
|
|
|
public static bool operator<(AppVersion a, AppVersion b)
|
|
|
|
|
{
|
|
|
|
|
return a.ToVersion() < b.ToVersion();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool operator>(AppVersion a, AppVersion b)
|
|
|
|
|
{
|
|
|
|
|
return a.ToVersion() > b.ToVersion();
|
|
|
|
|
}
|
2020-08-09 11:10:33 +02:00
|
|
|
|
}
|
|
|
|
|
}
|