2020-08-08 08:53:35 +02:00
|
|
|
|
namespace Giants.Services
|
|
|
|
|
{
|
|
|
|
|
using System;
|
|
|
|
|
|
2020-08-16 11:03:10 +02:00
|
|
|
|
public class ServerInfo : DataContract.V1.ServerInfo, IIdentifiable
|
2020-08-08 08:53:35 +02:00
|
|
|
|
{
|
2020-11-15 03:49:29 +01:00
|
|
|
|
public string id => $"{this.HostIpAddress}-{this.GameName}-{this.Port}";
|
2020-08-10 09:22:33 +02:00
|
|
|
|
|
|
|
|
|
public string DocumentType => nameof(ServerInfo);
|
2020-08-09 01:31:16 +02:00
|
|
|
|
|
2020-08-08 08:53:35 +02:00
|
|
|
|
public string HostIpAddress { get; set; }
|
|
|
|
|
|
|
|
|
|
public DateTime LastHeartbeat { get; set; }
|
2020-08-09 01:31:16 +02:00
|
|
|
|
|
2020-08-09 11:10:33 +02:00
|
|
|
|
public override bool Equals(object obj)
|
|
|
|
|
{
|
|
|
|
|
return obj is ServerInfo info &&
|
|
|
|
|
base.Equals(obj) &&
|
2020-08-10 09:22:33 +02:00
|
|
|
|
this.HostIpAddress == info.HostIpAddress &&
|
2020-11-15 03:49:29 +01:00
|
|
|
|
this.Port == info.Port &&
|
|
|
|
|
this.GameName == info.GameName &&
|
2020-08-10 09:22:33 +02:00
|
|
|
|
this.DocumentType == info.DocumentType;
|
2020-08-09 11:10:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
|
|
|
|
HashCode hash = new HashCode();
|
|
|
|
|
hash.Add(base.GetHashCode());
|
2020-08-10 09:22:33 +02:00
|
|
|
|
hash.Add(this.id);
|
|
|
|
|
hash.Add(this.HostIpAddress);
|
|
|
|
|
hash.Add(this.DocumentType);
|
2020-08-09 11:10:33 +02:00
|
|
|
|
return hash.ToHashCode();
|
|
|
|
|
}
|
2020-08-08 08:53:35 +02:00
|
|
|
|
}
|
|
|
|
|
}
|