コード例 #1
0
 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);
         }
     }
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 public void Subscribe(ObservableMemoryStream s)
 {
     s.closeHandler += new ObservableMemoryStream.CloseHandler(closeStream);
 }