using System.Collections.Generic;
private static readonly IDictionary<ServerState, string> ServerStatesMapping = new Dictionary<ServerState, string>
{ServerState.ConnectedUpToDate, "Connected Up To Date"},
{ServerState.NotAuthenticated, "Not Authenticated"},
{ServerState.AccountDisabled, "Your account is disabled"}
private static ServerState ReadServerState(string uri)
var serverStateString = uri;
foreach (var kvp in ServerStatesMapping)
var state = ServerStatesMapping[kvp.Key];
if (serverStateString.Contains(state))
throw new NotSupportedException($"State {serverStateString} is not supported");
public static void Main()
var serverState = ReadServerState("Not Authenticated");
Console.WriteLine(serverState.ToString());