public CaseModel Func_GetValue_SetValue() { return(new CaseModel() { NameSign = @"获取/设置值", ExeEvent = () => { GS answer = new GS() { Age = RandomData.GetInt(), DateOfBirth = RandomData.GetDateTime(), Name = RandomData.GetChineseString(), Price = RandomData.GetDouble(), Sex = RandomData.Item(EnumInfo.GetALLItem <GS.SexEnum>()), }; GS result = new GS(); ShineUponParser parser = new ShineUponParser(typeof(GS)); foreach (ShineUponInfo info in parser.GetDictionary().Values) { KeyString ks = parser.GetValue_KeyString(info, answer); parser.SetValue_Object(info, result, ks.Value); } return true; }, }); }
/// <summary> /// 读取: ini.file => model /// </summary> public void IniConfig_Read(AbsShineUpon model) { Type mtype = model.GetType(); string section_name = mtype.FullName; ShineUponParser perser = new ShineUponParser(mtype); foreach (ShineUponInfo info in perser.GetDictionary().Values) { string sinival = ReadString(section_name, info.Name, string.Empty); if (CheckData.IsStringNull(sinival)) { continue; } perser.SetValue_Object(info, model, sinival); } }