Ejemplo n.º 1
0
        public ICommandResult Execute(CommandContext context)
        {
            IOperationSource source = context.GetOperationSource(stage, stashes);

            if (source.IsNullOrEmpty())
            {
                return(new TextResult("The stage is empty."));
            }

            SearchContext searchContext = new SearchContext
            {
                SearchTerm      = context.GetParameterValue(ApplyParameters.SEARCH_TERM),
                Items           = source.GetPaths(),
                SourceLobby     = source.GetLobby(),
                IsRegex         = context.HasOption(ApplyOptions.REGEX),
                IsCaseSensitive = context.HasOption(ApplyOptions.CASE_SENSITIVE)
            };

            if (string.IsNullOrEmpty(searchContext.SearchTerm))
            {
                return(new TextResult("Empty search term."));
            }

            return(Search(searchContext));
        }
Ejemplo n.º 2
0
        public ICommandResult Execute(CommandContext context)
        {
            IOperationSource source = context.GetOperationSource(stage, stashes);

            if (source.IsNullOrEmpty())
            {
                return(new TextResult("The stage is empty."));
            }

            return(Delete(new DeleteContext
            {
                Items = source.GetPaths(),
                SourceLobby = source.GetLobby(),
                Preview = context.HasOption(ApplyOptions.PREVIEW)
            }));
        }
Ejemplo n.º 3
0
        public ICommandResult Execute(CommandContext context)
        {
            IOperationSource source = context.GetOperationSource(stage, stashes);

            if (source.IsNullOrEmpty())
            {
                return(new TextResult("The stage is empty."));
            }

            return(Zip(new ZipContext
            {
                Items = source.GetPaths(),
                DestinationZipFile = context.GetTargetFile(),
                SourceLobby = source.GetLobby(),
                Flat = context.HasOption(ApplyOptions.FLATTEN) || !source.HasLobby(),
                Override = context.HasOption(ApplyOptions.OVERWRITE),
                Add = context.HasOption(ApplyOptions.ADD)
            }));
        }
Ejemplo n.º 4
0
        public ICommandResult Execute(CommandContext context)
        {
            IOperationSource source = context.GetOperationSource(stage, stashes);

            if (source.IsNullOrEmpty())
            {
                return(new TextResult("The stage is empty."));
            }

            CopyContext copyContext = new CopyContext
            {
                Items       = source.GetPaths(),
                Destination = context.GetTargetDirectory(),
                SourceLobby = source.GetLobby(),
                Flat        = context.HasOption(ApplyOptions.FLATTEN) || !source.HasLobby(),
                Overwrite   = context.HasOption(ApplyOptions.OVERWRITE),
                Preview     = context.HasOption(ApplyOptions.PREVIEW)
            };

            return(Copy(copyContext));
        }
Ejemplo n.º 5
0
 internal static bool HasLobby(this IOperationSource source)
 {
     return(!string.IsNullOrEmpty(source.GetLobby()));
 }