public override bool ValidateParams(string line)
        {
            try
            {
                if (!ParsingUtilities.HasOneParam(name, line))
                {
                    return(false);
                }
            }
            catch (RegexMatchTimeoutException)
            {
                return(false);
            }

            string path;

            try
            {
                path = ParsingUtilities.GetQuoteOneArgument(line);
            }
            catch (RegexMatchTimeoutException)
            {
                return(false);
            }

            if (!PathTracker.IsDirPathValid(path))
            {
                throw new InvalidPathException();
            }

            return(true);
        }
Ejemplo n.º 2
0
        public override bool ValidateParams(string line)
        {
            // Checking if command line has only 1 param.
            try
            {
                if (!ParsingUtilities.HasOneParam(name, line))
                {
                    return(false);
                }
            }
            catch (RegexMatchTimeoutException)
            {
                return(false);
            }

            string filePathArg = ParsingUtilities.GetQuoteOneArgument(line);

            // Check if file exists.
            if (!PathTracker.IsFilePathValid(PathTracker.CombineRelativePath(filePathArg)))
            {
                throw new InvalidPathException("FILE_NOT_FOUND");
            }

            return(true);
        }
        public override void TakeParameters(string line)
        {
            string path = ParsingUtilities.GetQuoteOneArgument(line);

            newPath = path;
        }
Ejemplo n.º 4
0
        public override void TakeParameters(string line)
        {
            string filePathArg = ParsingUtilities.GetQuoteOneArgument(line);

            filePath = PathTracker.CombineRelativePath(filePathArg);
        }