|
|
|
|
@ -38,20 +38,14 @@ namespace GBase.Api.Communication |
|
|
|
|
/// <param name="protocol">The <see cref="ServerProtocol"/></param> |
|
|
|
|
/// <returns>A protocol string for the <see cref="ServerProtocol"/></returns> |
|
|
|
|
/// <exception cref="ArgumentOutOfRangeException">Invalid protocol passed.</exception> |
|
|
|
|
public static string GetProtocolString(this ServerProtocol protocol) |
|
|
|
|
public static string GetProtocolString(this ServerProtocol protocol) => |
|
|
|
|
protocol switch |
|
|
|
|
{ |
|
|
|
|
switch (protocol) |
|
|
|
|
{ |
|
|
|
|
case ServerProtocol.Http: |
|
|
|
|
return @"http://"; |
|
|
|
|
case ServerProtocol.Https: |
|
|
|
|
return @"https://"; |
|
|
|
|
case ServerProtocol.Tcp: |
|
|
|
|
return @"net.tcp://"; |
|
|
|
|
default: |
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(protocol), protocol, "Invalid Protocol"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
ServerProtocol.Http => @"http://", |
|
|
|
|
ServerProtocol.Https => @"https://", |
|
|
|
|
ServerProtocol.Tcp => @"net.tcp://", |
|
|
|
|
_ => throw new ArgumentOutOfRangeException(nameof(protocol), protocol, "Invalid Protocol") |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Get the <see cref="ServerProtocol"/> for a given <see cref="string"/> |
|
|
|
|
|