示例#1
0
 /// <summary>
 /// 指定した出力ストリームを出力ストリームリストに追加します
 /// </summary>
 /// <param name="stream">追加する出力ストリーム</param>
 public void AddOutputStream(IOutputStream stream)
 {
     Utils.ReplaceCollection(ref outputStreams, orig => {
         var new_collection = new OutputStreamCollection(outputStreams);
         new_collection.Add(stream);
         return(new_collection);
     });
     if (OutputStreamsChanged != null)
     {
         OutputStreamsChanged(this, new EventArgs());
     }
 }
示例#2
0
 private void SourceStream_Stopped(object sender, EventArgs args)
 {
     syncContext.Post(dummy => {
         foreach (var os in outputStreams)
         {
             os.Stop();
         }
         outputStreams  = new OutputStreamCollection();
         startTickCount = null;
         IsClosed       = true;
         OnClosed();
     }, null);
 }
示例#3
0
 /// <summary>
 /// チャンネル接続を終了します。ソースストリームと接続している出力ストリームを全て閉じます
 /// </summary>
 public void Close()
 {
     if (!IsClosed)
     {
         if (sourceStream != null)
         {
             sourceStream.Stop();
         }
         foreach (var outputStream in outputStreams)
         {
             outputStream.Stop();
         }
         outputStreams = new OutputStreamCollection();
     }
 }
示例#4
0
        /// <summary>
        /// 指定した出力ストリームを出力ストリームリストから削除します
        /// </summary>
        /// <param name="stream">削除する出力ストリーム</param>
        public void RemoveOutputStream(IOutputStream stream)
        {
            bool removed = false;

            Utils.ReplaceCollection(ref outputStreams, orig => {
                var new_collection = new OutputStreamCollection(outputStreams);
                removed            = new_collection.Remove(stream);
                return(new_collection);
            });
            if (removed)
            {
                if (OutputStreamsChanged != null)
                {
                    OutputStreamsChanged(this, new EventArgs());
                }
            }
        }
示例#5
0
 /// <summary>
 /// 元になるコレクションを指定してReadOnlyOutputStreamCollectionを初期化します
 /// </summary>
 /// <param name="collection">元になるコレクション</param>
 public ReadOnlyOutputStreamCollection(OutputStreamCollection collection)
     : base(collection)
 {
 }