예제 #1
0
        public NewFileBlockWriter OpenNew(FSItem item)
        {
            var path   = Path.Combine(cachePath, item.Id);
            var result = new NewFileBlockWriter(item, path);

            result.OnClose = async() =>
            {
                if (!result.Cancelled)
                {
                    await AddUpload(item);
                }
            };

            return(result);
        }
예제 #2
0
        public NewFileBlockWriter OpenTruncate(FSItem item)
        {
            var path   = Path.Combine(cachePath, item.Id);
            var result = new NewFileBlockWriter(item, path);

            result.SetLength(0);
            result.OnClose = async() =>
            {
                if (!result.Cancelled)
                {
                    await AddOverwrite(item);
                }
            };

            return(result);
        }