internal void ToJson(AutoCSer.Json.Serializer serializer) { MemberMap memberMap = MemberMap; if (memberMap == null || memberMap.IsDefault) { serializer.TypeSerialize(Value); } else { MemberMapValueJsonSerializeConfig config = MemberMapValueJsonSerializeConfig.Pop() ?? new MemberMapValueJsonSerializeConfig(); AutoCSer.Json.SerializeConfig oldConfig = serializer.Config; AutoCSer.MemberCopy.Copyer <AutoCSer.Json.SerializeConfig> .Copy(config, oldConfig); (serializer.Config = config).MemberMap = memberMap; try { serializer.TypeSerialize(Value); } finally { serializer.Config = oldConfig; config.MemberMap = null; MemberMapValueJsonSerializeConfig.PushNotNull(config); } } }
/// <summary> /// 对象序列化 /// </summary> /// <param name="serializer"></param> protected void toJson(AutoCSer.Json.Serializer serializer) { serializer.CustomWriteNextName("msgtype"); serializer.CallSerialize(msgtype.ToString()); serializer.CustomWriteNextName(msgtype.ToString()); switch (msgtype) { case BulkMessageType.mpnews: serializer.TypeSerialize(ref mpnews); break; case BulkMessageType.text: serializer.TypeSerialize(ref text); break; case BulkMessageType.image: serializer.TypeSerialize(ref image); break; case BulkMessageType.voice: serializer.TypeSerialize(ref voice); break; case BulkMessageType.mpvideo: serializer.TypeSerialize(ref mpvideo); break; case BulkMessageType.wxcard: serializer.TypeSerialize(ref wxcard); break; } serializer.CustomObjectEnd(); }
private void toJson(AutoCSer.Json.Serializer serializer) { serializer.CustomWriteFirstName("name"); serializer.CallSerialize(name); if (type != MenuType.none) { serializer.CustomWriteNextName("type"); serializer.TypeSerialize(ref type); } if (!string.IsNullOrEmpty(key)) { serializer.CustomWriteNextName("key"); serializer.CallSerialize(key); } if (!string.IsNullOrEmpty(url)) { serializer.CustomWriteNextName("url"); serializer.CallSerialize(url); } if (!string.IsNullOrEmpty(media_id)) { serializer.CustomWriteNextName("media_id"); serializer.CallSerialize(media_id); } if (sub_button.length() != 0) { serializer.CustomWriteNextName("sub_button"); serializer.TypeSerialize(sub_button); } serializer.CustomObjectEnd(); }
private void serialize(AutoCSer.Json.Serializer serializer) { serializer.CharStream.Write('['); serializer.Serialize(ClientNodeId); serializer.CharStream.Write(','); Node.Serialize(serializer, Checker); serializer.CharStream.Write(']'); }
protected void serializeParent(AutoCSer.Json.Serializer serializer, ServerNodeIdChecker checker) { if (Parent != null) { serializer.CharStream.Write(','); Parent.Serialize(serializer, checker); } serializer.CharStream.Write(']'); }
protected void serializeParameter <parameterType>(AutoCSer.Json.Serializer serializer, parameterType parameter) { if (parameter == null) { serializer.CharStream.WriteJsonNull(); } else { AutoCSer.Json.TypeSerializer <parameterType> .Serialize(serializer, ref parameter); } }
protected override void serializeParameter(AutoCSer.Json.Serializer serializer) { #region LOOP IntputParameters #region IF ParameterType.IsNull base.serializeParameter(serializer, @ParameterName); #endregion IF ParameterType.IsNull #region NOT ParameterType.IsNull base.serializeParameterStruct(serializer, ref @ParameterName); #endregion NOT ParameterType.IsNull #endregion LOOP IntputParameters }
protected override void serialize(AutoCSer.Json.Serializer serializer, AutoCSer.Net.RemoteExpression.ServerNodeIdChecker checker) { serializeStart(serializer, checker); #region LOOP IntputParameters #region IF ParameterType.IsNull serializeParameter(serializer, @ParameterName); #endregion IF ParameterType.IsNull #region NOT ParameterType.IsNull serializeParameterStruct(serializer, ref @ParameterName); #endregion NOT ParameterType.IsNull #endregion LOOP IntputParameters serializeParent(serializer, checker); }
private void toJson(AutoCSer.Json.Serializer serializer) { if (scene_str == null) { serializer.CustomWriteFirstName("scene_id"); serializer.CustomSerialize(scene_id); } else { serializer.CustomWriteFirstName("scene_str"); serializer.CustomSerialize(scene_str); } serializer.CustomObjectEnd(); }
private static void serialize(AutoCSer.Json.Serializer serializer, ReturnValue value) { if (value == null) { serializer.CharStream.WriteJsonArray(); } else { CharStream jsonStream = serializer.CharStream; jsonStream.Write('['); serializer.Serialize(value.ClientNodeId); jsonStream.Write(','); value.serialize(serializer); jsonStream.Write(']'); } }
private unsafe void toJson(AutoCSer.Json.Serializer serializer) { if (card_ext.signature == null) { AutoCSer.Log.Pub.Log.Add(Log.LogType.Debug | Log.LogType.Info, "卡券扩展 签名为空"); serializer.CharStream.WriteJsonObject(); } else { serializer.CustomWriteFirstName("card_id"); serializer.CallSerialize(card_id); serializer.CustomWriteNextName("card_ext"); serializer.CallSerialize(AutoCSer.Json.Serializer.Serialize(card_ext)); serializer.CustomObjectEnd(); } }
internal void ToJson(AutoCSer.Json.Serializer serializer) { if (MemberMap == null || MemberMap.IsDefault) { serializer.TypeSerialize(Value); } else { AutoCSer.Metadata.MemberMap memberMap = serializer.SetCustomMemberMap(MemberMap); try { serializer.TypeSerialize(Value); } finally { serializer.SetCustomMemberMap(memberMap); } } }
private void toJson(AutoCSer.Json.Serializer serializer) { serializer.CustomWriteFirstName("action_name"); if (expire_seconds == 0) { serializer.CallSerialize(action_info.scene.scene_str == null ? "QR_LIMIT_SCENE" : "QR_LIMIT_STR_SCENE"); } else { serializer.CallSerialize("QR_SCENE"); serializer.CustomWriteNextName("expire_seconds"); serializer.CallSerialize(expire_seconds); } serializer.CustomWriteNextName("action_info"); serializer.TypeSerialize(ref action_info); serializer.CustomObjectEnd(); }
/// <summary> /// 对象序列化 /// </summary> /// <param name="serializer"></param> private void toJson(AutoCSer.Json.Serializer serializer) { serializer.CustomWriteFirstName("touser"); serializer.CallSerialize(touser); serializer.CustomWriteNextName("msgtype"); serializer.CallSerialize(msgtype.ToString()); serializer.CustomWriteNextName(msgtype.ToString()); switch (msgtype) { case MessageType.news: serializer.TypeSerialize(ref news); break; case MessageType.text: serializer.TypeSerialize(ref text); break; case MessageType.image: serializer.TypeSerialize(ref image); break; case MessageType.voice: serializer.TypeSerialize(ref voice); break; case MessageType.video: serializer.TypeSerialize(ref video); break; case MessageType.music: serializer.TypeSerialize(ref music); break; case MessageType.wxcard: serializer.TypeSerialize(ref wxcard); break; } if (customservice.kf_account != null) { serializer.CustomWriteNextName("customservice"); serializer.TypeSerialize(ref customservice); } serializer.CustomObjectEnd(); }
/// <summary> /// 对象序列化 /// </summary> /// <param name="serializer"></param> private void toJson(AutoCSer.Json.Serializer serializer) { if (string.IsNullOrEmpty(towxname)) { serializer.CustomWriteFirstName("touser"); serializer.CustomSerialize(touser); } else { serializer.CustomWriteFirstName("towxname"); serializer.CustomSerialize(towxname); } serializer.CustomWriteNextName("msgtype"); serializer.CustomSerialize(msgtype.ToString()); serializer.CustomWriteNextName(msgtype.ToString()); switch (msgtype) { case BulkMessageType.text: serializer.CustomSerialize(text); break; case BulkMessageType.image: serializer.CustomSerialize(image); break; case BulkMessageType.voice: serializer.CustomSerialize(voice); break; case BulkMessageType.mpvideo: serializer.CustomSerialize(mpvideo); break; case BulkMessageType.mpnews: serializer.CustomSerialize(mpnews); break; case BulkMessageType.wxcard: serializer.CustomSerialize(wxcard); break; } serializer.CustomObjectEnd(); }
private void toJson(AutoCSer.Json.Serializer toJsoner) { new AutoCSer.Metadata.MemberMapValue <memberMapType> { MemberMap = MemberMap, Value = Value }.ToJson(toJsoner); }
protected override void serializeParameter(AutoCSer.Json.Serializer serializer) { base.serializeParameterStruct(serializer, ref value); }
internal static void Serialize(AutoCSer.Json.Serializer serializer, CustomClass value) { serializer.CharStream.Write(value.Value == null ? '1' : '2'); }
private static void toJson(AutoCSer.Json.Serializer serializer, PreviewMessage value) { value.toJson(serializer); }
private static void toJson(AutoCSer.Json.Serializer serializer, OpenIdMessage value) { serializer.CustomWriteFirstName("touser"); serializer.TypeSerialize(value.touser); value.toJson(serializer); }
protected void serializeStart(AutoCSer.Json.Serializer serializer, ServerNodeIdChecker checker) { serializer.CharStream.Write('['); serializer.CallSerialize(checker.ServerNodeIds[GetType()]); }
/// <summary> /// JSON 调用测试 /// </summary> public Json() { jsonSerializer = AutoCSer.Json.Serializer.CreateDefault(out jsonStream); }
internal void Serialize(AutoCSer.Json.Serializer serializer) { serializer.TypeSerialize(Value == null ? 1 : 2); }
protected void serializeParameterStruct <parameterType>(AutoCSer.Json.Serializer serializer, ref parameterType parameter) { AutoCSer.Json.TypeSerializer <parameterType> .StructSerialize(serializer, ref parameter); }
/// <summary> /// 服务端序列化返回值 /// </summary> /// <param name="serializer"></param> protected virtual void serialize(AutoCSer.Json.Serializer serializer) { }
/// <summary> /// 客户端序列化 /// </summary> /// <param name="serializer"></param> protected virtual void serializeParameter(AutoCSer.Json.Serializer serializer) { }
private static void toJson(AutoCSer.Json.Serializer serializer, BulkMessage value) { serializer.CustomWriteFirstName("filter"); serializer.CustomSerialize(value.filter); value.toJson(serializer); }
protected override void serialize(AutoCSer.Json.Serializer serializer, AutoCSer.Net.RemoteExpression.ServerNodeIdChecker checker) { serializeStart(serializer, checker); serializeParameterStruct(serializer, ref value); serializeParent(serializer, checker); }
internal void Serialize(AutoCSer.Json.Serializer serializer, ServerNodeIdChecker checker) { serializeStart(serializer, checker); serializeParameter(serializer); serializeParent(serializer, checker); }