Esempio n. 1
0
        public static List<ChangeItem> Compare(ICloudProvider localProvider, ICloudProvider cloudProvider, PipelineDirections direction)
        {
            var pares = GetPares(localProvider, cloudProvider);

            List<ChangeItem> changeset = new List<ChangeItem>();

            foreach (var pare in pares)
            {
                var compare = pare.Compare;
                if (compare < 0 && direction != PipelineDirections.Backup)
                {
                    var changeItem = new UpdateItem();
                    changeItem.Item = pare.CloudFile;
                    changeItem.Target = localProvider;
                    changeItem.Source = cloudProvider;
                    changeset.Add(changeItem);
                }
                if (compare > 0 && direction != PipelineDirections.Restore)
                {
                    var changeItem = new UpdateItem();
                    changeItem.Item = pare.LocalFile;
                    changeItem.Target = cloudProvider;
                    changeItem.Source = localProvider;
                    changeset.Add(changeItem);
                }
            }
            return changeset;
        }
Esempio n. 2
0
 private void UpdateItem(UpdateItem changeItem)
 {
     using (var stream = changeItem.Source.Read(changeItem.Item, (item, type, pos, size) => {
         if (processRecordManager != null)
             processRecordManager.UpdateProcessRecord(item, type, (int)(pos * 100 / size));
     }))
     {
         changeItem.Target.Write(changeItem.Item, stream, (item, type, pos, size) =>
         {
             if (processRecordManager != null)
                 processRecordManager.UpdateProcessRecord(item, type, (int)(pos * 100 / size));
         });
     }
 }