Skip to content

Commit

Permalink
enumerating content on a device will now set the unique persistent ID…
Browse files Browse the repository at this point in the history
… on the folder or file in addition to name and id.
  • Loading branch information
Jaran Nilsen committed Jan 2, 2013
1 parent ffb027f commit 89a4ed5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
3 changes: 3 additions & 0 deletions wpd-lib/PortableDeviceObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ namespace WindowsPortableDevicesLib.Domain
/// </summary>
public class PortableDeviceObject
{

protected PortableDeviceObject(string id, string name)
{
this.Id = id;
this.Name = name;
}

public string PersistentId { get; set; }

public string Id { get; private set; }

public string Name { get; private set; }
Expand Down
17 changes: 12 additions & 5 deletions wpd-lib/WindowsPortableDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,17 +376,24 @@ private static PortableDeviceObject WrapObject(IPortableDeviceProperties propert
0xE1, 0x77, 0x05, 0xA0, 0x5F, 0x85);
var functionalType = new Guid(0x99ED0160, 0x17FF, 0x4C44, 0x9D, 0x98,
0x1D, 0x7A, 0x6F, 0x94, 0x19, 0x21);



string uniqueID;
values.GetStringValue(DevicePropertyKeys.WPD_OBJECT_PERSISTENT_UNIQUE_ID, out uniqueID);

PortableDeviceObject deviceObject = null;

if (contentType == folderType || contentType == functionalType)
{
return new PortableDeviceFolder(uniqueID, name);
deviceObject = new PortableDeviceFolder(objectId, name);

} else {
deviceObject = new PortableDeviceFile(objectId, name);
}

return new PortableDeviceFile(uniqueID, name);

deviceObject.PersistentId = uniqueID;

return deviceObject;

}
}
}

0 comments on commit 89a4ed5

Please sign in to comment.