(61d00a474) v0.9.7.1
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
partial class BannedPlayer
|
||||
{
|
||||
public string Name;
|
||||
public string IP; public bool IsRangeBan;
|
||||
public UInt64 SteamID;
|
||||
public string Reason;
|
||||
public DateTime? ExpirationTime;
|
||||
public UInt16 UniqueIdentifier;
|
||||
}
|
||||
|
||||
partial class BanList
|
||||
{
|
||||
private readonly List<BannedPlayer> bannedPlayers;
|
||||
public IEnumerable<string> BannedNames
|
||||
{
|
||||
get { return bannedPlayers.Select(bp => bp.Name); }
|
||||
}
|
||||
|
||||
public IEnumerable<string> BannedIPs
|
||||
{
|
||||
get { return bannedPlayers.Select(bp => bp.IP); }
|
||||
}
|
||||
|
||||
partial void InitProjectSpecific();
|
||||
|
||||
|
||||
public BanList()
|
||||
{
|
||||
bannedPlayers = new List<BannedPlayer>();
|
||||
InitProjectSpecific();
|
||||
}
|
||||
|
||||
public static string ToRange(string ip)
|
||||
{
|
||||
for (int i = ip.Length - 1; i > 0; i--)
|
||||
{
|
||||
if (ip[i] == '.')
|
||||
{
|
||||
ip = ip.Substring(0, i) + ".x";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user