Пример #1
0
        /// <inheritdoc/>
        public object Clone()
        {
            var c = (IDataStream)innerStream.Clone();

            if (object.ReferenceEquals(c, innerStream))
            {
                return(this);
            }
            return(new MaskedStream(mask, c));
        }
Пример #2
0
        /// <inheritdoc/>
        public object Clone()
        {
            var o = (IDataStream)innerStream.Clone();

            // test immutability
            if (object.ReferenceEquals(o, innerStream))
            {
                return(this);
            }
            return(new ChunkedStream(o, chunkSize));
        }
Пример #3
0
        /// <inheritdoc/>
        public object Clone()
        {
            var tmp = (IDataStream)innerStream.Clone();

            // test immutability
            if (object.ReferenceEquals(tmp, innerStream))
            {
                return(this);
            }
            return(new LazyLoggedFile(tmp));
        }
Пример #4
0
        public object Clone()
        {
            IDataStream nd = null;
            ICloneable  ns = null;

            if (Data != null)
            {
                nd = (IDataStream)Data.Clone();
            }
            if (State != null)
            {
                ns = (ICloneable)ns.Clone();
            }
            return(new DataEventArgs {
                Data = nd, State = ns
            });
        }
Пример #5
0
 /// <summary>
 /// Add stream to the end of the list
 /// </summary>
 /// <param name="s">stream</param>
 public void Add(IDataStream s)
 {
     if (frozen)
     {
         throw new InvalidOperationException("StreamList is frozen!");
     }
     s = (IDataStream)s.Clone();
     streamsLock.EnterWriteLock();
     try
     {
         streams.Add(s);
         Interlocked.Add(ref length, s.Length);
     }
     finally
     {
         streamsLock.ExitWriteLock();
     }
 }
Пример #6
0
 /// <summary>
 /// Appends data to builded stream
 /// </summary>
 /// <remarks>
 /// With large lengthThreshold it will take a while to create the LoggedFile.
 /// </remarks>
 /// <param name="data"></param>
 /// <exception cref="ArgumentNullException">data</exception>
 public void Append(IDataStream data)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     if (length >= threshold)
     {
         fileBuilder.Append(data);
     }
     else if (length + data.Length >= threshold)
     {
         fileBuilder = logger.CreateFileBuilder();
         fileBuilder.Append(list);
         fileBuilder.Append(data);
         list = null;
     }
     else
     {
         list.Add((IDataStream)data.Clone());
     }
     length += data.Length;
 }