static void Main(string[] args) { GameManager manager = new GameManager(); GameInfo borderlands2 = manager.Games["720CE71B-FCBF-46C8-AC9D-C4B2BF3169E3"]; UserGameInfo borderInfo = manager.AddGame(borderlands2, @"C:\Program Files (x86)\Steam\steamapps\common\Borderlands 2\Binaries\Win32\Borderlands2.exe"); GameProfile profile = new GameProfile(); profile.InitializeDefault(borderlands2); PlayerInfo p1 = new PlayerInfo(); p1.monitorBounds = new Rectangle(0, 0, 960, 540); p1.screenIndex = 0; profile.PlayerData.Add(p1); PlayerInfo p2 = new PlayerInfo(); p2.monitorBounds = new Rectangle(0, 540, 960, 540); p2.screenIndex = 0; profile.PlayerData.Add(p2); borderInfo.Profiles.Add(profile); manager.WaitSave(); // try to play game with custom profile handler = manager.MakeHandler(borderlands2); handler.Initialize(borderInfo, profile); ThreadPool.QueueUserWorkItem(Play); //handler.Play(); for (; ; ) { Thread.Sleep(16); handler.Update(16); if (handler.HasEnded) { break; } } }
private void list_Games_SelectedChanged(object arg1, Control arg2) { currentControl = (GameControl)arg1; currentGameInfo = currentControl.Game; if (currentGameInfo == null) { return; } if (!setSize) { this.Size = defaultSize; setSize = true; } panelGameName.Visible = true; label_StepTitle.Visible = true; StepPanel.Visible = true; btnBack.Visible = true; btnNext.Visible = true; currentGame = currentGameInfo.Game; btn_Play.Enabled = false; if (currentGame.Steps == null || currentStepIndex == currentGame.Steps.Length) { // can play btn_Play.Enabled = true; // remove the current step if there's one KillCurrentStep(); btnBack.Visible = false; btnNext.Visible = false; } currentProfile = new GameProfile(); currentProfile.InitializeDefault(currentGame); this.label_GameTitle.Text = currentGame.GameName; this.pic_Game.Image = currentGameInfo.Icon; Type[] steps = currentGame.Steps; if (steps != null && steps.Length > 0) { GoToStep(0); } }