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; }
|
|
|
|
|
|
|
|
|
|
[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 &&
|
|
|
|
|
GameName == info.GameName &&
|
2020-08-11 10:29:45 +02:00
|
|
|
|
EqualityComparer<AppVersion>.Default.Equals(Version, info.Version) &&
|
2020-08-09 11:10:33 +02:00
|
|
|
|
SessionName == info.SessionName &&
|
|
|
|
|
Port == info.Port &&
|
|
|
|
|
MapName == info.MapName &&
|
|
|
|
|
GameType == info.GameType &&
|
|
|
|
|
NumPlayers == info.NumPlayers &&
|
|
|
|
|
GameState == info.GameState &&
|
|
|
|
|
TimeLimit == info.TimeLimit &&
|
|
|
|
|
FragLimit == info.FragLimit &&
|
|
|
|
|
TeamFragLimit == info.TeamFragLimit &&
|
|
|
|
|
FirstBaseComplete == info.FirstBaseComplete &&
|
|
|
|
|
PlayerInfo.SequenceEqual(info.PlayerInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
|
|
|
|
HashCode hash = new HashCode();
|
|
|
|
|
hash.Add(GameName);
|
|
|
|
|
hash.Add(Version);
|
|
|
|
|
hash.Add(SessionName);
|
|
|
|
|
hash.Add(Port);
|
|
|
|
|
hash.Add(MapName);
|
|
|
|
|
hash.Add(GameType);
|
|
|
|
|
hash.Add(NumPlayers);
|
|
|
|
|
hash.Add(GameState);
|
|
|
|
|
hash.Add(TimeLimit);
|
|
|
|
|
hash.Add(FragLimit);
|
|
|
|
|
hash.Add(TeamFragLimit);
|
|
|
|
|
hash.Add(FirstBaseComplete);
|
|
|
|
|
hash.Add(PlayerInfo);
|
|
|
|
|
return hash.ToHashCode();
|
|
|
|
|
}
|
2020-08-08 08:53:35 +02:00
|
|
|
|
}
|
|
|
|
|
}
|