public void ReadFromFile() { values = GameSpeedOptionsSerializable.CreateFromFile(); if (values == null) { values = new GameSpeedOptionsSerializable(); } Parameters = new GameSpeedParameters(values.GameSpeedIndex); }
public static GameSpeedOptionsSerializable CreateFromFile() { string path = getOptionsFilePath(); if (!File.Exists(path)) { return(null); } try { XmlSerializer ser = new XmlSerializer(typeof(GameSpeedOptionsSerializable)); TextReader reader = new StreamReader(path); GameSpeedOptionsSerializable instance = (GameSpeedOptionsSerializable)ser.Deserialize(reader); reader.Close(); return(instance); } catch { Debug.Log("Game Speed Mod: Error reading options file."); return(null); } }