2020-08-16 11:03:10 +02:00
|
|
|
|
namespace Giants.DataContract.V1
|
2020-08-08 08:53:35 +02:00
|
|
|
|
{
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2020-08-09 11:10:33 +02:00
|
|
|
|
using System.Linq;
|
2020-08-08 08:53:35 +02:00
|
|
|
|
|
|
|
|
|
public class ServerInfo
|
|
|
|
|
{
|
|
|
|
|
[Required]
|
|
|
|
|
[StringLength(100)]
|
|
|
|
|
public string GameName { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
2020-08-11 10:29:45 +02:00
|
|
|
|
public AppVersion Version { get; set; }
|
2020-08-08 08:53:35 +02:00
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
[StringLength(100)]
|
2020-08-09 11:10:33 +02:00
|
|
|
|
public string SessionName { get; set; }
|
2020-08-08 08:53:35 +02:00
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public int Port { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
[StringLength(300)]
|
|
|
|
|
public string MapName { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
[StringLength(100)]
|
|
|
|
|
public string GameType { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public int NumPlayers { get; set; }
|
|
|
|
|
|
2020-09-23 23:44:31 +02:00
|
|
|
|
[Required]
|
|
|
|
|
public int MaxPlayers { get; set; }
|
|
|
|
|
|
2020-08-08 08:53:35 +02:00
|
|
|
|
[Required]
|
|
|
|
|
[StringLength(100)]
|
|
|
|
|
public string GameState { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public int TimeLimit { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public int FragLimit { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public int TeamFragLimit { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public bool FirstBaseComplete { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public IList<PlayerInfo> PlayerInfo { get; set; }
|
2020-08-09 11:10:33 +02:00
|
|
|
|
|
|
|
|
|
public override bool Equals(object obj)
|
|
|
|
|
{
|
|
|
|
|
return obj is ServerInfo info &&
|
2020-09-06 01:47:00 +02:00
|
|
|
|
this.GameName == info.GameName &&
|
|
|
|
|
EqualityComparer<AppVersion>.Default.Equals(this.Version, info.Version) &&
|
|
|
|
|
this.SessionName == info.SessionName &&
|
|
|
|
|
this.Port == info.Port &&
|
|
|
|
|
this.MapName == info.MapName &&
|
|
|
|
|
this.GameType == info.GameType &&
|
|
|
|
|
this.NumPlayers == info.NumPlayers &&
|
2020-09-23 23:44:31 +02:00
|
|
|
|
this.MaxPlayers == info.MaxPlayers &&
|
2020-09-06 01:47:00 +02:00
|
|
|
|
this.GameState == info.GameState &&
|
|
|
|
|
this.TimeLimit == info.TimeLimit &&
|
|
|
|
|
this.FragLimit == info.FragLimit &&
|
|
|
|
|
this.TeamFragLimit == info.TeamFragLimit &&
|
|
|
|
|
this.FirstBaseComplete == info.FirstBaseComplete &&
|
|
|
|
|
this.PlayerInfo.SequenceEqual(info.PlayerInfo);
|
2020-08-09 11:10:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
|
|
|
|
HashCode hash = new HashCode();
|
2020-09-06 01:47:00 +02:00
|
|
|
|
hash.Add(this.GameName);
|
|
|
|
|
hash.Add(this.Version);
|
|
|
|
|
hash.Add(this.SessionName);
|
|
|
|
|
hash.Add(this.Port);
|
|
|
|
|
hash.Add(this.MapName);
|
|
|
|
|
hash.Add(this.GameType);
|
|
|
|
|
hash.Add(this.NumPlayers);
|
2020-09-23 23:44:31 +02:00
|
|
|
|
hash.Add(this.MaxPlayers);
|
2020-09-06 01:47:00 +02:00
|
|
|
|
hash.Add(this.GameState);
|
|
|
|
|
hash.Add(this.TimeLimit);
|
|
|
|
|
hash.Add(this.FragLimit);
|
|
|
|
|
hash.Add(this.TeamFragLimit);
|
|
|
|
|
hash.Add(this.FirstBaseComplete);
|
|
|
|
|
hash.Add(this.PlayerInfo);
|
2020-08-09 11:10:33 +02:00
|
|
|
|
return hash.ToHashCode();
|
|
|
|
|
}
|
2020-08-08 08:53:35 +02:00
|
|
|
|
}
|
|
|
|
|
}
|