public override Stream OpenReadWrite() { lock (updateLock) { if (readStreams == 0 && !writeStreamOpen) { writeStreamOpen = true; _content.Position = 0; ObservableMemoryStream temp = new ObservableMemoryStream(_content, true); Subscribe(temp); return(temp); } else { return(null); } } }
public override Stream OpenReadOnly() { lock (updateLock) { if (writeStreamOpen == false) { readStreams++; var newstream = new MemoryStream(); _content.Position = 0; _content.CopyTo(newstream); newstream.Position = 0; ObservableMemoryStream temp = new ObservableMemoryStream(newstream, false); Subscribe(temp); return(temp); } return(null); } }
public void Subscribe(ObservableMemoryStream s) { s.closeHandler += new ObservableMemoryStream.CloseHandler(closeStream); }