Ejemplo n.º 1
0
        private void OnDeserializedCallback(StreamingContext context)
        {
            // Constructors and field initializers are not called by DCS, so initialize things here
            progressUpdateLock             = new ReaderWriterLockSlim();
            lockEnumerateContinuationToken = new object();
            EnumerationWaitTimeOut         = TimeSpan.FromSeconds(10);

            if (!IsStreamJournal)
            {
                this.subTransfers = this.serializeSubTransfers;
            }
            else
            {
                this.subTransfers = new TransferCollection <SingleObjectTransfer>();
            }

            this.subTransfers.OverallProgressTracker.Parent = this.ProgressTracker;

            // DataContractSerializer doesn't invoke object's constructor, we should initialize member variables here.
            shouldTransferQueue
                = new TaskQueue <Tuple <SingleObjectTransfer, TransferEntry> >(TransferManager.Configurations.ParallelOperations * Constants.ListSegmentLengthMultiplier);
        }
        /// <summary>
        /// Gets a static snapshot of this transfer checkpoint
        /// </summary>
        /// <returns>A snapshot of current transfer checkpoint</returns>
        public TransferCollection Copy()
        {
            TransferCollection copyObj = new TransferCollection();

            foreach (var kv in this.transfers)
            {
                SingleObjectTransfer transfer = kv.Value as SingleObjectTransfer;
                if (transfer != null)
                {
                    copyObj.AddTransfer(transfer.Copy());
                    continue;
                }

                DirectoryTransfer transfer2 = kv.Value as DirectoryTransfer;
                if (transfer2 != null)
                {
                    copyObj.AddTransfer(transfer2.Copy());
                    continue;
                }
            }

            return(copyObj);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultipleObjectsTransfer"/> class.
 /// </summary>
 /// <param name="source">Transfer source.</param>
 /// <param name="dest">Transfer destination.</param>
 /// <param name="transferMethod">Transfer method, see <see cref="TransferMethod"/> for detail available methods.</param>
 public MultipleObjectsTransfer(TransferLocation source, TransferLocation dest, TransferMethod transferMethod)
     : base(source, dest, transferMethod)
 {
     this.subTransfers = new TransferCollection <SingleObjectTransfer>();
     this.subTransfers.OverallProgressTracker.Parent = this.ProgressTracker;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MultipleObjectsTransfer"/> class.
 /// </summary>
 /// <param name="info">Serialization information.</param>
 /// <param name="context">Streaming context.</param>
 protected MultipleObjectsTransfer(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     this.enumerateContinuationToken = (SerializableListContinuationToken)info.GetValue(ListContinuationTokenName, typeof(SerializableListContinuationToken));
     this.subTransfers = (TransferCollection)info.GetValue(SubTransfersName, typeof(TransferCollection));
     this.subTransfers.OverallProgressTracker.Parent = this.ProgressTracker;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MultipleObjectsTransfer"/> class.
 /// </summary>
 /// <param name="source">Transfer source.</param>
 /// <param name="dest">Transfer destination.</param>
 /// <param name="transferMethod">Transfer method, see <see cref="TransferMethod"/> for detail available methods.</param>
 public MultipleObjectsTransfer(TransferLocation source, TransferLocation dest, TransferMethod transferMethod)
     : base(source, dest, transferMethod)
 {
     this.subTransfers = new TransferCollection();
     this.subTransfers.OverallProgressTracker.Parent = this.ProgressTracker;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="MultipleObjectsTransfer"/> class.
        /// </summary>
        /// <param name="other">Another <see cref="MultipleObjectsTransfer"/> object.</param>
        protected MultipleObjectsTransfer(MultipleObjectsTransfer other)
            : base(other)
        {
            lock (other.lockEnumerateContinuationToken)
            {
                // copy enumerator
                this.enumerateContinuationToken = other.enumerateContinuationToken;

                // copy transfers
                this.subTransfers = other.subTransfers.Copy();
            }

            this.subTransfers.OverallProgressTracker.Parent = this.ProgressTracker;
        }
        /// <summary>
        /// Gets a static snapshot of this transfer checkpoint
        /// </summary>
        /// <returns>A snapshot of current transfer checkpoint</returns>
        public TransferCollection Copy()
        {
            TransferCollection copyObj = new TransferCollection();
            foreach (var kv in this.transfers)
            {
                SingleObjectTransfer transfer = kv.Value as SingleObjectTransfer;
                if (transfer != null)
                {
                    copyObj.AddTransfer(transfer.Copy());
                    continue;
                }

                DirectoryTransfer transfer2 = kv.Value as DirectoryTransfer;
                if (transfer2 != null)
                {
                    copyObj.AddTransfer(transfer2.Copy());
                    continue;
                }
            }

            return copyObj;
        }