Home > Net >  C # MTP for portable devices in the file name, path information, etc
C # MTP for portable devices in the file name, path information, etc

Time:09-27

According to the online code USES PortableDeviceApiLib. DLL can now link equipment and access the files and folders on the objectID, but don't know how to use the objectID access to the path of the file or folder name information, post objectID code, know how to get the great god please leave a message of information, file
///
///recursive enumerate device in a file or folder ID, device ID
///

///
///
///
///
Private void Enumerate (ref PortableDeviceApiLib. IPortableDeviceContent pContent, string parentID, string indent, ref List ObjectIDs)
{
Indent +="";
PortableDeviceApiLib. IEnumPortableDeviceObjectIDs pEnum;

PContent. EnumObjects (0, parentID, null, out pEnum);
Uint cFetched=0;
Do
{
String objectID;
PEnum. Next (1, out objectID, ref cFetched);
PContent. Properties

If (objectID!=null & amp; & ! The objectID. Equals (" "))
{
ObjectIDs. Add (objectID);
}

If (cFetched & gt; 0)
{
Enumerate (ref pContent, objectID, indent, ref objectIDs);
}
} while (cFetched & gt; 0);
}