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, 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)); }
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, 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); }
/// <summary> /// Opens an iPhoneFile stream on the specified path /// </summary> /// <param name="phone">A valid iPhone object</param> /// <param name="path">The file to open</param> /// <param name="openmode">A <see cref="FileAccess"/> value that specifies the operations that can be performed on the file</param> /// <returns></returns> unsafe public static iPhoneFile Open(iPhone phone, string path, FileAccess openmode) { OpenMode mode; int ret; long handle; string full_path; mode = OpenMode.None; switch (openmode) { case FileAccess.Read: mode = OpenMode.Read; break; case FileAccess.Write: mode = OpenMode.Write; break; case FileAccess.ReadWrite: throw new NotImplementedException("Read+Write not (yet) implemented"); } full_path = phone.FullPath(phone.CurrentDirectory, path); ret = MobileDevice.AFCFileRefOpen(phone.AFCHandle, full_path, (int)mode, 0, out handle); if (ret != 0) { phone.ReConnect(); throw new IOException("AFCFileRefOpen failed with error " + ret.ToString()); } return(new iPhoneFile(phone, handle, mode)); }
/// <summary> /// Opens an iPhoneFile stream on the specified path /// </summary> /// <param name="phone">A valid iPhone object</param> /// <param name="path">The file to open</param> /// <param name="openmode">A <see cref="FileAccess"/> value that specifies the operations that can be performed on the file</param> /// <returns></returns> public static unsafe iPhoneFile Open(iPhone phone, string path, FileAccess openmode) { OpenMode mode; int ret; long handle; string full_path; mode = OpenMode.None; switch (openmode) { case FileAccess.Read: mode = OpenMode.Read; break; case FileAccess.Write: mode = OpenMode.Write; break; case FileAccess.ReadWrite: throw new NotImplementedException("Read+Write not (yet) implemented"); } full_path = phone.FullPath(phone.CurrentDirectory, path); ret = MobileDevice.AFCFileRefOpen(phone.AFCHandle, full_path, (int)mode, 0, out handle); if (ret != 0) { phone.ReConnect(); throw new IOException("AFCFileRefOpen failed with error " + ret.ToString()); } return new iPhoneFile(phone, handle, mode); }