public static void BuildChild(CodeToolBase _codetool, object _fieldobj, ProtoBufferWriterCSLS _writer) { if (_fieldobj == null) { _writer.FieldNumberForward(); return; } BuilderObjectWriterBaseCSLS tobj = null; if (_codetool.IsLSType(_fieldobj.GetType())) { tobj = new BuilderObjectWriterObjectCSLS(_codetool, _fieldobj); } else { Type ttype = _fieldobj.GetType(); if (ttype.ToString().Contains("List")) { tobj = new BuilderObjectWriterArrayCSLS(_codetool, _fieldobj); } else { tobj = new BuilderObjectWriterDefaultCSLS(_codetool, _fieldobj); } } tobj.WriteMember(_writer); }
static public BuilderObjectBase GetMember(CodeToolBase _codetool, IType _fieldtype, int _fieldindex, int _index, object _parent, IType _parenttype) { if (_codetool.IsLSType(_fieldtype.TypeForCLR)) { return(new BuilderObjectCELSClass(_codetool, _index, _fieldindex, _parent, _fieldtype, _parenttype)); } else { string ttypestring = _fieldtype.TypeForCLR.ToString(); if (ttypestring.Contains("List")) { IType tatyp = _codetool.GetListChildType(_fieldtype);//包含类型 if (tatyp == null) { DLog.LogError("获取数组基础类型失败(" + _fieldtype + "|" + ttypestring + "|" + tatyp + ")"); } return(new BuilderObjectCELSArray(_codetool, _index, _fieldindex, _parent, _fieldtype, _parenttype, tatyp)); } else { return(new BuilderObjectDefault(_codetool, _index, _fieldindex, _parent, _fieldtype, _parenttype)); } } }