mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-14 07:38:06 +03:00
Exceptions and expression body definition
Added exception throwing for FilterStringKeyValue, changed MaxLobbyKeyLength to internal and expression body definition
This commit is contained in:
parent
645e7bd91e
commit
fdc5b49587
@ -12,12 +12,10 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static class SteamMatchmaking
|
||||
{
|
||||
internal const int k_nMaxLobbyKeyLength = 255;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum number of characters a lobby metadata key can be
|
||||
/// </summary>
|
||||
public static int MaxLobbyKeyLength { get { return k_nMaxLobbyKeyLength; } }
|
||||
internal static int MaxLobbyKeyLength => 255;
|
||||
|
||||
|
||||
static ISteamMatchmaking _internal;
|
||||
|
@ -51,7 +51,10 @@ namespace Steamworks.Data
|
||||
/// </summary>
|
||||
public LobbyQuery FilterStringKeyValue( string nKey, string nValue )
|
||||
{
|
||||
if ( !string.IsNullOrEmpty(nKey) && nKey.Length <= SteamMatchmaking.MaxLobbyKeyLength )
|
||||
if ( string.IsNullOrEmpty( nKey ) )
|
||||
throw new System.ArgumentException( "Key string provided for LobbyQuery filter is null or empty", nameof( nKey ) );
|
||||
|
||||
if ( nKey.Length <= SteamMatchmaking.MaxLobbyKeyLength )
|
||||
{
|
||||
stringFilter = new MatchMakingKeyValuePair_t
|
||||
{
|
||||
@ -59,6 +62,8 @@ namespace Steamworks.Data
|
||||
Value = nValue
|
||||
};
|
||||
}
|
||||
else
|
||||
throw new System.ArgumentException( "Key length is longer than MaxLobbyKeyLength", nameof( nKey ) );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user