// ============================== // Methods // ============================== public static Configuration Load(string filename) { Configuration config = new Configuration(); StreamReader file = File.OpenText(filename); // Begin reading Console.WriteLine("Loading configuration file."); //try { for (String str = file.ReadLine(); str != null; str = file.ReadLine()) { if (str.Length > 0) { String[] tokens = str.Split(assignmentDelimiter, StringSplitOptions.RemoveEmptyEntries); LinkedList<String> descriptionList = new LinkedList<string>(tokens[0].Split(propertyDelimiter, StringSplitOptions.RemoveEmptyEntries)); String value = tokens[1]; config.ParseConfigLine(descriptionList, value); } } //} catch { // Console.Error.WriteLine("Corrupt config file!"); //} finally { file.Close(); //} return config; }
public RhythmEngine(Configuration config) { Config = config; fadeInTimeInterval = (float)(Config.Game.Track.LeadIn * fadeVolumeInterval); fadeOutTimeInterval = (float)(Config.Game.Track.FallOut * fadeVolumeInterval); State = RhythmEngineState.Stopped; for (int i = 0; i < NoPlayers; ++i) players[i] = new TrackPlayer(); ActivePlayer = PlayerID.Left; }
public ActGame() { // ============================== // -- Prepare filesystems // ============================== Directory.SetCurrentDirectory(@"..\..\..\..\"); root = Directory.GetCurrentDirectory(); Console.WriteLine("Current working directory is:"); Console.WriteLine(root); graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // Load configuration files config = Configuration.Load(@"master.conf"); IsMouseVisible = true; // Initialize controllers keyboardInput = new KeyboardInput(); leftController = new KeyboardController(noRhythmKeys, keyboardInput, config.IO.Keyboard.Left); rightController = new KeyboardController(noRhythmKeys, keyboardInput, config.IO.Keyboard.Right); }