From b31d35c456bbde96f2871aceaa8a9accb1a80fea Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Tue, 24 Jan 2017 10:59:26 -0800 Subject: [PATCH 1/4] Add an IsFolder method to FileOrFolderInformation class. --- .../Core/AppFileExplorer.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppFileExplorer.cs b/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppFileExplorer.cs index 0b155fc9..1ae2e676 100644 --- a/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppFileExplorer.cs +++ b/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppFileExplorer.cs @@ -310,6 +310,11 @@ public class FileOrFolderInformation [DataMember(Name = "FileSize")] public long SizeInBytes { get; private set; } + /// + /// Gets whether the current item is a folder + /// + public bool IsFolder { get { return this.Type == 0x10; } } + /// /// Overridden ToString method providing a user readable /// display of a file or folder. Tries to match the formatting @@ -321,7 +326,7 @@ public override string ToString() DateTime timestamp = DateTime.FromFileTime(this.DateCreated); // Check if this is a folder. - if (!string.Equals(this.SubPath, this.CurrentDir)) + if (this.IsFolder) { return string.Format("{0,-24:MM/dd/yyyy HH:mm tt}{1,-14} {2}\n", timestamp, "", this.Name); } From b09f98c61bc22ec0187baac70c3841a3d78f0d1b Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Tue, 24 Jan 2017 11:42:24 -0800 Subject: [PATCH 2/4] Updated per review feedback --- .../Core/AppFileExplorer.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppFileExplorer.cs b/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppFileExplorer.cs index 1ae2e676..e4b31f3e 100644 --- a/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppFileExplorer.cs +++ b/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppFileExplorer.cs @@ -311,9 +311,10 @@ public class FileOrFolderInformation public long SizeInBytes { get; private set; } /// - /// Gets whether the current item is a folder + /// Gets whether the current item is a folder by checking for FILE_ATTRIBUTE_DIRECTORY + /// See https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117(v=vs.85).aspx /// - public bool IsFolder { get { return this.Type == 0x10; } } + public bool IsFolder { get { return (this.Type & 0x10) == 0x10; } } /// /// Overridden ToString method providing a user readable From 09ee3825002d845279c1c4d86561f23359906323 Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Thu, 26 Jan 2017 09:17:02 -0800 Subject: [PATCH 3/4] Adds PackageOrigin to PackageInfo class. --- .../WindowsDevicePortalWrapper.Shared/Core/AppDeployment.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppDeployment.cs b/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppDeployment.cs index dc96351e..4da06ebe 100644 --- a/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppDeployment.cs +++ b/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppDeployment.cs @@ -366,6 +366,12 @@ public class PackageInfo [DataMember(Name = "Version")] public PackageVersion Version { get; private set; } + /// + /// Gets package origin + /// + [DataMember(Name = "PackageOrigin")] + public int PackageOrigin { get; private set; } + /// /// Get a string representation of the package /// From 5df1bacefa600bb09a6a2f503904b018a8118ae4 Mon Sep 17 00:00:00 2001 From: Hirsch Singhal Date: Thu, 26 Jan 2017 10:04:57 -0800 Subject: [PATCH 4/4] PackageOrigin details and helper method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quick helper method to determine if the app is sideloaded. --- .../Core/AppDeployment.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppDeployment.cs b/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppDeployment.cs index 69f551b6..8dc87504 100644 --- a/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppDeployment.cs +++ b/WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/Core/AppDeployment.cs @@ -367,11 +367,27 @@ public class PackageInfo public PackageVersion Version { get; private set; } /// - /// Gets package origin + /// Gets package origin, a measure of how the app was installed. + /// PackageOrigin_Unknown            = 0, + /// PackageOrigin_Unsigned           = 1, + /// PackageOrigin_Inbox              = 2, + /// PackageOrigin_Store              = 3, + /// PackageOrigin_DeveloperUnsigned  = 4, + /// PackageOrigin_DeveloperSigned    = 5, + /// PackageOrigin_LineOfBusiness     = 6 /// [DataMember(Name = "PackageOrigin")] public int PackageOrigin { get; private set; } + // + /// Helper method to determine if the app was sideloaded and therefore can be used with e.g. GetFolderContentsAsync + /// + /// True if the package is sideloaded. + public bool IsSideloaded() + { + return (this.PackageOrigin == 4 || this.PackageOrigin == 5); + } + /// /// Get a string representation of the package ///