コード例 #1
0
        private void NextFile()
        {
            if (_currFileId >= 0)
            {
                _uploadStream.Dispose();
            }

            _currFileId++;
            if (_currFileId >= _files.Count)
            {
                return;
            }

            _bytesWrote = 0;
            var currFile = _files[_currFileId];

            _uploadStream = new UploadStream(currFile.FullPath, _cloud, currFile.Size);
        }
コード例 #2
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (!disposing)
            {
                return;
            }

            _uploadStream?.Close();

            if (_files.Count > 1)
            {
                string content = $"filename={_origfile.Name}\r\nsize = {_origfile.Size.DefaultValue}";
                var    data    = Encoding.UTF8.GetBytes(content);
                using (var stream = new UploadStream(_origfile.FullPath, _cloud, data.Length))
                {
                    stream.Write(data, 0, data.Length);
                }
            }

            OnFileUploaded(_files);
        }