根據網上代碼使用 PortableDeviceApiLib.dll現在已經可以鏈接上設備并獲取了檔案與檔案夾的objectID,但是不知道如何使用objectID獲取檔案或者檔案夾的路徑名稱資訊,貼出獲取objectid的代碼,知道如何獲取檔案資訊的大神請留言。
/// <summary>
///遞回 列舉出設備中的檔案或檔案夾ID、設備ID
/// </summary>
/// <param name="pContent"></param>
/// <param name="parentID"></param>
/// <param name="indent"></param>
/// <param name="objectIDs"></param>
private void Enumerate(ref PortableDeviceApiLib.IPortableDeviceContent pContent, string parentID, string indent, ref List<string> 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 && !objectID.Equals(""))
{
objectIDs.Add(objectID);
}
if (cFetched > 0)
{
Enumerate(ref pContent, objectID, indent, ref objectIDs);
}
} while (cFetched > 0);
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/90694.html
標籤:ASP.NET
