private void Enumerate(ref PortableDeviceApiLib.IPortableDeviceContent pContent, string parentID, PortableDeviceContainerObject node) { PortableDeviceApiLib.IPortableDeviceProperties properties; pContent.Properties(out properties); PortableDeviceApiLib.IEnumPortableDeviceObjectIDs pEnum; pContent.EnumObjects(0, parentID, null, out pEnum); uint cFetched = 0; PortableDeviceObject current; do { string objectID; pEnum.Next(1, out objectID, ref cFetched); if (cFetched > 0) { current = this.ExtractInformation(properties, objectID); node.AddChild(current); if (current is PortableDeviceContainerObject) { Enumerate(ref pContent, objectID, (PortableDeviceContainerObject)current); } } } while (cFetched > 0); }
internal void Enumerate(ref IPortableDeviceContent pContent, string parentID, PortableDeviceContainerObject node, IObjectEnumerateHelper helper, bool detectNewObjects = false) { IPortableDeviceProperties properties; pContent.Properties(out properties); foreach (var objectID in ExtractObjectIds(pContent, parentID)) { if (detectNewObjects && ParentContainsChildsId(node, objectID)) { continue; } PortableDeviceObject current = ExtractInformation(properties, objectID); if (!helper.IsObjectMatching(current)) { continue; } node.AddChild(current); if (!helper.IsLastNode && current is PortableDeviceContainerObject) { Enumerate(ref pContent, objectID, (PortableDeviceContainerObject)current, helper.Next(), detectNewObjects); } } }