Esempio n. 1
0
        public static unsafe iPhoneFile Open(iPhone phone, string path, FileAccess openmode)
        {
            long     num;
            OpenMode none = OpenMode.None;

            switch (openmode)
            {
            case FileAccess.Read:
                none = OpenMode.Read;
                break;

            case FileAccess.Write:
                none = OpenMode.Write;
                break;

            case FileAccess.ReadWrite:
                throw new NotImplementedException("Read+Write not (yet) implemented");
            }
            string str  = phone.FullPath(phone.GetCurrentDirectory(), path);
            int    num2 = MobileDevice.AFCFileRefOpen(phone.AFCHandle, str, (int)none, 0, out num);

            if (num2 != 0)
            {
                throw new IOException("AFCFileRefOpen failed with error " + num2.ToString());
            }
            return(new iPhoneFile(phone, num, none));
        }
Esempio n. 2
0
        public static unsafe iPhoneFile Open(iPhone phone, string path, FileAccess openmode)
        {
            long     num2;
            OpenMode none = OpenMode.None;

            switch (openmode)
            {
            case FileAccess.Read:
                none = OpenMode.Read;
                break;

            case FileAccess.Write:
                none = OpenMode.Write;
                break;

            case FileAccess.ReadWrite:
                throw new NotImplementedException("Read+Write not (yet) implemented");
            }
            string str = phone.FullPath(phone.CurrentDirectory, path);
            int    num = MobileDevice.AFCFileRefOpen(phone.AFCHandle, System.Text.Encoding.UTF8.GetBytes(str), (int)none, 0, out num2);

            if (num != 0)
            {
                phone.ReConnect();
                throw new IOException("AFCFileRefOpen failed with error " + num.ToString());
            }
            return(new iPhoneFile(phone, num2, none));
        }