Beispiel #1
0
        /// <summary>
        /// 返回所有附件
        /// </summary>
        /// <returns></returns>
        public List <Annex> GetAnnex()
        {
            List <Annex> list = new List <Annex>();

            try
            {
                DirectoryInfo info = new DirectoryInfo(this.absolutePath);
                foreach (FileInfo info2 in info.GetFiles())
                {
                    Annex item = new Annex {
                        Name   = info2.Name,
                        Length = Math.Round((double)(((double)info2.Length) / 1024.0), 2, MidpointRounding.AwayFromZero) + "kb",
                        Path   = this.path
                    };
                    list.Add(item);
                }
            }
            catch
            {
            }
            return(list);
        }
Beispiel #2
0
        /// <summary>
        /// 返回所有附件
        /// </summary>
        /// <returns></returns>
        public List <Annex> GetAnnex(string text2)
        {
            List <Annex> list = new List <Annex>();

            try
            {
                DirectoryInfo info = new DirectoryInfo(this.absolutePath);
                foreach (FileInfo info2 in info.GetFiles())
                {
                    Annex item = new Annex
                    {
                        Name   = System.Web.HttpUtility.UrlDecode(info2.Name, System.Text.Encoding.GetEncoding("GB2312")),//MyUrlDeCode(info2.Name, Encoding.UTF8),
                        Length = Math.Round((double)(((double)info2.Length) / 1024.0), 2, MidpointRounding.AwayFromZero) + "kb",
                        Path   = text2
                    };
                    list.Add(item);
                }
            }
            catch
            {
            }
            return(list);
        }
Beispiel #3
0
        /// <summary>
        /// 返回所有附件
        /// </summary>
        /// <param name="readOnly">是否只读</param>
        /// <returns></returns>
        public List <Annex> GetAnnex(bool readOnly, string text2)
        {
            List <Annex> list = new List <Annex>();

            try
            {
                DirectoryInfo info = new DirectoryInfo(this.absolutePath);
                foreach (FileInfo info2 in info.GetFiles())
                {
                    Annex item = new Annex
                    {
                        Name     = MyUrlDeCode(info2.Name, Encoding.UTF8),
                        Length   = Math.Round((double)(((double)info2.Length) / 1024.0), 2, MidpointRounding.AwayFromZero) + "kb",
                        ReadOnly = readOnly,
                        Path     = text2
                    };
                    list.Add(item);
                }
            }
            catch
            {
            }
            return(list);
        }