WalkingTec.Mvvm/WalkingTec.Mvvm.Mvc/Helper/IconFontsHelper.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using WalkingTec.Mvvm.Core;

namespace WalkingTec.Mvvm.Mvc
{
    public static class IconFontsHelper
    {
        private static List<ComboSelectListItem> _iconFontItems;
        public static List<ComboSelectListItem> IconFontItems
        {
            get
            {
                foreach (var item in _iconFontItems.Where(x => x.Selected == true))
                    item.Selected = false;
                return _iconFontItems;
            }
        }

        private static Dictionary<string, List<MenuItem>> _iconFontDicItems;
        public static Dictionary<string, List<MenuItem>> IconFontDicItems => _iconFontDicItems;

        public static void GenerateIconFont(params string[] dirs)
        {
            var baseDirs = new string[] { "wwwroot/font", "wwwroot/layui" };
            if(dirs.Length > 0)
            {
                baseDirs = dirs;
            }
            var iconFontHashSet = new HashSet<string>();
            var IconFontDic = new Dictionary<string, string[]>();
            foreach (var dir in baseDirs)
            {
                if (Directory.Exists(dir))
                {
                    RecursiveDir(dir, iconFontHashSet, IconFontDic);
                }
            }
            var iconFonts = iconFontHashSet.ToArray();

            _iconFontItems = iconFontHashSet.Select(x => new ComboSelectListItem
            {
                Text = x,
                Value = x
            }).ToList();

            _iconFontDicItems = new Dictionary<string, List<MenuItem>>();
            foreach (var key in IconFontDic.Keys)
            {
                IconFontDicItems.Add(key, IconFontDic[key].Select(x => new MenuItem
                {
                    Text = x,
                    Value = x,
                    Icon = $"{key} {x}"
                }).ToList());
            }
        }

后面还有 48 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。