static public int CompareTo(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (matchType(l, argc, 2, typeof(ProtoBuf.ProtoMemberAttribute))) { ProtoBuf.ProtoMemberAttribute self = (ProtoBuf.ProtoMemberAttribute)checkSelf(l); ProtoBuf.ProtoMemberAttribute a1; checkType(l, 2, out a1); var ret = self.CompareTo(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (matchType(l, argc, 2, typeof(System.Object))) { ProtoBuf.ProtoMemberAttribute self = (ProtoBuf.ProtoMemberAttribute)checkSelf(l); System.Object a1; checkType(l, 2, out a1); var ret = self.CompareTo(a1); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
public XmlIdReader(string path, Type itemType) { mPath = path; mType = itemType; mFile = File.OpenText(path); mReader = System.Xml.XmlReader.Create(mFile); mXS = new System.Xml.Serialization.XmlSerializer(itemType); System.Reflection.PropertyInfo[] props = itemType.GetProperties( System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic); System.Reflection.PropertyInfo propId = null; Type protoMember = typeof(ProtoBuf.ProtoMemberAttribute); for (int j = 0, jmax = props.Length; j < jmax; j++) { System.Reflection.PropertyInfo prop = props[j]; ProtoBuf.ProtoMemberAttribute attr = Attribute.GetCustomAttribute(prop, protoMember) as ProtoBuf.ProtoMemberAttribute; if (attr == null || attr.Tag != 1) { continue; } propId = prop; break; } if (propId == null) { throw new Exception("'ProtoMember 1' is required as Id or Key property !"); } mPropId = propId; mStrKey = mPropId.PropertyType.Equals(typeof(string)); }
private static string GetFieldName(PropertyInfo property, ProtoBuf.ProtoMemberAttribute attribute) { var name = attribute.Name; if (name == null || name == "") { name = property.Name; } return(name); }
static public int get_DataFormat(IntPtr l) { try { ProtoBuf.ProtoMemberAttribute self = (ProtoBuf.ProtoMemberAttribute)checkSelf(l); pushValue(l, true); pushEnum(l, (int)self.DataFormat); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_Name(IntPtr l) { try { ProtoBuf.ProtoMemberAttribute self = (ProtoBuf.ProtoMemberAttribute)checkSelf(l); pushValue(l, true); pushValue(l, self.Name); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int set_Name(IntPtr l) { try { ProtoBuf.ProtoMemberAttribute self = (ProtoBuf.ProtoMemberAttribute)checkSelf(l); string v; checkType(l, 2, out v); self.Name = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_Options(IntPtr l) { try { ProtoBuf.ProtoMemberAttribute self = (ProtoBuf.ProtoMemberAttribute)checkSelf(l); ProtoBuf.MemberSerializationOptions v; checkEnum(l, 2, out v); self.Options = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_OverwriteList(IntPtr l) { try { ProtoBuf.ProtoMemberAttribute self = (ProtoBuf.ProtoMemberAttribute)checkSelf(l); bool v; checkType(l, 2, out v); self.OverwriteList = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_DataFormat(IntPtr l) { try { ProtoBuf.ProtoMemberAttribute self = (ProtoBuf.ProtoMemberAttribute)checkSelf(l); ProtoBuf.DataFormat v; checkEnum(l, 2, out v); self.DataFormat = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { ProtoBuf.ProtoMemberAttribute o; System.Int32 a1; checkType(l, 2, out a1); o = new ProtoBuf.ProtoMemberAttribute(a1); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
/// <summary> /// Compare with another ProtoMemberAttribute for sorting purposes /// </summary> public int CompareTo(ProtoMemberAttribute other) { if (other == null) { return(-1); } if ((object)this == (object)other) { return(0); } int result = this.tag.CompareTo(other.tag); if (result == 0) { result = string.CompareOrdinal(this.name, other.name); } return(result); }