77using System . Threading . Tasks ;
88using System . Xml ;
99using System . Xml . Serialization ;
10+ using Windows . ApplicationModel ;
1011
1112namespace AutoHDR . UWP
1213{
@@ -15,29 +16,34 @@ public class UWPApp
1516 public string Name { get ; private set ; } = string . Empty ;
1617 public string Executable { get ; private set ; } = string . Empty ;
1718 public string InstallLocation { get ; private set ; } = string . Empty ;
19+ public string FamilyPackageName { get ; private set ; } = string . Empty ;
20+ public string ApplicationID { get ; private set ; } = string . Empty ;
1821
19- public string StartArguments { get ; private set ; } = string . Empty ;
22+ public string IconPath { get ; private set ; } = string . Empty ;
2023
2124
25+ private UWPApp ( )
26+ {
2227
28+ }
2329
24- public UWPApp ( string installLocation , bool isBundle )
30+ public UWPApp ( Package package )
2531 {
26- InstallLocation = installLocation ;
27- ReadAppxManifest ( isBundle ) ;
32+ ReadAppxManifest ( package ) ;
2833 }
2934
30- private void ReadAppxManifest ( bool isBundle )
35+ private void ReadAppxManifest ( Package package )
3136 {
3237 string appxManifestPath ;
33- if ( isBundle )
38+ if ( package . IsBundle )
3439 {
3540 appxManifestPath = @"AppxMetadata\AppxBundleManifest.xml" ;
3641 }
3742 else
3843 {
3944 appxManifestPath = "AppxManifest.xml" ;
4045 }
46+ InstallLocation = package . InstalledLocation . Path ;
4147 appxManifestPath = Path . Combine ( InstallLocation , appxManifestPath ) ;
4248 Tools . Logs . Add ( $ "Retrieving data of UWP app ({ appxManifestPath } )", false ) ;
4349 try
@@ -50,6 +56,9 @@ private void ReadAppxManifest(bool isBundle)
5056 Executable = string . Empty ;
5157 if ( appxManifest . Applications != null && appxManifest . Applications . Application != null )
5258 Executable = appxManifest . Applications . Application . Executable ;
59+ FamilyPackageName = package . Id . FamilyName ;
60+ ApplicationID = appxManifest . Applications . Application . Id ;
61+ IconPath = Path . Combine ( InstallLocation , ( ( XmlNode [ ] ) ( appxManifest . Properties . Logo ) ) [ 0 ] . Value ) ;
5362 }
5463 }
5564 catch ( Exception ex )
0 commit comments