コード例 #1
0
        public bool ValidateStylesheet(IStylesheet stylesheet)
        {
            // get full path
            string fullPath;

            try
            {
                // may throw for security reasons
                fullPath = FileSystem.GetFullPath(stylesheet.Path);
            }
            catch
            {
                return(false);
            }

            // validate path and extension
            var validDir         = SystemDirectories.Css;
            var isValidPath      = _ioHelper.VerifyEditPath(fullPath, validDir);
            var isValidExtension = _ioHelper.VerifyFileExtension(stylesheet.Path, ValidExtensions);

            return(isValidPath && isValidExtension);
        }
コード例 #2
0
        public bool ValidateScript(IScript script)
        {
            // get full path
            string fullPath;

            try
            {
                // may throw for security reasons
                fullPath = FileSystem.GetFullPath(script.Path);
            }
            catch
            {
                return(false);
            }

            // validate path & extension
            var validDir         = SystemDirectories.Scripts;
            var isValidPath      = _ioHelper.VerifyEditPath(fullPath, validDir);
            var validExts        = new[] { "js" };
            var isValidExtension = _ioHelper.VerifyFileExtension(script.Path, validExts);

            return(isValidPath && isValidExtension);
        }