예제 #1
0
        public ConfigT GetConfig <ConfigT>(int dataName, int groupName, string configName, int id) where ConfigT : IConfig, new()
        {
            ConfigData                data    = Datas.GetData <ConfigData>(dataName);
            ConfigsResult             configs = data.GetConfigs(groupName);
            Dictionary <int, ConfigT> mapper  = configs.GetConfigRaw <ConfigT>(configName, out int statu);

            return(statu == 0 ? mapper[id] : default);
예제 #2
0
        public Dictionary <int, ConfigT> GetConfig <ConfigT>(int dataName, int groupName, string configName, out int statu) where  ConfigT : IConfig, new()
        {
            ConfigData                data    = Datas.GetData <ConfigData>(dataName);
            ConfigsResult             configs = data.GetConfigs(groupName);
            Dictionary <int, ConfigT> dic     = configs.GetConfigRaw <ConfigT>(configName, out statu);

            return(dic);
        }
예제 #3
0
        private void HandleRequestData(ConfigsResult item, List <SysConfigs> list)
        {
            if (item == null)
            {
                return;
            }
            var mapConfig = new MapperConfiguration(cfg => {
                cfg.CreateMap <string, int?>().ConvertUsing(new NullableIntUtcTimeTypeConverter());
                cfg.CreateMap <string, DateTime?>().ConvertUsing(new NullableUtcTimeTypeConverter());
                cfg.CreateMap <ConfigsResult, SysConfigs>();
            });
            //mapConfig.AssertConfigurationIsValid();
            var result = item.MapTo <ConfigsResult, SysConfigs>(mapConfig);

            list.Add(result);
        }
예제 #4
0
        public void InitGroupConfigs(int dataName, int groupName, ref ConfigsResult result)
        {
            ConfigData data = Datas.GetData <ConfigData>(dataName);

            data.AddConfigs(groupName, result);
        }