Пример #1
0
        // TODO: MOVE THIS INTO IPHONE CLASS
        public static void CopyFileFromDevice(iPhone iDeviceInterface, string source, string destination, Action<ulong> bytesTransfered, Func<bool> cancelled)
        {
            // remove our local file if it exists
            if (File.Exists(destination))
            {
                File.Delete(destination);
            }

            // make sure the source file exists
            if (iDeviceInterface.Exists(source))
            {
                using (iPhoneFile from = iPhoneFile.OpenRead(iDeviceInterface, source))
                using (FileStream to = File.OpenWrite(destination))
                {
                    Utilities.Copy(from, to, bytesTransfered, cancelled);
                }
            }
        }
Пример #2
0
        public static void CopyFileToDevice(iPhone iDeviceInterface, string source, string destination, Action<ulong> bytesTransfered, Func<bool> cancelled)
        {
            if (source.Equals("Thumbs.db") || source.Equals(".DS_Store"))
            {
                return;
            }

            // if it already exists
            if (iDeviceInterface.Exists(destination))
            {
                // TODO: DO SOMETHING WHEN THE FILE ALREADY EXISTS
            }

            if (File.Exists(source))
            {
                using (FileStream from = File.OpenRead(source))
                using (iPhoneFile to = iPhoneFile.OpenWrite(iDeviceInterface, destination))
                {
                    Utilities.Copy(from, to, bytesTransfered, cancelled);
                }
            }
        }