Beispiel #1
0
        public static List <AuthModel> Get()
        {
            var Re = MCache.Get <List <AuthModel> >(MCache.MCacheTag.AuthList);

            if (Re == null)
            {
                var Ts = typeof(Auth).GetNestedTypes();
                Re = new List <AuthModel>();
                foreach (var T1 in Ts)
                {
                    var At   = (AuthTagAttribute)T1.GetCustomAttributes(true)[0];
                    var Temp = new Dictionary <string, int>();
                    foreach (var T2 in T1.GetFields(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public))
                    {
                        Temp.Add(T2.Name, int.Parse(At.Prefix + ((int)T2.GetValue(null)).ToString().PadLeft(2, '0')));
                    }
                    Re.Add(new AuthModel {
                        Tag = At.Name, Auths = Temp
                    });
                }
                MCache.Set(MCache.MCacheTag.AuthList, Re);
            }
            return(Re);
        }