internal static ComponentSerializer Get()
 {
     ComponentSerializer serializer = (ComponentSerializer) _stack.Pop();
     if (serializer == null)
     {
         serializer = new ComponentSerializer();
     }
     return serializer;
 }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #5
0
        internal static ComponentSerializer Get()
        {
            ComponentSerializer serializer = (ComponentSerializer)_stack.Pop();

            if (serializer == null)
            {
                serializer = new ComponentSerializer();
            }
            return(serializer);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }