1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-11-24 15:15:37 +01:00
GiantsTools/Giants.Services/Core/Entities/ServerInfo.cs

36 lines
1.0 KiB
C#
Raw Normal View History

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