private static void EnumerateContents(ref IPortableDeviceContent content, PortableDeviceFolder parent)
        {
            IPortableDeviceProperties    portableDeviceProperty;
            IEnumPortableDeviceObjectIDs enumPortableDeviceObjectId;
            string str;

            content.Properties(out portableDeviceProperty);
            content.EnumObjects(0, parent.Id, null, out enumPortableDeviceObjectId);
            uint num = 0;

            do
            {
                enumPortableDeviceObjectId.Next(1, out str, ref num);
                if (num <= 0)
                {
                    continue;
                }
                PortableDeviceObject portableDeviceObject = WrapObject(portableDeviceProperty, str);

                parent.Files.Add(portableDeviceObject);

                if (!(portableDeviceObject is PortableDeviceFolder))
                {
                    continue;
                }

                EnumerateContents(ref content, (PortableDeviceFolder)portableDeviceObject);
            }while (num > 0);
        }
        public PortableDeviceFolder GetContents()
        {
            IPortableDeviceContent portableDeviceContent;

            PortableDeviceFolder portableDeviceFolder = new PortableDeviceFolder("DEVICE", "DEVICE");

            this._device.Content(out portableDeviceContent);
            EnumerateContents(ref portableDeviceContent, portableDeviceFolder);

            return(portableDeviceFolder);
        }