// PC --> iPhone private void sendFile(string source, string dest) { iDevice.DeleteFile(dest); //it automaticly checks if file exists then deletes using (FileStream readStream = File.OpenRead(source)) using (var iFile = iPhoneFile.OpenWrite(iDevice, dest)) { byte[] buffer = new Byte[2048]; int bytesRead; while ((bytesRead = readStream.Read(buffer, 0, 2048)) > 0) { iFile.Write(buffer, 0, bytesRead); } } }
public override NT_STATUS Delete(UserContext UserContext, string FileName) { NT_STATUS error = NT_STATUS.OK; string OriginalName = root + FileName; Debug.WriteLine("Info->File '" + FileName + "' with full path '" + OriginalName + "' is being deleted."); try { if (!phone.Exists(OriginalName) || phone.IsDirectory(OriginalName)) { return(NT_STATUS.OBJECT_NAME_NOT_FOUND); } phone.DeleteFile(OriginalName); } catch (Exception e) { Trace.WriteLine("Warning->Exception in Delete:" + e.Message); error = (NT_STATUS)Marshal.GetHRForException(e); // ERROR_READ_FAULT } return(error); }