internal static ComponentSerializer Get()
 {
     ComponentSerializer serializer = (ComponentSerializer) _stack.Pop();
     if (serializer == null)
     {
         serializer = new ComponentSerializer();
     }
     return serializer;
 }
Beispiel #2
0
        internal static string ConvertToString(IMessage reqMsg)
        {
            long num;
            ComponentSerializer serializer = ComponentSerializer.Get();
            string str = GetString(serializer.MarshalToBuffer(reqMsg, out num), (int)num);

            serializer.Release();
            return(str);
        }
Beispiel #3
0
        internal static IMessage ConvertToReturnMessage(String s, IMessage mcMsg)
        {
            ComponentSerializer serializer = ComponentSerializer.Get();

            byte[]   byteArray = _encoder.GetBytes(s);
            IMessage retMsg    = (IMessage)serializer.UnmarshalReturnMessageFromBuffer(byteArray, (IMethodCallMessage)mcMsg);

            serializer.Release();
            return(retMsg);
        }
Beispiel #4
0
        internal static IMessage ConvertToMessage(String s, Object tp)
        {
            ComponentSerializer serializer = ComponentSerializer.Get();

            byte[]   byteArray = _encoder.GetBytes(s);
            IMessage retMsg    = (IMessage)serializer.UnmarshalFromBuffer(byteArray, tp);

            serializer.Release();
            return(retMsg);
        }
Beispiel #5
0
        internal static ComponentSerializer Get()
        {
            ComponentSerializer serializer = (ComponentSerializer)_stack.Pop();

            if (serializer == null)
            {
                serializer = new ComponentSerializer();
            }
            return(serializer);
        }
Beispiel #6
0
        internal static IMessage ConvertToReturnMessage(string s, IMessage mcMsg)
        {
            ComponentSerializer serializer = ComponentSerializer.Get();

            byte[]   bytes   = GetBytes(s);
            IMessage message = (IMessage)serializer.UnmarshalReturnMessageFromBuffer(bytes, (IMethodCallMessage)mcMsg);

            serializer.Release();
            return(message);
        }
Beispiel #7
0
        internal static IMessage ConvertToMessage(string s, object tp)
        {
            ComponentSerializer serializer = ComponentSerializer.Get();

            byte[]   bytes   = GetBytes(s);
            IMessage message = (IMessage)serializer.UnmarshalFromBuffer(bytes, tp);

            serializer.Release();
            return(message);
        }
Beispiel #8
0
        internal static String ConvertToString(IMessage reqMsg)
        {
            ComponentSerializer serializer = ComponentSerializer.Get();
            long numBytes;

            byte[] byteArray = serializer.MarshalToBuffer(reqMsg, out numBytes);
            String s         = _encoder.GetString(byteArray, 0, (int)numBytes); // downcast should be ok, looks like MemoryStream internally uses an int anyway

            serializer.Release();
            return(s);
        }