public static void FromTson(ITsonDeserializer serializer, RecordInfo info) { while (!serializer.IsEof) { switch ((MyIndex)serializer.ReadIndex()) { case MyIndex.Local: info.Local = serializer.ReadBool(); break; case MyIndex.Time: info.Time = serializer.ReadDateTime(); break; case MyIndex.Index: info.Index = serializer.ReadULong(); break; case MyIndex.ThreadID: info.ThreadID = serializer.ReadInt(); break; case MyIndex.RequestID: info.RequestID = serializer.ReadString(); break; case MyIndex.Name: info.Name = serializer.ReadString(); break; case MyIndex.Message: info.Message = serializer.ReadString(); break; case MyIndex.Type: info.Type = (LogType)serializer.ReadInt(); break; case MyIndex.TypeName: info.TypeName = serializer.ReadString(); break; case MyIndex.User: info.User = serializer.ReadString(); break; case MyIndex.Machine: info.Machine = serializer.ReadString(); break; } } }
/// <summary> /// 反序列化 /// </summary> public void FromTson(ITsonDeserializer serializer, CountData data) { while (!serializer.IsEof) { int idx = serializer.ReadIndex(); switch (idx) { case Index_IsInner: data.IsInner = serializer.ReadBool(); break; case Index_Title: data.Title = serializer.ReadString(); break; case Index_Start: data.Start = serializer.ReadLong(); break; case Index_End: data.End = serializer.ReadLong(); break; case Index_ToId: data.ToId = serializer.ReadString(); break; case Index_FromId: data.FromId = serializer.ReadString(); break; case Index_Requester: data.Requester = serializer.ReadString(); break; case Index_HostName: data.HostName = serializer.ReadString(); break; case Index_ApiName: data.ApiName = serializer.ReadString(); break; case Index_Status: data.Status = (OperatorStatus)serializer.ReadInt(); break; case Index_Machine: data.Machine = serializer.ReadString(); break; case Index_Station: data.Station = serializer.ReadString(); break; case Index_User: data.User = serializer.ReadString(); break; case Index_RequestId: data.RequestId = serializer.ReadString(); break; } } }