11using System . Collections . Generic ;
22using System . IO ;
33using System . Linq ;
4+ using System . Threading ;
45using System . Xml ;
56using System . Xml . Serialization ;
67using WereDev . Utils . Wu10Man . Core . Interfaces . Providers ;
@@ -31,7 +32,6 @@ public PackageInfo[] ListInstalledPackages()
3132 var packageInfo = new PackageInfo
3233 {
3334 InstallLocation = package . InstalledLocation . Path ,
34- PackageFullName = package . Id . FullName ,
3535 PackageName = package . Id . Name ,
3636 } ;
3737 packageInfoList . Add ( packageInfo ) ;
@@ -40,46 +40,16 @@ public PackageInfo[] ListInstalledPackages()
4040 return packageInfoList . ToArray ( ) ;
4141 }
4242
43- public string GetLogoUrl ( PackageInfo packageInfo )
43+ public void RemovePackage ( string packageName )
4444 {
45- return string . Empty ;
46- }
47-
48- private string GetLogoUrl ( string packagePath )
49- {
50- var manifest = GetAppManifest ( packagePath ) ;
51- var manifestIconPath = Path . Combine ( packagePath , manifest . Properties . Logo ) ;
52-
53- var iconDirectory = Path . GetDirectoryName ( manifestIconPath ) ;
54- var iconFileName = Path . GetFileNameWithoutExtension ( manifestIconPath ) + ".scale-100." + Path . GetExtension ( manifestIconPath ) ;
55- var iconPath = Path . Combine ( iconDirectory , iconFileName ) ;
56- return iconPath ;
57- }
58-
59- private Package GetAppManifest ( string packagePath )
60- {
61-
62-
63- var manifestPath = Path . Combine ( packagePath , "AppxManifest.xml" ) ;
64- var xDoc = new XmlDocument ( ) ;
65-
66- xDoc . Load ( manifestPath ) ;
67-
68- var xNodeReader = new XmlNodeReader ( xDoc . DocumentElement ) ;
69-
70- var xmlSerializer = new XmlSerializer ( typeof ( Package ) ) ;
71-
72- var employeeData = xmlSerializer . Deserialize ( xNodeReader ) ;
73-
74- Package deserializedEmployee = ( Package ) employeeData ;
75-
76- return deserializedEmployee ;
77- }
78-
79- public void RemovePackage ( string packageFullName )
80- {
81- var task = _packageManager . RemovePackageAsync ( packageFullName , RemovalOptions . RemoveForAllUsers ) ;
82- var results = task . GetResults ( ) ;
45+ var package = _packageManager . FindPackage ( packageName ) ;
46+ var installerInfo = package . GetAppInstallerInfo ( ) ;
47+
48+ //var task = _packageManager.RemovePackageAsync(packageFullName, RemovalOptions.RemoveForAllUsers);
49+ //var completed = new AutoResetEvent(false);
50+ //task.Completed = (waitResult, status) => { completed.Set(); } ;
51+ //completed.WaitOne();
52+ //var result = task.GetResults();
8353 }
8454 }
8555}
0 commit comments