示例#1
0
 public void ListenToCopier(MyStream.Copier clientSide, MyStream.Copier serverSide)
 {
     if (clientSide != null)
     {
         clientSide.OnRead += ClientData;
     }
     if (serverSide != null)
     {
         serverSide.OnRead += ServerData;
     }
 }
示例#2
0
        public MyStream.Copier CreateCopier(Adapter adapter, IMyStream myStream, bool toDest)
        {
            var dest    = Result.Stream;
            var ctrFrom = toDest ? adapter.BytesCountersRW : Result.Adapter.GetAdapter().BytesCountersRW;
            var ctrTo   = !toDest ? adapter.BytesCountersRW : Result.Adapter.GetAdapter().BytesCountersRW;
            var c       = new MyStream.Copier(toDest ? myStream : dest, !toDest ? myStream : dest)
            {
                CounterR = ctrFrom.R,
                CounterW = ctrTo.W,
                Logger   = adapter.Logger
            };

            Request.EnsureSniffer();
            Request.Sniffer.ListenToCopier(toDest ? c : null, !toDest ? null : c);
            return(c);
        }