Exemplo n.º 1
0
 private void Delete(string relativeDestFilePath)
 {
     if (!_appConfig.KeepRemovedFilesInDest)
     {
         _fileDeleter.Delete(_destFileSystem, relativeDestFilePath);
     }
 }
Exemplo n.º 2
0
        public async Task Run(
            [ActivityTrigger] IDurableActivityContext context)
        {
            _correlationInitializer.Initialize(context.InstanceId);

            var command = context.GetInput <DeleteFileCommand>();
            await _fileDeleter.Delete(command.ContainerName, command.FileName);
        }
Exemplo n.º 3
0
 internal void Delete()
 {
     try
     {
         _fileDeleter.Delete(FullPathAndFileName);
         DeletedOk = true;
     }
     catch (Exception ex)
     {
         DeletedOk    = false;
         ErrorMessage = ex.Message;
     }
 }
Exemplo n.º 4
0
 public void Merge(IFileSystem srcFileSystem, IFileSystem destFileSystem, string srcFilePath, string destFilePath)
 {
     _fileDeleter.Delete(destFileSystem, destFilePath);
     _fileCopier.Copy(srcFileSystem, destFileSystem, srcFilePath, destFilePath);
 }
Exemplo n.º 5
0
 public async Task Run(
     [ActivityTrigger] IDurableActivityContext context)
 {
     var command = context.GetInput <DeleteFileCommand>();
     await _fileDeleter.Delete(command.ContainerName, command.FileName);
 }
Exemplo n.º 6
0
        public async void StartUpload()
        {
            if (string.IsNullOrEmpty(FileName))
            {
                MessageBox.Show("Please enter a file name");
                return;
            }


            try
            {
                CurrentState = State.Working;
                ErrorText    = "";
                _cancelToken = new CancellationTokenSource();
                var uploadProgress = new Progress <UploadProgress>(up =>
                {
                    UploadProgress = up.PercentComplete;
                    UploadRate     = up.BitsPerSecond;
                });
                var encodeProgress = new Progress <EncodeProgress>(ep =>
                {
                    EncodeProgress = ep.PercentComplete;
                    EncodeFps      = ep.FramesPerSecond;
                });

                if (IsMultiClip)
                {
                    YouTubeId = await _clipCreator.ClipAndUpload(VideoFiles.Select(vf => vf.File).ToList(),
                                                                 $"{SafeFileName}.mp4",
                                                                 SelectedEncoder,
                                                                 ForceWideScreen,
                                                                 SelectedDestination,
                                                                 encodeProgress,
                                                                 uploadProgress, _cancelToken.Token);
                }
                else
                {
                    YouTubeId = await _clipCreator.ClipAndUpload(OriginalFile.FullName, $"{SafeFileName}.mp4",
                                                                 Timelines,
                                                                 SelectedEncoder,
                                                                 ForceWideScreen,
                                                                 SelectedDestination,
                                                                 encodeProgress,
                                                                 uploadProgress, _cancelToken.Token);
                }


                CurrentState = State.Done;
                if (!DeleteOnSuccess)
                {
                    return;
                }
                if (!IsMultiClip)
                {
                    await _fileDeleter.Delete(OriginalFile);
                }
                else
                {
                    foreach (var video in VideoFiles)
                    {
                        await _fileDeleter.Delete(video.File);
                    }
                }
            }
            catch (Exception e)
            {
                CurrentState = State.Error;
                Console.Write(e);
                ErrorText = $"Error: {e.Message}";
            }
            finally
            {
                _cancelToken = null;
            }
        }