Commit 0e24f5df authored by Jason Williams's avatar Jason Williams Committed by Hirsch Singhal
Browse files

Add an IsFolder method to FileOrFolderInformation class. (#207)

* Add an IsFolder method to FileOrFolderInformation class.

* Updated per review feedback
parent 4be37572
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -310,6 +310,12 @@ namespace Microsoft.Tools.WindowsDevicePortal
            [DataMember(Name = "FileSize")]
            public long SizeInBytes { get; private set; }

            /// <summary>
            /// 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
            /// </summary>
            public bool IsFolder { get { return (this.Type & 0x10) == 0x10; } }

            /// <summary>
            /// Overridden ToString method providing a user readable
            /// display of a file or folder. Tries to match the formatting
@@ -321,7 +327,7 @@ namespace Microsoft.Tools.WindowsDevicePortal
                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, "<DIR>", this.Name);
                }