public static List <MyObjectBuilder_Checkpoint.ModItem> GetLobbyMods(IMyLobby lobby) { int lobbyModCount = GetLobbyModCount(lobby); List <MyObjectBuilder_Checkpoint.ModItem> list = new List <MyObjectBuilder_Checkpoint.ModItem>(lobbyModCount); for (int i = 0; i < lobbyModCount; i++) { string data = lobby.GetData("mod" + i); int index = data.IndexOf("_"); if (index == -1) { MySandboxGame.Log.WriteLineAndConsole($"Failed to parse mod details from LobbyData. '{data}'"); } else { ulong num4; ulong.TryParse(data.Substring(0, index), out num4); string name = data.Substring(index + 1); list.Add(new MyObjectBuilder_Checkpoint.ModItem(name, num4, name)); } } return(list); }
public static ulong GetLobbyWorldSize(IMyLobby lobby) { string data = lobby.GetData("worldSize"); return(string.IsNullOrEmpty(data) ? 0UL : Convert.ToUInt64(data)); }
public static string GetLobbyWorldName(IMyLobby lobby) => lobby.GetData("world");
public static ulong GetLobbyULong(string key, IMyLobby lobby, ulong defValue) { ulong num; return(!ulong.TryParse(lobby.GetData(key), out num) ? defValue : num); }
public static string GetLobbyScenarioBriefing(IMyLobby lobby) => lobby.GetData("scenarioBriefing");
public static int GetLobbyInt(string key, IMyLobby lobby, int defValue) { int num; return(!int.TryParse(lobby.GetData(key), NumberStyles.Integer, CultureInfo.InvariantCulture, out num) ? defValue : num); }
public static MyGameModeEnum GetLobbyGameMode(IMyLobby lobby) { int num; return(!int.TryParse(lobby.GetData("gameMode"), out num) ? MyGameModeEnum.Creative : ((MyGameModeEnum)num)); }
public static string GetLobbyHostName(IMyLobby lobby) => lobby.GetData("host");
public static float GetLobbyFloat(string key, IMyLobby lobby, float defValue) { float num; return(!float.TryParse(lobby.GetData(key), NumberStyles.Float, CultureInfo.InvariantCulture, out num) ? defValue : num); }
public static DateTime GetLobbyDateTime(string key, IMyLobby lobby, DateTime defValue) { DateTime time; return(!DateTime.TryParse(lobby.GetData(key), CultureInfo.InvariantCulture, DateTimeStyles.None, out time) ? defValue : time); }
public static bool GetLobbyBool(string key, IMyLobby lobby, bool defValue) { bool flag; return(!bool.TryParse(lobby.GetData(key), out flag) ? defValue : flag); }
public static int GetLobbyAppVersion(IMyLobby lobby) { int num; return(int.TryParse(lobby.GetData("appVersion"), out num) ? num : 0); }
public static string GetDataHash(IMyLobby lobby) => lobby.GetData("dataHash");