private static string defaultString(string key, string defaultValue = "") { if (SteamDSConfig.UseServerConfigFile) { string serverData = SteamDSConfig.GetServerData(key); return (!(serverData != string.Empty)) ? defaultValue : serverData; } return defaultValue; }
private static bool defaultBool(string key, bool defaultValue) { if (SteamDSConfig.UseServerConfigFile) { string serverData = SteamDSConfig.GetServerData(key); if (serverData != string.Empty) { return serverData.ToLower() == "on" || serverData.ToLower() == "true"; } } return defaultValue; }
private static int defaultInt(string key, int defaultValue) { if (SteamDSConfig.UseServerConfigFile) { string serverData = SteamDSConfig.GetServerData(key); int result = defaultValue; if (serverData != string.Empty && int.TryParse(serverData, out result)) { return result; } } return defaultValue; }
private static ushort defaultShort(string key, ushort defaultValue) { if (SteamDSConfig.UseServerConfigFile) { string serverData = SteamDSConfig.GetServerData(key); ushort result = defaultValue; if (serverData != string.Empty && ushort.TryParse(serverData, out result)) { return(result); } } return(defaultValue); }