示例#1
0
        public void Execute(SMBFileShare smbFileShare, Progress progress)
        {
            using var srcStream = smbFileShare.OpenRead(Item.Path);
            using var dstStream = smbFileShare.OpenWrite(DstPath);
            int bufferSize = (int)Math.Min(smbFileShare.MaxReadSize, smbFileShare.MaxWriteSize);

            srcStream.CopyTo(dstStream, bufferSize, progress);
            progress.Report(1);
        }
        public void Execute(SMBFileShare smbFileShare, Progress progress)
        {
            int bufferSize = (int)smbFileShare.MaxWriteSize;

            using var fileStream = File.OpenRead();
            using var dstStream  = smbFileShare.OpenWrite(DstPath);
            fileStream.CopyTo(dstStream, bufferSize, progress);
            progress.Report(1);
        }
        public void Execute(SMBFileShare smbFileShare, Progress?progress = null)
        {
            if (File.Exists(DstPath))
            {
                throw new IOException($"{DstPath} already exists");
            }
            int bufferSize = (int)smbFileShare.MaxReadSize;

            using var srcStream = smbFileShare.OpenRead(SMBItem.Path);
            using var dstStream = File.OpenWrite(DstPath);
            dstStream.SetLength(0);
            dstStream.Position = 0;
            srcStream.CopyTo(dstStream, bufferSize, progress);
            progress?.Report(1);
        }
示例#4
0
 public void Execute(SMBFileShare smbFileShare, Progress progress)
 {
     Directory.CreateDirectory(Path);
     progress.Report(ProgressAmount);
 }
示例#5
0
 public UploadTask(SMBFileShare smbFileShare, IEnumerable <FileSystemInfo> fileSystemItems, string dstPath) : base(smbFileShare)
 {
     this.fileSystemItems = fileSystemItems;
     this.dstPath         = dstPath;
 }
示例#6
0
 public CopyTask(SMBFileShare smbFileShare, IEnumerable <SMBItem> items, string dstPath) : base(smbFileShare)
 {
     this.items   = items;
     this.dstPath = dstPath;
 }
示例#7
0
 protected TaskBase(SMBFileShare smbFileShare)
 {
     this.smbFileShare = smbFileShare;
 }