Example #1
0
        /// <summary>
        /// 获取文件上传允许的后缀名
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public static List <string> GetExtensions(FileHelperParam param)
        {
            string        strExtensions   = GetNodeValue(GetXmlElement(string.Format("extensions-{0}", param.fileType.ToString().ToLower())));
            List <string> allowExtensions = strExtensions.Split(",".ToCharArray()).ToList <string>();

            return(allowExtensions);
        }
Example #2
0
        /// <summary>
        /// 获取所有图片的缩略图的标记
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public static List <string> GetImagethumbnailmark(FileHelperParam param)
        {
            List <string> list = new List <string>();

            if (param.fileType == FileType.image)
            {
                string strTags = "";
                switch (param.appType)
                {
                case AppType.Users:
                    strTags = string.Format("{0}-{1}-{2}", param.appType.ToString().ToLower(), param.fileType.ToString().ToLower(), param.imageType.ToString().ToLower());
                    break;

                case AppType.Holiday:
                    strTags = string.Format("{0}-{1}", param.appType.ToString().ToLower(), param.fileType.ToString().ToLower());
                    break;

                case AppType.Hotel:
                    strTags = string.Format("{0}-{1}", param.appType.ToString().ToLower(), param.fileType.ToString().ToLower());
                    break;
                }

                XmlElement  xmlElement  = GetXmlElement(strTags);
                XmlNodeList xmlNodeList = xmlElement.GetElementsByTagName("wh");
                foreach (XmlNode xmlNode in xmlNodeList)
                {
                    string strThumbnailMark = xmlNode.Attributes["thumbnailmark"].Value;
                    list.Add(strThumbnailMark);
                }
            }
            return(list);
        }