Ejemplo n.º 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 = 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);
        }