public void SaveDescriptions(ParMainLite _parMainLite, string _fname) { Descs descsOut = GetDescription(_parMainLite); if (descsOut != null) { descsOut.Save(_fname); } }
void GetExec(object _parent, PropertyInfo _pi, Descs _descsOut) { De de = Attribute.GetCustomAttribute(_pi, typeof(De)) as De; if (de == null) { return; } PropertyDescriptor pd = TypeDescriptor.GetProperties(_pi.DeclaringType)[_pi.Name]; de = (De)pd.Attributes[typeof(De)]; Desc desc = new Desc(); desc.accsess = de.Acc; desc.description = de.Description; desc.actual = true; string ckey = _parent.GetType().Name + "." + _pi.Name; _descsOut[ckey] = desc; }
Descs GetDescription(ParMainLite _parMainLite) { Descs ret = new Descs(); GetExec(_parMainLite, ret); if (descs == null) { return(null); } foreach (string ckey in descs.Keys) { if (ret[ckey] == null) { Desc desc = descs[ckey]; desc.actual = false; ret[ckey] = desc; } } return(ret); }
void GetExec(object _o, Descs _descsOut) { foreach (PropertyInfo pi in _o.GetType().GetProperties()) { if (Attribute.GetCustomAttribute(pi, typeof(De)) == null) { continue; } GetExec(_o, pi, _descsOut); object io = pi.GetValue(_o, null); if (io is IParent) { GetExec(io, _descsOut); } if (io is IParentList) { foreach (object nio in (io as IEnumerable)) { GetExec(nio, _descsOut); } } } }
public void LoadDescriptions(string _fname) { descs = new Descs(_fname); }