예제 #1
0
        public static bool getFileFromDevice(PortableDevice device, String deviceFolder, String localPath, String file)
        {
            bool status = false;

            try
            {
                String phoneDir             = deviceFolder;
                PortableDeviceFolder root   = device.Root();
                PortableDeviceFolder result = root.FindDir(phoneDir);
                if (null == result)
                {
                    //Console.Error.WriteLine(phoneDir + " no encontrado!");
                    status = false;
                }
                else
                {
                    PortableDeviceFile deviceFile = ((PortableDeviceFolder)result).FindFile(file);
                    device.TransferContentFromDevice(deviceFile, localPath, file);
                    status = true;
                }
            }
            catch (Exception)
            {
                //Console.Error.WriteLine(ex.Message);
                status = false;
            }
            return(status);
        }