Пример #1
0
        public List <string> GetExtensions(string Mime, IHostingEnvironment env)
        {
            var _CSV          = File.ReadAllTextAsync(env.ContentRootPath + "/Data/LAppDoc/lmime.csv").GetAwaiter().GetResult();
            var MediaTypes    = CsvConvert.DeserializeObject <MediaType>(_CSV);
            var MediaTypeList = MediaTypes.ToList();    //  .Select(p=>new MediaType {  Name=});
            var _Extensions   = new List <string>();

            Mime = Mime.Split(".").LastOrDefault().ToLower();
            foreach (var i in MediaTypeList)
            {
                if (i.Template.ToLower() == Mime)
                {
                    _Extensions.Add(i.Name);
                }
            }
            return(_Extensions);
        }