Beispiel #1
0
        public override void Execute(INotification notification)
        {
            this.Debug(CommandNotification);
            AuthorizationSessionProxy authorizationSessionProxy = (AuthorizationSessionProxy)Facade.RetrieveProxy(AuthorizationSessionProxy.Name);
            DeleteFileProxy           deleteFileProxy           = (DeleteFileProxy)Facade.RetrieveProxy(DeleteFileProxy.Name);

            deleteFileProxy.DeleteFile(() => authorizationSessionProxy.AuthorizationSession, GetFileToDelete());
        }
Beispiel #2
0
        public override void Execute(INotification notification)
        {
            this.Debug(CommandNotification);
            AuthorizationSessionProxy authorizationProxy =
                (AuthorizationSessionProxy)Facade.RetrieveProxy(AuthorizationSessionProxy.Name);
            DeleteFileProxy       deleteFileProxy  = (DeleteFileProxy)Facade.RetrieveProxy(DeleteFileProxy.Name);
            ProgramArgumentsProxy programArgsProxy = (ProgramArgumentsProxy)Facade.RetrieveProxy(ProgramArgumentsProxy.Name);
            bool isDryRun = programArgsProxy.DoesOptionExist(DryRunOption);

            foreach (Database.File file in GetFilesToDelete())
            {
                CancellationEventRouter.GlobalCancellationToken.ThrowIfCancellationRequested();
                if (isDryRun == false)
                {
                    deleteFileProxy.DeleteFile(() => authorizationProxy.AuthorizationSession, file);
                }
                else
                {
                    this.Info($"[DRY-RUN|: Would have deleted file: {file.FileName}");
                }
            }

            this.Info("Finished deleting all files");
        }