Need to detect installed MS store apps and create corresponding game-id and get possible meta data including pictures.

Sachi 221 Reputation points
2022-01-31T11:45:50.783+00:00

Hi
I need to detect installed MS store apps and create corresponding game-id and get possible meta data including pictures using c#.
can you please suggest me.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,648 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 83,206 Reputation points
    2022-01-31T13:41:40.877+00:00

    Store apps are installed in "C:\Program Files\WindowsApps"
    You can list them but I don't see how to identify games (also "shell:Games" has been removed)

    To list apps :

    // Add reference to : "C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd"
    

    Add at beginning :

    using Windows.Management.Deployment;
    

    Test :

    // Needs "requireAdministrator" in Manifest file
    PackageManager packageManager = new PackageManager();
    IEnumerable<Windows.ApplicationModel.Package> packages = packageManager.FindPackages();
    int nCpt = 0;
    foreach (var package in packages)
    {
        try
        {
            string sInstalledLocation = package.InstalledLocation.Path;
            string sSignatureKind = package.SignatureKind.ToString();
            if (sInstalledLocation.Contains("WindowsApps") && sSignatureKind == "Store" && package.IsFramework == false)
            {
                Console.WriteLine("Package n°{0}", nCpt);
                //Console.WriteLine("\tId Name {0}", package.Id.Name);
                Console.WriteLine("\tDisplay Name : {0}", package.DisplayName);
                Console.WriteLine("\tFamily : {0}", package.Id.FamilyName);
                Console.WriteLine("\tLogo : {0}", package.Logo.ToString());
                nCpt += 1;
            }                   
        }
        catch (System.Exception ex)
        {
        } 
    }
    

0 additional answers

Sort by: Most helpful