예제 #1
0
        public ByteArrayBlockWriter OpenUploadHere(FSItem item)
        {
            Log.Trace($"Upload from Shell");
            var result = new ByteArrayBlockWriter();

            result.OnClose = async() =>
            {
                var bytes = result.Content.ToArray();
                var str   = Encoding.UTF8.GetString(bytes);
                var list  = JsonConvert.DeserializeObject <CloudDokanNetUploadHereInfo>(str);
                try
                {
                    await MakeUploads(item, list.Files);
                }
                catch (Exception ex)
                {
                    Log.Error($"UploadHere error: {ex}");
                    throw;
                }
            };
            return(result);
        }
예제 #2
0
        public ByteArrayBlockWriter OpenUploadHere(FSItem item)
        {
            Log.Trace("Upload from Shell");
            var result = new ByteArrayBlockWriter();

            result.OnClose = () =>
            {
                try
                {
                    var bytes = result.Content.ToArray();
                    var str   = Encoding.UTF8.GetString(bytes);
                    var list  = JsonConvert.DeserializeObject <CloudDokanNetUploadHereInfo>(str);
                    Task.Factory.StartNew(async() => await MakeUploads(item, list.Files), TaskCreationOptions.LongRunning);
                    return(Task.FromResult(0));
                }
                catch (Exception ex)
                {
                    Log.Error("UploadHere error", ex);
                    throw;
                }
            };
            return(result);
        }