Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

how to capture all games installed on my computer vb.net

how to capture all games installed on my computer vb.net

Print : http: //prntscr.com/n5belt
(Mar 30, 2019 09:06 PM)otofocknk Wrote:  how to capture all games installed on my computer vb.net

Print : http: //prntscr.com/n5belt

here's a quick solution,it's not a professional solution but it's enough to get some idea so that you can achieve the result what are you looking for. Again, i emphasize that you use this code as an idea not as a final solution because of poor quality.All the best
[Image: hFDfLmz.png]

Code
public class GameInfo
    {
        public string GameName { get; set; }
        public string GameCover { get; set; }
        public string GamePath { get; set; }
        public string GameLunchPath { get; set; }
    }

    public partial class MainWindow : Window
    {
        private List<GameInfo> myInstalledGames = new List<GameInfo>();

        public MainWindow()
        {
            InitializeComponent();

        }

        public void  ChekGames()
        {
            Dictionary<string,string> gamepath = new Dictionary<string, string>()
            {
               {"Windows","GameName1"},
               {"Users","GameName2"},
               {"Temp","GameName3"}
            };

            foreach(KeyValuePair<string,string> item in gamepath)
            {
                if(Directory.Exists($@"C:\{item.Key}"))
                {
                    myInstalledGames.Add(GameData(item.Value));
                }
            }
        }

        public GameInfo GameData(string gamename)
        {
            Dictionary<string, GameInfo> gamepath = new Dictionary<string, GameInfo>()
            {
               {"GameName1",new GameInfo(){GameName="Game 1",GameCover="https://upload.wikimedia.org/wikipedia/en/d/db/Apex_legends_cover.jpg" } },
               {"GameName2",new GameInfo(){GameName="Game 2",GameCover="https://www.mobygames.com/images/covers/l/33719-half-life-counter-strike-xbox-front-cover.jpg" }},
               {"GameName3",new GameInfo(){GameName="Game 3",GameCover="https://upload.wikimedia.org/wikipedia/en/thumb/4/47/Tom_Clancy%27s_Rainbow_Six_Siege_cover_art.jpg/220px-Tom_Clancy%27s_Rainbow_Six_Siege_cover_art.jpg" }}
            };

            if (gamepath.ContainsKey(gamename) == true)
            {
                return gamepath[gamename];
            }
            else
                return null;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            myInstalledGames.Clear();
            GameListConteiner.Children.Clear();
            ChekGames();
        }

        private void load_Click(object sender, RoutedEventArgs e)
        {
            GameListConteiner.Children.Clear();
            foreach(var item in myInstalledGames)
            {              
                var gamecover = new GameCover();
                gamecover.Height = 350;
                gamecover.Width = 250;
                gamecover.Margin = new Thickness(5);
                gamecover.gameName.Text = item.GameName;
                gamecover.imgGameCover.Source = new BitmapImage(new Uri(item.GameCover));
                GameListConteiner.Children.Add(gamecover);
            }
        }
    }

Main windows xaml
Code
<Grid Background="#2d3436">
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <WrapPanel x:Name="GameListConteiner">
            
        </WrapPanel>
        <StackPanel Grid.Column="1">
            <Button Click="Button_Click" Content="Check " HorizontalAlignment="Left"  VerticalAlignment="Top" Width="75"/>
            <Button x:Name="load" Click="load_Click" Content="Load" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="75"/>
        </StackPanel>
    </Grid>

Game cover user control xaml
Code
<UserControl x:Class="Games.GameCover"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:Games"
             mc:Ignorable="d"
             d:DesignHeight="350" d:DesignWidth="250">
    <Grid Background="#2f3640">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="40" MaxHeight="40"/>
        </Grid.RowDefinitions>
        <Image Grid.Row="0" Height="350" Name="imgGameCover" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch" />
        <TextBlock x:Name="gameName" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" FontWeight="DemiBold" Foreground="White"/>
    </Grid>

</UserControl>
buy me a coffee eth:0x88621A52aa5Eb3b6503628369687111810186c58
Basically keep an online and up-to-date list of games, and cross reference it with locally installed apps. You may have to iterate through the list of installed programs in the registry to get this. And you may have to write a custom function that can pull installed app id's from Steam and pull details from an online API that tells you what game title is what app id.
[Image: Syr3DlV.png]
(Apr 2, 2019 08:03 PM)gigajew Wrote:  Basically keep an online and up-to-date list of games, and cross reference it with locally installed apps. You may have to iterate through the list of installed programs in the registry to get this. And you may have to write a custom function that can pull installed app id's from Steam and pull details from an online API that tells you what game title is what app id.

Or use an already in existent service such as https://steamdb.info

[Image: DreddSig.gif]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by deluxeJun 5, 2019 03:27 PM 9 277 Jun 5, 2019 03:27 PM
Last Post: Washi
[Java] by [Rn] 7s^2May 23, 2016 02:44 AM 7 144 May 23, 2016 02:44 AM
Last Post: Captain Steve Rogers
[.NET] by xVipXApr 2, 2015 04:54 AM 3 250 Apr 2, 2015 04:54 AM
Last Post: xVipX