Example #1
0
        private static PortableDeviceFolder GetMtpFolder(PortableDevice mtpDevice, string path)
        {
            if (mtpDevice == null)
            {
                return(null);
            }
            var mtpFolder =
                mtpDevice.GetObject(path.Replace(MtpPathInterpreter.GetMtpDeviceName(path), string.Empty)) as
                PortableDeviceFolder;

            if (mtpFolder == null)
            {
                mtpDevice.Disconnect();
            }
            return(mtpFolder);
        }