public void Write(object value, ProtoWriter dest) { if (isRootType) { Callback(value, TypeModel.CallbackType.BeforeSerialize, dest.Context); } // write inheritance first IProtoSerializer next = GetMoreSpecificSerializer(value); if (next != null) { next.Write(value, dest); } // write all actual fields //Helpers.DebugWriteLine(">> Writing fields for " + forType.FullName); for (int i = 0; i < serializers.Length; i++) { IProtoSerializer ser = serializers[i]; if (ser.ExpectedType == forType) { //Helpers.DebugWriteLine(": " + ser.ToString()); ser.Write(value, dest); } } //Helpers.DebugWriteLine("<< Writing fields for " + forType.FullName); if (isExtensible) { ProtoWriter.AppendExtensionData((IExtensible)value, dest); } if (isRootType) { Callback(value, TypeModel.CallbackType.AfterSerialize, dest.Context); } }
// Token: 0x0600361D RID: 13853 RVA: 0x00135D78 File Offset: 0x00134178 public void Write(object value, ProtoWriter dest) { if (isRootType) { Callback(value, TypeModel.CallbackType.BeforeSerialize, dest.Context); } IProtoSerializer moreSpecificSerializer = GetMoreSpecificSerializer(value); if (moreSpecificSerializer != null) { moreSpecificSerializer.Write(value, dest); } for (int i = 0; i < serializers.Length; i++) { IProtoSerializer protoSerializer = serializers[i]; if (protoSerializer.ExpectedType == forType) { protoSerializer.Write(value, dest); } } if (isExtensible) { ProtoWriter.AppendExtensionData((IExtensible)value, dest); } if (isRootType) { Callback(value, TypeModel.CallbackType.AfterSerialize, dest.Context); } }
public void Write(object value, ProtoWriter dest) { if (isRootType) { Callback(value, TypeModel.CallbackType.BeforeSerialize, dest.Context); } IProtoSerializer moreSpecificSerializer = GetMoreSpecificSerializer(value); moreSpecificSerializer?.Write(value, dest); foreach (IProtoSerializer protoSerializer in serializers) { if (protoSerializer.ExpectedType == forType) { protoSerializer.Write(value, dest); } } if (isExtensible) { ProtoWriter.AppendExtensionData((IExtensible)value, dest); } if (isRootType) { Callback(value, TypeModel.CallbackType.AfterSerialize, dest.Context); } }
public override void Write(ProtoWriter dest, ref ProtoWriter.State state, object value) { foreach (var pair in (TDictionary)value) { ProtoWriter.WriteFieldHeader(fieldNumber, wireType, dest, ref state); var token = ProtoWriter.StartSubItem(null, dest, ref state); if (pair.Key != null) { keyTail.Write(dest, ref state, pair.Key); } if (pair.Value != null) { Tail.Write(dest, ref state, pair.Value); } ProtoWriter.EndSubItem(token, dest, ref state); } }
public override void Write(object untyped, ProtoWriter dest) { foreach (var pair in (TDictionary)untyped) { ProtoWriter.WriteFieldHeader(fieldNumber, wireType, dest); var token = ProtoWriter.StartSubItem(null, dest); if (pair.Key != null) { keyTail.Write(pair.Key, dest); } if (pair.Value != null) { Tail.Write(pair.Value, dest); } ProtoWriter.EndSubItem(token, dest); } }
public void Write(object value, ProtoWriter dest) { var token = ProtoWriter.StartSubItem(value, _prefixLength, dest); if (_isRootType) { Callback(value, TypeModel.CallbackType.BeforeSerialize, dest.Context); } // write inheritance first IProtoSerializerWithWireType next; int fn; if (GetMoreSpecificSerializer(value, out next, out fn)) { ProtoWriter.WriteFieldHeaderBegin(fn, dest); next.Write(value, dest); } // write all actual fields //Helpers.DebugWriteLine(">> Writing fields for " + forType.FullName); for (int i = 0; i < _serializers.Length; i++) { IProtoSerializer ser = _serializers[i]; if (ser.ExpectedType == ExpectedType) { ProtoWriter.WriteFieldHeaderBegin(_fieldNumbers[i], dest); //Helpers.DebugWriteLine(": " + ser.ToString()); ser.Write(value, dest); } } //Helpers.DebugWriteLine("<< Writing fields for " + forType.FullName); if (_isExtensible) { ProtoWriter.AppendExtensionData((IExtensible)value, dest); } if (_isRootType) { Callback(value, TypeModel.CallbackType.AfterSerialize, dest.Context); } ProtoWriter.EndSubItem(token, dest); }