Can create Uplay shortcuts now

Added support to read Uplay games and
to load them into the interface. Also added
the ability to save the Uplay shortcuts.
Now need to test and then add the ability
to run Uplay Games!
This commit is contained in:
Terry MacDonald 2020-11-14 18:00:57 +13:00
parent e7af4ac252
commit 401e76c6e4
3 changed files with 28 additions and 15 deletions

View File

@ -17,7 +17,7 @@ namespace HeliosPlus.GameLibraries
{ {
#region Class Variables #region Class Variables
// Common items to the class // Common items to the class
private static List<SteamGame> _allSteamGames = new List<SteamGame>(); private static List<Game> _allSteamGames = new List<Game>();
private static string steamAppIdRegex = @"/^[0-9A-F]{1,10}$"; private static string steamAppIdRegex = @"/^[0-9A-F]{1,10}$";
private static string _steamExe; private static string _steamExe;
private static string _steamPath; private static string _steamPath;
@ -52,7 +52,7 @@ namespace HeliosPlus.GameLibraries
#endregion #endregion
#region Class Properties #region Class Properties
public static List<SteamGame> AllInstalledGames public static List<Game> AllInstalledGames
{ {
get get
{ {

View File

@ -19,7 +19,7 @@ namespace HeliosPlus.GameLibraries
{ {
#region Class Variables #region Class Variables
// Common items to the class // Common items to the class
private static List<UplayGame> _allUplayGames = new List<UplayGame>(); private static List<Game> _allUplayGames = new List<Game>();
private static string uplayAppIdRegex = @"/^[0-9A-F]{1,10}$"; private static string uplayAppIdRegex = @"/^[0-9A-F]{1,10}$";
private static string _uplayExe; private static string _uplayExe;
private static string _uplayPath; private static string _uplayPath;
@ -51,7 +51,7 @@ namespace HeliosPlus.GameLibraries
#endregion #endregion
#region Class Properties #region Class Properties
public static List<UplayGame> AllInstalledGames public static List<Game> AllInstalledGames
{ {
get get
{ {

View File

@ -27,6 +27,7 @@ namespace HeliosPlus.UIForms
private ShortcutPermanence _permanence = ShortcutPermanence.Temporary; private ShortcutPermanence _permanence = ShortcutPermanence.Temporary;
List<StartProgram> _startPrograms = new List<StartProgram>(); List<StartProgram> _startPrograms = new List<StartProgram>();
private ShortcutItem _shortcutToEdit = null; private ShortcutItem _shortcutToEdit = null;
List<Game> allGames;
private bool _isNewShortcut = true; private bool _isNewShortcut = true;
private bool _isUnsaved = true; private bool _isUnsaved = true;
private bool _loadedShortcut = false; private bool _loadedShortcut = false;
@ -451,22 +452,27 @@ namespace HeliosPlus.UIForms
} }
// If the game is a SteamGame // If the game is a SteamGame
/*else if (txt_game_launcher.Text == SupportedGameLibrary.Uplay.ToString()) else if (txt_game_launcher.Text == SupportedGameLibrary.Uplay.ToString())
{ {
// Find the UplayGame // Find the UplayGame
_steamGameToUse = (from UplayGame in SteamLibrary.AllInstalledGames where UplayGame.GameId == _shortcutToEdit.GameAppId).First(); _gameToUse = new GameStruct();
_gameToUse.GameToPlay = (from uplayGame in SteamLibrary.AllInstalledGames where uplayGame.Id == _gameId select uplayGame).First();
_gameToUse.StartTimeout = Convert.ToUInt32(nud_timeout_game.Value);
_gameToUse.GameArguments = txt_args_game.Text;
_gameToUse.GameArgumentsRequired = cb_args_game.Checked;
_shortcutToEdit.UpdateGameShortcut( _shortcutToEdit = new ShortcutItem(
Name, txt_shortcut_save_name.Text,
_profileToUse, _profileToUse,
_steamGameToUse, _gameToUse,
_permanence, _permanence,
_steamGameToUse.GameIconPath, _gameToUse.GameToPlay.IconPath,
_startPrograms, _startPrograms,
_autoName _autoName,
_uuid
); );
}*/ }
} }
else if (rb_standalone.Checked) else if (rb_standalone.Checked)
{ {
@ -700,9 +706,15 @@ namespace HeliosPlus.UIForms
bool foundChosenProfileInLoadedProfiles = false; bool foundChosenProfileInLoadedProfiles = false;
ProfileItem chosenProfile = null; ProfileItem chosenProfile = null;
// Populate a full list of games
// Start with the Steam Games
allGames = SteamLibrary.AllInstalledGames;
// Then add the Uplay Games
allGames.AddRange(UplayLibrary.AllInstalledGames);
// Load the Games ListView
foreach (var game in SteamLibrary.AllInstalledGames.OrderBy(game => game.Name)) // Load the Steam Games into the Games ListView
foreach (var game in allGames.OrderBy(game => game.Name))
{ {
// Get the bitmap out of the IconPath // Get the bitmap out of the IconPath
// IconPath can be an ICO, or an EXE // IconPath can be an ICO, or an EXE
@ -734,6 +746,7 @@ namespace HeliosPlus.UIForms
}); });
} }
// If it is a new Shortcut then we don't have to load anything! // If it is a new Shortcut then we don't have to load anything!
if (_isNewShortcut) if (_isNewShortcut)
{ {
@ -989,7 +1002,7 @@ namespace HeliosPlus.UIForms
if (lv_games.SelectedItems.Count > 0) if (lv_games.SelectedItems.Count > 0)
{ {
txt_game_name.Text = lv_games.SelectedItems[0].Text; txt_game_name.Text = lv_games.SelectedItems[0].Text;
foreach (SteamGame game in SteamLibrary.AllInstalledGames) foreach (Game game in allGames)
{ {
if (game.Name == txt_game_name.Text) if (game.Name == txt_game_name.Text)
{ {