PortableDevice API를 사용하여 MTP 장치 검색 및 장치 속성을 가져옵니다. 나는 스토리지의 용량과 같은 MTP 장치 저장을 얻으려면 가능한 storage.Here 내가 장치 저장 및 무료을 읽을 수 장치의 친숙한 이름이 점점 내 샘플 코드,MTP 장치를 얻는 방법 C#을 사용하여 스토리지 및 스토리지 용량을 사용할 수 있습니까?
public string FriendlyName
{
get
{
if (!this._isConnected)
{
throw new InvalidOperationException("Not connected to device.");
}
// Retrieve the properties of the device
IPortableDeviceContent content;
IPortableDeviceProperties properties;
this._device.Content(out content);
content.Properties(out properties);
// Retrieve the values for the properties
IPortableDeviceValues propertyValues;
properties.GetValues("DEVICE", null, out propertyValues);
// Identify the property to retrieve
var property = new _tagpropertykey();
property.fmtid = new Guid(0x26D4979A, 0xE643, 0x4626, 0x9E, 0x2B,
0x73, 0x6D, 0xC0, 0xC9, 0x2F, 0xDC);
property.pid = 12;
// Retrieve the friendly name
string propertyValue;
propertyValues.GetStringValue(ref property, out propertyValue);
return propertyValue;
}
}
같은 방법입니다 MTP 장치의 공간.
나는이 같은 시도,하지만 난
IPortableDeviceKeyCollection keys;
properties.GetSupportedProperties(objectId, out keys);
IPortableDeviceValues values;
properties.GetValues(objectId, keys, out values);
// Get the name of the object
string name;
var property = new _tagpropertykey();
property.fmtid = new Guid(0x01A3057A, 0x74D6, 0x4E80, 0xBE, 0xA7, 0xDC, 0x4C, 0x21, 0x2C, 0xE5, 0x0A);
property.pid = 7;
values.GetStringValue(property, out name);
// Get the type of the object
Guid contentType;
property = new _tagpropertykey();
property.fmtid = new Guid(0x01A3057A, 0x74D6, 0x4E80, 0xBE, 0xA7, 0xDC, 0x4C, 0x21, 0x2C, 0xE5, 0x0A);
property.pid = 5;
values.GetGuidValue(property, out contentType);
var storageType = new Guid(0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C);
var functionalType = new Guid(0x8F052D93, 0xABCA, 0x4FC5, 0xA5, 0xAC, 0xB0, 0x1D, 0xF4, 0xDB, 0xE5, 0x98);
을 어떤 것을 잃었 ........................... ........... ...................................
미리 감사드립니다.