Esempio n. 1
0
        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;
                },
            });
        }
Esempio n. 2
0
        /// <summary>
        /// 读取: model => ini.file
        /// </summary>
        public void IniConfig_Write <M>(M model) where M : AbsShineUpon
        {
            if (CheckData.IsObjectNull(model))
            {
                return;
            }
            Type            mtype        = model.GetType();
            string          section_name = mtype.FullName;
            ShineUponParser perser       = new ShineUponParser(mtype);

            foreach (ShineUponInfo info in perser.GetDictionary().Values)
            {
                KeyString ks = perser.GetValue_KeyString(info, model);
                if (CheckData.IsObjectNull(ks))
                {
                    continue;
                }
                WriteString(section_name, info.Name, ks.Value);
            }
        }