示例#1
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);
        }
示例#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));
        }