Exemplo n.º 1
0
        /// <summary>
        /// Returns the list of files
        /// that reside in the context web directory
        /// and that match the given file type.
        ///
        /// The filetype should take one of seven values:
        ///   1: Text files
        ///   2: Image files
        ///   3: Viewable files, that is, text and image files
        ///   4: Non-viewable files
        ///   5: Text files plus non-viewable files
        ///   6: Image files plus non-viewable files
        ///   7: All files
        /// </summary>
        /// <param name="context">Web site HttpContext object</param>
        /// <param name="fileType">The filetype mask</param>
        public static List <string> MakeFileList
            (HttpContext context, int fileType)
        {
            if (context == null)
            {
                return(new List <string>());
            }

            string directorypath = FileTools.GetDirectoryPath(context);

            return(SourceTools.MakeFileList(directorypath, fileType));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the list of servable files
        /// in the same directory
        /// as the context web directory.
        /// </summary>
        /// <param name="context">Web site HttpContext object</param>
        public static List <string> MakeServableList(HttpContext context)
        {
            if (context == null)
            {
                return(new List <string>());
            }

            string directorypath = FileTools.GetDirectoryPath(context);

            List <string> filelist =
                SourceTools.MakeFileList(directorypath, FileTools.ALL);

            List <string> servablelist = new List <string>();

            foreach (string name in filelist)
            {
                if (IsServable(name))
                {
                    servablelist.Add(name);
                }
            }

            return(servablelist);
        }