public InstantFigure(IList <MemberInfo> membersInfo, string typeName, FigureMode modeType = FigureMode.Reference) { TypeName = typeName; Mode = modeType; members = CreateMemberRurics(membersInfo); Rubrics = new MemberRubrics(); Rubrics.KeyRubrics = new MemberRubrics(); foreach (MemberRubric mr in members) { Rubrics.Add(mr); } if (modeType == FigureMode.Reference) { InstantFigureReferenceCompiler rtbld = new InstantFigureReferenceCompiler(this); compiledType = rtbld.CompileFigureType(typeName); } else { InstantFigureValueTypeCompiler rtbld = new InstantFigureValueTypeCompiler(this); compiledType = rtbld.CompileFigureType(typeName); } Figure = (IFigure)compiledType.New(); FigureType = Figure.GetType(); FigureSize = Marshal.SizeOf(FigureType); if (!membersInfo.Where(m => m.Name == "SystemSerialCode").Any()) { members = new MemberRubric[] { new MemberRubric(FigureType.GetProperty("SystemSerialCode")) } }
private MemberRubrics CloneRubrics() { var rbrcs = new MemberRubrics(); rbrcs.KeyRubrics = new MemberRubrics(); foreach (var rbrc in Figure.Rubrics.AsValues()) { rbrcs.Add(new MemberRubric(rbrc)); } return(rbrcs); }