Ejemplo n.º 1
0
 internal void FreeReceiveDeSerializer()
 {
     AutoCSer.BinaryDeSerializer deSerializer = Interlocked.Exchange(ref ReceiveDeSerializer, null);
     if (deSerializer != null)
     {
         deSerializer.Free();
     }
     AutoCSer.JsonDeSerializer jsonDeSerializer = Interlocked.Exchange(ref ReceiveJsonDeSerializer, null);
     if (jsonDeSerializer != null)
     {
         jsonDeSerializer.Free();
     }
 }
Ejemplo n.º 2
0
 internal void FreeReceiveDeSerializer()
 {
     if (ReceiveDeSerializer != null)
     {
         ReceiveDeSerializer.Free();
         ReceiveDeSerializer = null;
     }
     if (ReceiveJsonDeSerializer != null)
     {
         ReceiveJsonDeSerializer.Free();
         ReceiveJsonDeSerializer = null;
     }
 }
Ejemplo n.º 3
0
        internal bool DeSerialize <valueType>(ref SubArray <byte> data, ref valueType value)
            where valueType : struct
        {
            AutoCSer.BinaryDeSerializer deSerializer = Interlocked.Exchange(ref ReceiveDeSerializer, null);
            if (deSerializer == null)
            {
                deSerializer = AutoCSer.BinaryDeSerializer.YieldPool.Default.Pop() ?? new AutoCSer.BinaryDeSerializer();
                deSerializer.SetTcpServer(AutoCSer.BinaryDeSerializer.DefaultConfig, null);
            }
            bool isValue = deSerializer.DeSerializeTcpServer(ref data, ref value);

            if (Interlocked.CompareExchange(ref ReceiveDeSerializer, deSerializer, null) != null)
            {
                deSerializer.Free();
            }
            return(isValue);
        }
Ejemplo n.º 4
0
 internal void FreeSerializer()
 {
     OutputStream = null;
     if (ReceiveDeSerializer != null)
     {
         ReceiveDeSerializer.Free();
         ReceiveDeSerializer = null;
     }
     if (ReceiveJsonParser != null)
     {
         ReceiveJsonParser.Free();
         ReceiveJsonParser = null;
     }
     if (OutputSerializer != null)
     {
         OutputSerializer.Free();
         OutputSerializer = null;
     }
     if (OutputJsonSerializer != null)
     {
         OutputJsonSerializer.Free();
         OutputJsonSerializer = null;
     }
 }