/// <summary> /// Utility function for parsing a JSON file into a list of Server Information Objects /// </summary> /// <param name="filename">The path of the JSON input file</param> /// <returns>List of Server Information Objects</returns> public static ServerInfoObject ParseJsonFile(string filename) { using StreamReader sr = new StreamReader(filename); string serverInfoJson = sr.ReadToEnd(); ServerInfoObject serverInfoObjects = JsonSerializer.Deserialize <ServerInfoObject>(serverInfoJson); Console.WriteLine(serverInfoObjects); return(serverInfoObjects); }
/// <summary> /// Utility method for constructing the Server URL /// </summary> /// <param name="serverInfo">Object containing server information</param> /// <returns>String representing the server URL</returns> public static string GetServerUrl(ServerInfoObject serverInfo) { return($"{serverInfo.Protocol}://{serverInfo.Host}:{serverInfo.Port}/"); }