Skip to content

Commit

Permalink
4.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Ni1kko committed Oct 30, 2021
1 parent 69c1ac2 commit 6a379cd
Show file tree
Hide file tree
Showing 23 changed files with 138 additions and 238 deletions.
2 changes: 1 addition & 1 deletion Source/HourBoostr.Settings/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="AutoMapper" publicKeyToken="be96cd2c38ef1005" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-7.0.1.0" newVersion="7.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
Expand Down
4 changes: 2 additions & 2 deletions Source/HourBoostr.Settings/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.1.8")]
[assembly: AssemblyFileVersion("4.1.8")]
[assembly: AssemblyVersion("4.1.9")]
[assembly: AssemblyFileVersion("4.1.9")]
98 changes: 27 additions & 71 deletions Source/HourBoostr.Settings/Ui/AppGames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
using System.Text.RegularExpressions;
using System.Linq;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using HourBoostr.Settings.Core;
using HourBoostr.Settings.Objects;
using SingleBoostr.Core.Misc;
using SingleBoostr.Core.Enums;

namespace HourBoostr.Settings.Ui
{
Expand All @@ -24,22 +25,7 @@ public partial class AppGames : Form
/// Stores all game available on a user account
/// </summary>
private List<Config.Game> mGames = new List<Config.Game>();


/// <summary>
/// SendMessage import
/// Specifically used in this case for setting placeholder text for text controls
/// </summary>
/// <param name="hWnd">IntPtr</param>
/// <param name="msg">int</param>
/// <param name="wParam">int</param>
/// <param name="lParam">[MarshalAs(UnmanagedType.LPWStr)]string</param>
/// <returns></returns>
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int SendMessage(IntPtr hWnd, int msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)]string lParam);
private const int EM_SETCUEBANNER = 0x1501;



/// <summary>
/// Form constructor
/// Sets placeholder text
Expand All @@ -50,8 +36,8 @@ public AppGames()
Size = new Size(381, 120);

/*Set placeholder text for text controls*/
SendMessage(txtProfile.Handle, EM_SETCUEBANNER, 0, "https://steamcommunity.com/id/ezzpify");
SendMessage(txtSearch.Handle, EM_SETCUEBANNER, 0, "Search Game");
Utils.SendMessage(txtProfile.Handle, Messages.EM_SETCUEBANNER, 0, Const.Steam.Example_Profile.URLCUSTOM);
Utils.SendMessage(txtSearch.Handle, Messages.EM_SETCUEBANNER, 0, "Search Game");

ActiveControl = lvlExampleInput;
}
Expand All @@ -67,29 +53,20 @@ private void ShowLoading(bool show)
picLoading.Visible = show;
}


/// <summary>
/// Highlight when mouse over
/// </summary>
/// <param name="sender">object</param>
/// <param name="e">EventArgs</param>
private void lvlExampleInput_MouseEnter(object sender, EventArgs e)
{
lvlExampleInput.ForeColor = SystemColors.Highlight;
}

private void lvlExampleInput_MouseEnter(object sender, EventArgs e) => lvlExampleInput.ForeColor = SystemColors.Highlight;

/// <summary>
/// De-highlight when mouse over
/// </summary>
/// <param name="sender">object</param>
/// <param name="e">EventArgs</param>
private void lvlExampleInput_MouseLeave(object sender, EventArgs e)
{
lvlExampleInput.ForeColor = Color.Gray;
}


private void lvlExampleInput_MouseLeave(object sender, EventArgs e) => lvlExampleInput.ForeColor = Color.Gray;

/// <summary>
/// Input example click
/// Shows several ways to input acceptable data
Expand All @@ -100,15 +77,14 @@ private void lvlExampleInput_Click(object sender, EventArgs e)
{
MessageBox.Show(
"Full url\n"
+ "• https://steamcommunity.com/id/ezzpify\n"
+ "• http://steamcommunity.com/profiles/76561197960285265\n\n"
+ $"• {Const.Steam.Example_Profile.URLCUSTOM}\n"
+ $"• {Const.Steam.Example_Profile.URL}\n\n"
+ "Custom url or SteamID64\n"
+ "• 76561197960285265\n"
+ "• ezzpify",
+ $"• {Const.Steam.Example_Profile.STEAMID}\n"
+ $"• {Const.Steam.Example_Profile.CUSTOMURL}",
"Example input");
}


/// <summary>
/// txtProfile keydown
/// If input is valid it will start the background worker and try to fetch the games
Expand Down Expand Up @@ -142,7 +118,6 @@ private void txtProfile_KeyDown(object sender, KeyEventArgs e)
}
}


/// <summary>
/// Checks if the input value is a steam url, or can be formatted as one
/// </summary>
Expand Down Expand Up @@ -174,10 +149,10 @@ private static string CheckInput(string input)
{
/*See if the input is SteamID64 (which is 17 in length, only numbers)*/
if (reg3.IsMatch(input) && input.Length == 17)
url = $"https://steamcommunity.com/profile/{input}";
url = Utils.STEAM_URL("community", $"profiles/{input}");
/*Lastly we'll assume it's a custom url*/
else if (reg4.IsMatch(input))
url = $"http://steamcommunity.com/id/{input}";
url = Utils.STEAM_URL("community", $"id/{input}");
}

/*We'll strip the url of the last slash since we'll add that later on*/
Expand All @@ -187,7 +162,6 @@ private static string CheckInput(string input)
return url;
}


/// <summary>
/// Bwg main worker
/// Fetches game list from steam profile
Expand All @@ -206,7 +180,6 @@ private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
}
}


/// <summary>
/// Bwg completed
/// Adds all the games fetched to the listbox
Expand All @@ -221,30 +194,23 @@ private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerComplet
txtProfile.Enabled = true;

gameList.Items.Clear();
foreach (var game in mGames)
gameList.Items.Add(game.name);
mGames.ForEach(game => gameList.Items.Add(game.name));

if (gameList.Items.Count == 0)
{
Size = new Size(381, 120);
gameGroup.Visible = false;
}
if (gameList.Items.Count != 0) return;

Size = new Size(381, 120);
gameGroup.Visible = false;
}


/// <summary>
/// Loads all games from available games list into listboxes
/// </summary>
private void LoadAvailableGames()
{
gameList.Items.Clear();
foreach (var game in mGames)
{
gameList.Items.Add(game.name);
}
mGames.ForEach(game => gameList.Items.Add(game.name));
}


/// <summary>
/// Sorts the global lists by name and adds them to the listboxes
/// </summary>
Expand All @@ -270,7 +236,6 @@ private void RefreshLists()
mGamesSelected.ForEach(o => selectedList.Items.Add(o.name));
}


/// <summary>
/// Adds the selected game to selected games and removes it from games
/// </summary>
Expand All @@ -292,7 +257,6 @@ private void gameList_SelectedIndexChanged(object sender, EventArgs e)
}
}


/// <summary>
/// Re-adds the selected game to games and removes it from selected games
/// Just reverse of the above function
Expand All @@ -302,32 +266,24 @@ private void gameList_SelectedIndexChanged(object sender, EventArgs e)
private void selectedList_SelectedIndexChanged(object sender, EventArgs e)
{
var item = selectedList.SelectedItem;
if (item == null)
return;
if (item == null) return;

var selected = mGamesSelected.FirstOrDefault(o => o.name == (string)item);
if (selected != null)
{
mGames.Add(selected);
mGamesSelected.Remove(selected);
if (selected == null) return;

RefreshLists();
}
mGames.Add(selected);
mGamesSelected.Remove(selected);
RefreshLists();
}


/// <summary>
/// Just refresh each time user types and it will filter
/// games in RefreshLists function
/// </summary>
/// <param name="sender">object</param>
/// <param name="e">EventArgs</param>
private void txtSearch_TextChanged(object sender, EventArgs e)
{
RefreshLists();
}


private void txtSearch_TextChanged(object sender, EventArgs e) => RefreshLists();

/// <summary>
/// Closing event
/// Since we want to be able to access the game list after user closes form
Expand Down
Loading

0 comments on commit 6a379cd

Please sign in to comment.