public static String ReadFromDevice(iPhone device, string path) { var fileReader = iPhoneFile.OpenRead(device, path); using (var fileStream = new StreamReader(fileReader)) { fileReader.Seek(0, SeekOrigin.Begin); while ((line = fileStream.ReadLine()) != null) { output += String.Format(line + Environment.NewLine); } return output; } }
public MainForm() { InitializeComponent(); Utils.Init(); instance = this; animateTimer.Interval = 500; animateTimer.Start(); logBox.AppendText("This is an early beta version!"); AppendTextBox("Please connect your iOS-device via USB."); iDevice = new iPhone(); iDevice.Connect += new ConnectEventHandler(onConnectHandler); iDevice.Disconnect += new ConnectEventHandler(onDisconnectHandler); }
public static bool WriteToDevice(iPhone device, string path, string[] lines) { try { var fileWriter = iPhoneFile.OpenWrite(device, path); using (var fileStream = new StreamWriter(fileWriter)) { fileWriter.Seek(0, SeekOrigin.Begin); foreach (String line in lines) { fileStream.WriteLine(line + Environment.NewLine); } return true; } } catch (Exception ex) { return false; } }
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); }
private iPhoneFile(iPhone phone, long handle, OpenMode mode) { this.phone = phone; this.mode = mode; this.handle = handle; }
public static iPhoneFile OpenWrite(iPhone phone, string path) { return Open(phone, path, FileAccess.Write); }
public static iPhoneFile OpenRead(iPhone phone, string path) { return Open(phone, path, FileAccess.Read); }
public void gimmedatdevice(iPhone device) { iDevice = device; }
public static int reverse_connection(iPhone device, int v1, int v2, IntPtr unknown) { v1 = ~v1 & v2; int result = 0x10F; return result - v1; }