diff --git a/SingleBoostr/SingleBoostr.API/SingleBoostr.API/Client.cs b/SingleBoostr/SingleBoostr.API/SingleBoostr.API/Client.cs index 422f04d..481d30a 100644 --- a/SingleBoostr/SingleBoostr.API/SingleBoostr.API/Client.cs +++ b/SingleBoostr/SingleBoostr.API/SingleBoostr.API/Client.cs @@ -15,6 +15,7 @@ public class Client public SteamUtils005 SteamUtils; public SteamApps001 SteamApps001; public SteamApps003 SteamApps003; + public SteamFriends005 SteamFriends; private int Pipe; private int User; private bool RunningCallbacks; @@ -57,6 +58,7 @@ public bool Initialize(long appId) this.SteamUserStats = this.SteamClient.GetSteamUserStats006(this.User, this.Pipe); this.SteamApps001 = this.SteamClient.GetSteamApps001(this.User, this.Pipe); this.SteamApps003 = this.SteamClient.GetSteamApps003(this.User, this.Pipe); + this.SteamFriends = this.SteamClient.GetSteamFriends005(this.User, this.Pipe); return true; } diff --git a/SingleBoostr/SingleBoostr/SingleBoostr/mainForm.Designer.cs b/SingleBoostr/SingleBoostr/SingleBoostr/mainForm.Designer.cs index cc4fdbe..49d5d25 100644 --- a/SingleBoostr/SingleBoostr/SingleBoostr/mainForm.Designer.cs +++ b/SingleBoostr/SingleBoostr/SingleBoostr/mainForm.Designer.cs @@ -51,18 +51,43 @@ private void InitializeComponent() this.btnTosNo = new System.Windows.Forms.Button(); this.btnTosYes = new System.Windows.Forms.Button(); this.lblToS = new System.Windows.Forms.Label(); + this.panel3 = new System.Windows.Forms.Panel(); + this.panel2 = new System.Windows.Forms.Panel(); this.panelRunning = new System.Windows.Forms.Panel(); + this.btnHideWindow = new System.Windows.Forms.Button(); this.listGamesActive = new System.Windows.Forms.ListBox(); this.lblActiveGames = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); this.btnStopBoost = new System.Windows.Forms.Button(); this.checkProcessTimer = new System.Windows.Forms.Timer(this.components); this.restartGamesTimer = new System.Windows.Forms.Timer(this.components); + this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components); + this.panelGame = new System.Windows.Forms.Panel(); + this.panelGameArea = new System.Windows.Forms.Panel(); + this.game_YouWon = new System.Windows.Forms.Label(); + this.game_Obsticle2 = new System.Windows.Forms.PictureBox(); + this.game_Obsticle1 = new System.Windows.Forms.PictureBox(); + this.game_Player1 = new System.Windows.Forms.PictureBox(); + this.game_Ball = new System.Windows.Forms.PictureBox(); + this.game_Player2 = new System.Windows.Forms.PictureBox(); + this.panelGameScore = new System.Windows.Forms.Panel(); + this.game_Player1_Score = new System.Windows.Forms.Label(); + this.game_Timer = new System.Windows.Forms.Timer(this.components); + this.game_AITimer = new System.Windows.Forms.Timer(this.components); + this.game_Instructions = new System.Windows.Forms.Label(); this.panelMain.SuspendLayout(); this.panelLoading.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picLoading)).BeginInit(); this.panelWarning.SuspendLayout(); this.panelRunning.SuspendLayout(); + this.panelGame.SuspendLayout(); + this.panelGameArea.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.game_Obsticle2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.game_Obsticle1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.game_Player1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.game_Ball)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.game_Player2)).BeginInit(); + this.panelGameScore.SuspendLayout(); this.SuspendLayout(); // // listGames @@ -243,6 +268,8 @@ private void InitializeComponent() this.panelWarning.Controls.Add(this.btnTosNo); this.panelWarning.Controls.Add(this.btnTosYes); this.panelWarning.Controls.Add(this.lblToS); + this.panelWarning.Controls.Add(this.panel3); + this.panelWarning.Controls.Add(this.panel2); this.panelWarning.Dock = System.Windows.Forms.DockStyle.Fill; this.panelWarning.Location = new System.Drawing.Point(0, 0); this.panelWarning.Name = "panelWarning"; @@ -288,15 +315,32 @@ private void InitializeComponent() // lblToS // this.lblToS.Dock = System.Windows.Forms.DockStyle.Top; - this.lblToS.Location = new System.Drawing.Point(0, 0); + this.lblToS.Location = new System.Drawing.Point(20, 0); this.lblToS.Name = "lblToS"; - this.lblToS.Size = new System.Drawing.Size(538, 241); + this.lblToS.Size = new System.Drawing.Size(498, 241); this.lblToS.TabIndex = 7; this.lblToS.Text = "Terms of Service"; this.lblToS.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // + // panel3 + // + this.panel3.Dock = System.Windows.Forms.DockStyle.Right; + this.panel3.Location = new System.Drawing.Point(518, 0); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(20, 293); + this.panel3.TabIndex = 19; + // + // panel2 + // + this.panel2.Dock = System.Windows.Forms.DockStyle.Left; + this.panel2.Location = new System.Drawing.Point(0, 0); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(20, 293); + this.panel2.TabIndex = 18; + // // panelRunning // + this.panelRunning.Controls.Add(this.btnHideWindow); this.panelRunning.Controls.Add(this.listGamesActive); this.panelRunning.Controls.Add(this.lblActiveGames); this.panelRunning.Controls.Add(this.panel1); @@ -308,13 +352,27 @@ private void InitializeComponent() this.panelRunning.TabIndex = 6; this.panelRunning.Visible = false; // + // btnHideWindow + // + this.btnHideWindow.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnHideWindow.FlatAppearance.BorderColor = System.Drawing.Color.Gray; + this.btnHideWindow.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnHideWindow.ForeColor = System.Drawing.SystemColors.Highlight; + this.btnHideWindow.Location = new System.Drawing.Point(145, 192); + this.btnHideWindow.Name = "btnHideWindow"; + this.btnHideWindow.Size = new System.Drawing.Size(254, 40); + this.btnHideWindow.TabIndex = 12; + this.btnHideWindow.Text = "HIDE WINDOW"; + this.btnHideWindow.UseVisualStyleBackColor = true; + this.btnHideWindow.Click += new System.EventHandler(this.btnHideWindow_Click); + // // listGamesActive // this.listGamesActive.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.listGamesActive.FormattingEnabled = true; this.listGamesActive.IntegralHeight = false; this.listGamesActive.ItemHeight = 15; - this.listGamesActive.Location = new System.Drawing.Point(143, 79); + this.listGamesActive.Location = new System.Drawing.Point(145, 56); this.listGamesActive.Name = "listGamesActive"; this.listGamesActive.SelectionMode = System.Windows.Forms.SelectionMode.None; this.listGamesActive.Size = new System.Drawing.Size(254, 84); @@ -323,7 +381,7 @@ private void InitializeComponent() // lblActiveGames // this.lblActiveGames.Dock = System.Windows.Forms.DockStyle.Top; - this.lblActiveGames.Location = new System.Drawing.Point(0, 61); + this.lblActiveGames.Location = new System.Drawing.Point(0, 35); this.lblActiveGames.Name = "lblActiveGames"; this.lblActiveGames.Size = new System.Drawing.Size(538, 15); this.lblActiveGames.TabIndex = 10; @@ -335,7 +393,7 @@ private void InitializeComponent() this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(538, 61); + this.panel1.Size = new System.Drawing.Size(538, 35); this.panel1.TabIndex = 9; // // btnStopBoost @@ -344,7 +402,7 @@ private void InitializeComponent() this.btnStopBoost.FlatAppearance.BorderColor = System.Drawing.Color.Gray; this.btnStopBoost.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnStopBoost.ForeColor = System.Drawing.SystemColors.Highlight; - this.btnStopBoost.Location = new System.Drawing.Point(143, 169); + this.btnStopBoost.Location = new System.Drawing.Point(145, 146); this.btnStopBoost.Name = "btnStopBoost"; this.btnStopBoost.Size = new System.Drawing.Size(254, 40); this.btnStopBoost.TabIndex = 5; @@ -362,20 +420,158 @@ private void InitializeComponent() this.restartGamesTimer.Interval = 5000; this.restartGamesTimer.Tick += new System.EventHandler(this.restartGamesTimer_Tick); // + // notifyIcon + // + this.notifyIcon.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info; + this.notifyIcon.BalloonTipText = "Running minimized."; + this.notifyIcon.BalloonTipTitle = "SingleBoostr"; + this.notifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon"))); + this.notifyIcon.Text = "SingleBoostr"; + this.notifyIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon_MouseClick); + // + // panelGame + // + this.panelGame.Controls.Add(this.panelGameArea); + this.panelGame.Controls.Add(this.panelGameScore); + this.panelGame.Dock = System.Windows.Forms.DockStyle.Fill; + this.panelGame.Location = new System.Drawing.Point(0, 0); + this.panelGame.Name = "panelGame"; + this.panelGame.Size = new System.Drawing.Size(538, 293); + this.panelGame.TabIndex = 9; + this.panelGame.Visible = false; + // + // panelGameArea + // + this.panelGameArea.Controls.Add(this.game_Instructions); + this.panelGameArea.Controls.Add(this.game_YouWon); + this.panelGameArea.Controls.Add(this.game_Obsticle2); + this.panelGameArea.Controls.Add(this.game_Obsticle1); + this.panelGameArea.Controls.Add(this.game_Player1); + this.panelGameArea.Controls.Add(this.game_Ball); + this.panelGameArea.Controls.Add(this.game_Player2); + this.panelGameArea.Dock = System.Windows.Forms.DockStyle.Fill; + this.panelGameArea.Location = new System.Drawing.Point(0, 0); + this.panelGameArea.Name = "panelGameArea"; + this.panelGameArea.Size = new System.Drawing.Size(538, 262); + this.panelGameArea.TabIndex = 6; + // + // game_YouWon + // + this.game_YouWon.AutoSize = true; + this.game_YouWon.Font = new System.Drawing.Font("Segoe UI", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.game_YouWon.Location = new System.Drawing.Point(202, 106); + this.game_YouWon.Name = "game_YouWon"; + this.game_YouWon.Size = new System.Drawing.Size(142, 37); + this.game_YouWon.TabIndex = 7; + this.game_YouWon.Text = "YOU WON"; + this.game_YouWon.Visible = false; + // + // game_Obsticle2 + // + this.game_Obsticle2.BackColor = System.Drawing.Color.Black; + this.game_Obsticle2.Location = new System.Drawing.Point(387, 110); + this.game_Obsticle2.Name = "game_Obsticle2"; + this.game_Obsticle2.Size = new System.Drawing.Size(5, 30); + this.game_Obsticle2.TabIndex = 6; + this.game_Obsticle2.TabStop = false; + this.game_Obsticle2.Visible = false; + // + // game_Obsticle1 + // + this.game_Obsticle1.BackColor = System.Drawing.Color.Black; + this.game_Obsticle1.Location = new System.Drawing.Point(145, 110); + this.game_Obsticle1.Name = "game_Obsticle1"; + this.game_Obsticle1.Size = new System.Drawing.Size(5, 30); + this.game_Obsticle1.TabIndex = 5; + this.game_Obsticle1.TabStop = false; + this.game_Obsticle1.Visible = false; + // + // game_Player1 + // + this.game_Player1.BackColor = System.Drawing.Color.Silver; + this.game_Player1.Location = new System.Drawing.Point(12, 110); + this.game_Player1.Name = "game_Player1"; + this.game_Player1.Size = new System.Drawing.Size(8, 30); + this.game_Player1.TabIndex = 2; + this.game_Player1.TabStop = false; + // + // game_Ball + // + this.game_Ball.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.game_Ball.Location = new System.Drawing.Point(260, 118); + this.game_Ball.Name = "game_Ball"; + this.game_Ball.Size = new System.Drawing.Size(14, 14); + this.game_Ball.TabIndex = 4; + this.game_Ball.TabStop = false; + // + // game_Player2 + // + this.game_Player2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192))))); + this.game_Player2.Location = new System.Drawing.Point(518, 110); + this.game_Player2.Name = "game_Player2"; + this.game_Player2.Size = new System.Drawing.Size(8, 30); + this.game_Player2.TabIndex = 3; + this.game_Player2.TabStop = false; + // + // panelGameScore + // + this.panelGameScore.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.panelGameScore.Controls.Add(this.game_Player1_Score); + this.panelGameScore.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panelGameScore.Location = new System.Drawing.Point(0, 262); + this.panelGameScore.Name = "panelGameScore"; + this.panelGameScore.Size = new System.Drawing.Size(538, 31); + this.panelGameScore.TabIndex = 5; + // + // game_Player1_Score + // + this.game_Player1_Score.Dock = System.Windows.Forms.DockStyle.Fill; + this.game_Player1_Score.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.game_Player1_Score.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.game_Player1_Score.Location = new System.Drawing.Point(0, 0); + this.game_Player1_Score.Name = "game_Player1_Score"; + this.game_Player1_Score.Size = new System.Drawing.Size(538, 31); + this.game_Player1_Score.TabIndex = 5; + this.game_Player1_Score.Text = "Score: 0/40 - Lives: 5"; + this.game_Player1_Score.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // game_Timer + // + this.game_Timer.Interval = 1; + this.game_Timer.Tick += new System.EventHandler(this.game_Timer_Tick); + // + // game_AITimer + // + this.game_AITimer.Interval = 1; + this.game_AITimer.Tick += new System.EventHandler(this.game_AITimer_Tick); + // + // game_Instructions + // + this.game_Instructions.AutoSize = true; + this.game_Instructions.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.game_Instructions.Location = new System.Drawing.Point(158, 143); + this.game_Instructions.Name = "game_Instructions"; + this.game_Instructions.Size = new System.Drawing.Size(234, 34); + this.game_Instructions.TabIndex = 8; + this.game_Instructions.Text = "Press F12 to start.\r\nUse Arrow keys to move up and down."; + this.game_Instructions.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // // mainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.ClientSize = new System.Drawing.Size(538, 293); - this.Controls.Add(this.panelMain); + this.Controls.Add(this.panelGame); this.Controls.Add(this.panelWarning); - this.Controls.Add(this.panelRunning); this.Controls.Add(this.panelLoading); + this.Controls.Add(this.panelRunning); + this.Controls.Add(this.panelMain); this.Font = new System.Drawing.Font("Segoe UI", 9F); this.ForeColor = System.Drawing.Color.Gray; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.KeyPreview = true; this.MaximizeBox = false; this.MinimumSize = new System.Drawing.Size(550, 300); this.Name = "mainForm"; @@ -383,12 +579,23 @@ private void InitializeComponent() this.Text = "SingleBoostr :: Terms of Service"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.mainForm_FormClosing); this.Load += new System.EventHandler(this.mainForm_Load); + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.mainForm_KeyDown); + this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.mainForm_KeyUp); this.panelMain.ResumeLayout(false); this.panelMain.PerformLayout(); this.panelLoading.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.picLoading)).EndInit(); this.panelWarning.ResumeLayout(false); this.panelRunning.ResumeLayout(false); + this.panelGame.ResumeLayout(false); + this.panelGameArea.ResumeLayout(false); + this.panelGameArea.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.game_Obsticle2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.game_Obsticle1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.game_Player1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.game_Ball)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.game_Player2)).EndInit(); + this.panelGameScore.ResumeLayout(false); this.ResumeLayout(false); } @@ -423,6 +630,23 @@ private void InitializeComponent() private System.Windows.Forms.Timer restartGamesTimer; private System.Windows.Forms.Label lblClearSelected; private System.Windows.Forms.ComboBox cmboxTosLanguage; + private System.Windows.Forms.NotifyIcon notifyIcon; + private System.Windows.Forms.Button btnHideWindow; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Panel panel2; + public System.Windows.Forms.PictureBox game_Player1; + public System.Windows.Forms.PictureBox game_Player2; + public System.Windows.Forms.PictureBox game_Ball; + public System.Windows.Forms.Timer game_Timer; + public System.Windows.Forms.Timer game_AITimer; + private System.Windows.Forms.Panel panelGameScore; + public System.Windows.Forms.Panel panelGameArea; + private System.Windows.Forms.Panel panelGame; + public System.Windows.Forms.Label game_Player1_Score; + public System.Windows.Forms.PictureBox game_Obsticle2; + public System.Windows.Forms.PictureBox game_Obsticle1; + public System.Windows.Forms.Label game_YouWon; + public System.Windows.Forms.Label game_Instructions; } } diff --git a/SingleBoostr/SingleBoostr/SingleBoostr/mainForm.cs b/SingleBoostr/SingleBoostr/SingleBoostr/mainForm.cs index a7774b5..1683f25 100644 --- a/SingleBoostr/SingleBoostr/SingleBoostr/mainForm.cs +++ b/SingleBoostr/SingleBoostr/SingleBoostr/mainForm.cs @@ -17,9 +17,7 @@ namespace SingleBoostr { public partial class mainForm : Form { - [DllImport("user32.dll", CharSet = CharSet.Auto)] - private static extern int SendMessage(IntPtr hWnd, int msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)]string lParam); - + private Game _game; private Client _steamClient = new Client(); private List _gameList = new List(); private List _gameListSelected = new List(); @@ -27,6 +25,8 @@ public partial class mainForm : Form private bool _areGamesRunning; private bool _gameCountWarningDisplayed; + private bool _windowHidden; + private bool _windowHiddenNotificationDisplayed; private const int _eM_SETCUEBANNER = 0x1501; private const int _maxBoostGameCount = 33; @@ -59,7 +59,6 @@ private void mainForm_Load(object sender, EventArgs e) private void mainForm_FormClosing(object sender, FormClosingEventArgs e) { - e.Cancel = true; stopGames(); Properties.Settings.Default.selectedgames = new System.Collections.Specialized.StringCollection(); @@ -67,7 +66,65 @@ private void mainForm_FormClosing(object sender, FormClosingEventArgs e) Properties.Settings.Default.selectedgames.Add(game.appId.ToString()); Properties.Settings.Default.Save(); - Environment.Exit(1); + } + + private void mainForm_KeyDown(object sender, KeyEventArgs e) + { + if (_game != null) + _game.KeyDown(e.KeyCode); + } + + private void mainForm_KeyUp(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.F12) + { + if (_game == null && panelMain.Visible) + { + _game = new Game(this); + panelGame.Visible = true; + panelMain.Visible = false; + Text = "You want a challange, huh?"; + } + } + + if (_game != null) + _game.KeyUp(e.KeyCode); + } + + private void game_Timer_Tick(object sender, EventArgs e) + { + _game.ProcessTick(); + } + + private void game_AITimer_Tick(object sender, EventArgs e) + { + _game.ProcessEnemyTick(); + } + + private void btnHideWindow_Click(object sender, EventArgs e) + { + if (!_windowHidden) + { + notifyIcon.Visible = true; + _windowHidden = true; + Hide(); + + if (!_windowHiddenNotificationDisplayed) + { + notifyIcon.ShowBalloonTip(2000); + _windowHiddenNotificationDisplayed = true; + } + } + } + + private void notifyIcon_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left && _windowHidden) + { + notifyIcon.Visible = false; + _windowHidden = false; + Show(); + } } private void btnTosYes_Click(object sender, EventArgs e) @@ -341,7 +398,7 @@ private string downloadXmlList(string url) private void connectToClient() { Text = "SingleBoostr :: Fetching user..."; - SendMessage(txtSearch.Handle, _eM_SETCUEBANNER, 0, "Search game"); + NativeMethods.SendMessage(txtSearch.Handle, _eM_SETCUEBANNER, IntPtr.Zero, "Search game"); if (Application.StartupPath == Steam.GetInstallPath()) { @@ -361,12 +418,18 @@ private void connectToClient() } else { + setDisplayName(); picLoading.Visible = true; - setTitleUsernameFromSteamId64(_steamClient.SteamUser.GetSteamID()); gameListWorker.RunWorkerAsync(); } } + private void setDisplayName() + { + string name = _steamClient.SteamFriends.GetPersonaName(); + Text = string.IsNullOrWhiteSpace(name) ? "SingleBoostr :: Unknown user" : $"SingleBoostr :: {getUnicodeString(name)}"; + } + private void setRestartGamesTimerIntervalRandom() { int baseTime = (int)TimeSpan.FromHours(2).TotalMilliseconds; @@ -387,6 +450,7 @@ private void disableButtonsTemporarily() btnIdle.Enabled = false; btnStopBoost.Enabled = false; + /*Re-enable buttons in n seconds to prevent spamming*/ btnPauseTimer.Start(); } @@ -424,18 +488,15 @@ private void startGames() listGamesActive.Items.Add(game.name); } } - - foreach (var process in _gameProcessList) - { - process.Start(); - } - + + _gameProcessList.ForEach(o => o.Start()); panelRunning.Visible = true; panelMain.Visible = false; _areGamesRunning = true; checkProcessTimer.Start(); lblActiveGames.Text = $"You're currently idling {_gameProcessList.Count} game(s)."; + notifyIcon.Text = $"SingleBoostr :: Idling {_gameProcessList.Count} game(s)"; } private void stopGames() @@ -456,42 +517,6 @@ private void stopGames() panelMain.Visible = true; } - private void setTitleUsernameFromSteamId64(ulong id) - { - try - { - using (var client = new WebClient()) - { - client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; - client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); - client.DownloadStringCompleted += steamProfileJsonDownloaded; - client.DownloadStringAsync(new Uri($"https://steamcommunity.com/profiles/{id}")); - } - } - catch - { - Text = "SingleBoostr :: Unknown user"; - } - } - - private void steamProfileJsonDownloaded(object sender, DownloadStringCompletedEventArgs e) - { - if (!string.IsNullOrWhiteSpace(e.Result) && e.Result.Contains("Steam Community :: ")) - { - /*Oh shit some naughty quick html parsing. Or well, just grabbing some stuff inbetween. ;-)*/ - string username = Regex.Match(e.Result, @"Steam Community :: (.+?)").Groups[1].Value.Trim(); - - if (username != "Error" && !string.IsNullOrWhiteSpace(username)) - { - Text = $"SingleBoostr :: {getUnicodeString(username)}"; - } - else - { - Text = $"SingleBoostr :: Unknown user"; - } - } - } - private void refreshGameList() { /*Check if we have any saved games from last time*/