internal MethodInfo this[TypeModel.CallbackType callbackType] { get { switch (callbackType) { case TypeModel.CallbackType.BeforeSerialize: { return(this.beforeSerialize); } case TypeModel.CallbackType.AfterSerialize: { return(this.afterSerialize); } case TypeModel.CallbackType.BeforeDeserialize: { return(this.beforeDeserialize); } case TypeModel.CallbackType.AfterDeserialize: { return(this.afterDeserialize); } } throw new ArgumentException(string.Concat("Callback type not supported: ", callbackType.ToString()), "callbackType"); } }
private void EmitCallbackIfNeeded(CompilerContext ctx, Local valueFrom, TypeModel.CallbackType callbackType) { if (this.isRootType && this.HasCallbacks(callbackType)) { ((IProtoTypeSerializer)this).EmitCallback(ctx, valueFrom, callbackType); } }
public bool HasCallbacks(TypeModel.CallbackType callbackType) { IProtoTypeSerializer pts = Tail as IProtoTypeSerializer; return(pts != null && pts.HasCallbacks(callbackType)); }
public void Callback(object value, TypeModel.CallbackType callbackType, SerializationContext context) { if (Tail is IProtoTypeSerializer pts) { pts.Callback(value, callbackType, context); } }
public bool HasCallbacks(TypeModel.CallbackType callbackType) { if(callbacks != null && callbacks[callbackType] != null) return true; for (int i = 0; i < serializers.Length; i++) { if (serializers[i].ExpectedType != forType && ((IProtoTypeSerializer)serializers[i]).HasCallbacks(callbackType)) return true; } return false; }
public void Callback(object value, TypeModel.CallbackType callbackType, SerializationContext context) { if (callbacks != null) { InvokeCallback(callbacks[callbackType], value, context); } ((IProtoTypeSerializer)GetMoreSpecificSerializer(value))?.Callback(value, callbackType, context); }
public void Callback(object value, TypeModel.CallbackType callbackType, SerializationContext context) { IProtoTypeSerializer tail = base.Tail as IProtoTypeSerializer; if (tail != null) { tail.Callback(value, callbackType, context); } }
public void Callback(object value, TypeModel.CallbackType callbackType, SerializationContext context) { IProtoTypeSerializer pts = Tail as IProtoTypeSerializer; if (pts != null) { pts.Callback(value, callbackType, context); } }
public void Callback(object value, TypeModel.CallbackType callbackType, SerializationContext context) { if (_callbacks != null) { InvokeCallback(_callbacks[callbackType], value, _constructType, context); } IProtoTypeSerializer ser = (IProtoTypeSerializer)GetMoreSpecificSerializer(value); ser?.Callback(value, callbackType, context); }
public bool HasCallbacks(TypeModel.CallbackType callbackType) { IProtoTypeSerializer tail = this.Tail as IProtoTypeSerializer; if (tail == null) { return(false); } return(tail.HasCallbacks(callbackType)); }
internal MethodInfo this[TypeModel.CallbackType callbackType] { get { return(callbackType switch { TypeModel.CallbackType.BeforeSerialize => beforeSerialize, TypeModel.CallbackType.AfterSerialize => afterSerialize, TypeModel.CallbackType.BeforeDeserialize => beforeDeserialize, TypeModel.CallbackType.AfterDeserialize => afterDeserialize, _ => throw new ArgumentException("Callback type not supported: " + callbackType.ToString(), nameof(callbackType)), });
public void Callback(object value, TypeModel.CallbackType callbackType) { if (callbacks != null) { InvokeCallback(callbacks[callbackType], value); } IProtoTypeSerializer ser = (IProtoTypeSerializer)GetMoreSpecificSerializer(value); if (ser != null) { ser.Callback(value, callbackType); } }
// Token: 0x06000299 RID: 665 RVA: 0x0000F934 File Offset: 0x0000DB34 public void Callback(object value, TypeModel.CallbackType callbackType, SerializationContext context) { if (this.callbacks != null) { this.InvokeCallback(this.callbacks[callbackType], value, context); } IProtoTypeSerializer protoTypeSerializer = (IProtoTypeSerializer)this.GetMoreSpecificSerializer(value); if (protoTypeSerializer != null) { protoTypeSerializer.Callback(value, callbackType, context); } }
internal MethodInfo this[TypeModel.CallbackType callbackType] { get { switch (callbackType) { case TypeModel.CallbackType.BeforeSerialize: return beforeSerialize; case TypeModel.CallbackType.AfterSerialize: return afterSerialize; case TypeModel.CallbackType.BeforeDeserialize: return beforeDeserialize; case TypeModel.CallbackType.AfterDeserialize: return afterDeserialize; default: throw new ArgumentException("Callback type not supported: " + callbackType.ToString(), "callbackType"); } } }
void IProtoTypeSerializer.EmitCallback(CompilerContext ctx, Local valueFrom, TypeModel.CallbackType callbackType) { bool copyValue = false; if (this.CanHaveInheritance) { for (int i = 0; i < this.serializers.Length; i++) { IProtoSerializer serializer = this.serializers[i]; if ((serializer.ExpectedType != this.forType) && ((IProtoTypeSerializer)serializer).HasCallbacks(callbackType)) { copyValue = true; } } } MethodInfo method = (this.callbacks == null) ? null : this.callbacks[callbackType]; if ((method != null) || copyValue) { ctx.LoadAddress(valueFrom, this.ExpectedType); EmitInvokeCallback(ctx, method, copyValue, null, this.forType); if (copyValue) { CodeLabel label = ctx.DefineLabel(); for (int j = 0; j < this.serializers.Length; j++) { IProtoTypeSerializer serializer3; IProtoSerializer serializer2 = this.serializers[j]; Type expectedType = serializer2.ExpectedType; if ((expectedType != this.forType) && (serializer3 = (IProtoTypeSerializer)serializer2).HasCallbacks(callbackType)) { CodeLabel label2 = ctx.DefineLabel(); CodeLabel label3 = ctx.DefineLabel(); ctx.CopyValue(); ctx.TryCast(expectedType); ctx.CopyValue(); ctx.BranchIfTrue(label2, true); ctx.DiscardValue(); ctx.Branch(label3, false); ctx.MarkLabel(label2); serializer3.EmitCallback(ctx, null, callbackType); ctx.Branch(label, false); ctx.MarkLabel(label3); } } ctx.MarkLabel(label); ctx.DiscardValue(); } } }
public bool HasCallbacks(TypeModel.CallbackType callbackType) { if (_callbacks?[callbackType] != null) { return(true); } for (int i = 0; i < _serializers.Length; i++) { if (_serializers[i].ExpectedType != ExpectedType && ((_serializers[i] as IProtoTypeSerializer)?.HasCallbacks(callbackType) ?? false)) { return(true); } } return(false); }
public bool HasCallbacks(TypeModel.CallbackType callbackType) { if (callbacks != null && callbacks[callbackType] != (MethodInfo)null) { return(true); } for (int i = 0; i < serializers.Length; i++) { if (serializers[i].ExpectedType != forType && ((IProtoTypeSerializer)serializers[i]).HasCallbacks(callbackType)) { return(true); } } return(false); }
// Token: 0x06000293 RID: 659 RVA: 0x0000F734 File Offset: 0x0000D934 public bool HasCallbacks(TypeModel.CallbackType callbackType) { if (this.callbacks != null && this.callbacks[callbackType] != null) { return(true); } for (int i = 0; i < this.serializers.Length; i++) { if (this.serializers[i].ExpectedType != this.forType && ((IProtoTypeSerializer)this.serializers[i]).HasCallbacks(callbackType)) { return(true); } } return(false); }
internal MethodInfo this[TypeModel.CallbackType callbackType] { get { switch (callbackType) { case TypeModel.CallbackType.BeforeSerialize: return(beforeSerialize); case TypeModel.CallbackType.AfterSerialize: return(afterSerialize); case TypeModel.CallbackType.BeforeDeserialize: return(beforeDeserialize); case TypeModel.CallbackType.AfterDeserialize: return(afterDeserialize); default: throw new ArgumentException(); } } }
void IProtoTypeSerializer.EmitCallback(Compiler.CompilerContext ctx, Compiler.Local valueFrom, TypeModel.CallbackType callbackType) { bool actuallyHasInheritance = false; if (CanHaveInheritance) { for (int i = 0; i < serializers.Length; i++) { IProtoSerializer ser = serializers[i]; if (ser.ExpectedType != forType && ((IProtoTypeSerializer)ser).HasCallbacks(callbackType)) { actuallyHasInheritance = true; } } } Helpers.DebugAssert(((IProtoTypeSerializer)this).HasCallbacks(callbackType), "Shouldn't be calling this if there is nothing to do"); MethodInfo method = callbacks == null ? null : callbacks[callbackType]; if (method == null && !actuallyHasInheritance) { return; } ctx.LoadAddress(valueFrom, ExpectedType); EmitInvokeCallback(ctx, method, actuallyHasInheritance, null, forType); if (actuallyHasInheritance) { Compiler.CodeLabel @break = ctx.DefineLabel(); for (int i = 0; i < serializers.Length; i++) { IProtoSerializer ser = serializers[i]; IProtoTypeSerializer typeser; Type serType = ser.ExpectedType; if (serType != forType && (typeser = (IProtoTypeSerializer)ser).HasCallbacks(callbackType)) { Compiler.CodeLabel ifMatch = ctx.DefineLabel(), nextTest = ctx.DefineLabel(); ctx.CopyValue(); ctx.TryCast(serType); ctx.CopyValue(); ctx.BranchIfTrue(ifMatch, true); ctx.DiscardValue(); ctx.Branch(nextTest, false); ctx.MarkLabel(ifMatch); typeser.EmitCallback(ctx, null, callbackType); ctx.Branch(@break, false); ctx.MarkLabel(nextTest); } } ctx.MarkLabel(@break); ctx.DiscardValue(); } }
private void EmitCallbackIfNeeded(Compiler.CompilerContext ctx, Compiler.Local valueFrom, TypeModel.CallbackType callbackType) { Helpers.DebugAssert(valueFrom != null); if (isRootType && ((IProtoTypeSerializer)this).HasCallbacks(callbackType)) { ((IProtoTypeSerializer)this).EmitCallback(ctx, valueFrom, callbackType); } }
public bool HasCallbacks(TypeModel.CallbackType callbackType) { return(false); }
public void Callback(object value, TypeModel.CallbackType callbackType, SerializationContext context) { }
void IProtoTypeSerializer.EmitCallback(Compiler.CompilerContext ctx, Compiler.Local valueFrom, TypeModel.CallbackType callbackType) { head.EmitCallback(ctx, valueFrom, callbackType); }
public void Callback(object value, TypeModel.CallbackType callbackType, SerializationContext context) { head.Callback(value, callbackType, context); // these routes only used when bits of the model not compiled }
bool IProtoTypeSerializer.HasCallbacks(TypeModel.CallbackType callbackType) { return(head.HasCallbacks(callbackType)); // these routes only used when bits of the model not compiled }
public void EmitCallback(Compiler.CompilerContext ctx, Compiler.Local valueFrom, TypeModel.CallbackType callbackType) { // we only expect this to be invoked if HasCallbacks returned true, so implicitly Tail // **must** be of the correct type ((IProtoTypeSerializer)Tail).EmitCallback(ctx, valueFrom, callbackType); }
public void Callback(object value, TypeModel.CallbackType callbackType) { head.Callback(value, callbackType); // these routes only used when bits of the model not compiled }
public void EmitCallback(CompilerContext ctx, Local valueFrom, TypeModel.CallbackType callbackType) { _serializer.EmitCallback(ctx, valueFrom, callbackType); }
public bool HasCallbacks(TypeModel.CallbackType callbackType) { return(_serializer.HasCallbacks(callbackType)); }