Exemplo n.º 1
0
        public override void Execute(INotification notification)
        {
            this.Debug(CommandNotification);
            AuthorizationSessionProxy authorizationSessionProxy = (AuthorizationSessionProxy)Facade.RetrieveProxy(AuthorizationSessionProxy.Name);
            ConfigProxy           configProxy     = (ConfigProxy)Facade.RetrieveProxy(ConfigProxy.Name);
            ProgramArgumentsProxy programArgProxy = (ProgramArgumentsProxy)Facade.RetrieveProxy(ProgramArgumentsProxy.Name);
            UploadFileProxy       uploadFileProxy = (UploadFileProxy)Facade.RetrieveProxy(UploadFileProxy.Name);

            if (programArgProxy.TryGetArgument(FileOption, out string fileToUpload) == false)
            {
                throw new TerminateProgramException(
                          $"File to upload not provided. Did you remember to use {FileOption}?"
                          );
            }

            if (programArgProxy.TryGetArgument(DestinationOption, out string remoteDestinationPath) == false)
            {
                throw new TerminateProgramException(
                          $"Destination not provided. Did you remember to use {DestinationOption}?"
                          );
            }

            uploadFileProxy.AddLocalFile(
                authorizationSessionProxy.AuthorizationSession,
                fileToUpload,
                remoteDestinationPath,
                programArgProxy.DoesOptionExist(OverrideOption)
                );
        }
Exemplo n.º 2
0
        public override void Execute(INotification notification)
        {
            this.Debug(CommandNotification);
            AuthorizationSessionProxy authorizationSessionProxy = (AuthorizationSessionProxy)Facade.RetrieveProxy(AuthorizationSessionProxy.Name);
            ProgramArgumentsProxy     programArgProxy           = (ProgramArgumentsProxy)Facade.RetrieveProxy(ProgramArgumentsProxy.Name);
            UploadFileProxy           uploadFileProxy           = (UploadFileProxy)Facade.RetrieveProxy(UploadFileProxy.Name);

            if (programArgProxy.TryGetArgument(FolderOption, out string folderToUpload) == false)
            {
                throw new TerminateProgramException(
                          $"No folder provided. Did you remember to use {FolderOption}?"
                          );
            }

            if (programArgProxy.TryGetArgument(RootDestinationFolderOption, out string rootDestinationFolder) == false)
            {
                throw new TerminateProgramException(
                          $"No root destination folder provided. Did you remember to use {RootDestinationFolderOption}?"
                          );
            }

            uploadFileProxy.AddFolder(
                () => authorizationSessionProxy.AuthorizationSession,
                folderToUpload,
                rootDestinationFolder,
                programArgProxy.DoesOptionExist(OverrideOption),
                programArgProxy.DoesOptionExist(DryRunOption)
                );
        }