public void Write(MtStreamWritingContext ctx, byte[] stuff) { #if DEBUG && !SILVERLIGHT Debug.Print("Write"); #endif try { AsyncCallback wroteCallback = null; wroteCallback = r => { _stream.EndWrite(r); ctx._position += stuff.Length; }; // Put cursor in the right place //_stream.Position = ctx._position; // TODO Fix this, for now ignore (assume cursor on the right place) #if DEBUG && !SILVERLIGHT MultiTasksRuntime.DebugDisplayInfo(); #endif _stream.BeginWrite(stuff, 0, stuff.Length, wroteCallback, null); } catch (Exception e) { throw new Exception("Exception on Stream.write", e); } }
public MtStreamWritingContext CreateWritingContext() { if (!_stream.CanWrite) { throw new Exception("You can't write in this stream!"); } var w = new MtStreamWritingContext(0); return w; }
public MtStreamWritingContext CreateWritingContext() { if (!_stream.CanWrite) { throw new Exception("You can't write in this stream!"); } var w = new MtStreamWritingContext(0); return(w); }
public void Write(MtStreamWritingContext ctx, byte[] stuff, Action doneCallback) { #if DEBUG && !SILVERLIGHT Debug.Print("Write"); #endif try { AsyncCallback wroteCallback = null; wroteCallback = r => { _stream.EndWrite(r); ctx._position += stuff.Length; doneCallback(); }; // Put cursor in the right place _stream.Position = ctx._position; #if DEBUG && !SILVERLIGHT MultiTasksRuntime.DebugDisplayInfo(); #endif _stream.BeginWrite(stuff, 0, stuff.Length, wroteCallback, null); } catch (Exception e) { throw new Exception("Exception on Stream.write", e); } }