예제 #1
0
        public static ClusteredArrayList SerializeResponse(Alachisoft.NCache.Common.Protobuf.ManagementResponse command)
        {
            using (ClusteredMemoryStream stream = new ClusteredMemoryStream())
            {
                //TODO
                byte[] size = new byte[10];
                stream.Write(size, 0, size.Length);

                Serializer.Serialize <Alachisoft.NCache.Common.Protobuf.ManagementResponse>(stream, command);
                int messageLen = (int)stream.Length - size.Length;

                size            = UTF8Encoding.UTF8.GetBytes(messageLen.ToString());
                stream.Position = 0;
                stream.Write(size, 0, size.Length);
                ClusteredArrayList byteList = stream.GetInternalBuffer();

                return(byteList);
            }
        }
예제 #2
0
        public static byte[] SerializeResponse(Alachisoft.NCache.Common.Protobuf.ManagementResponse command)
        {
            using (MemoryStream stream = new MemoryStream())
            {
                byte[] size = new byte[10];
                stream.Write(size, 0, size.Length);

                Serializer.Serialize <Alachisoft.NCache.Common.Protobuf.ManagementResponse>(stream, command);
                int messageLen = (int)stream.Length - size.Length;

                size            = UTF8Encoding.UTF8.GetBytes(messageLen.ToString());
                stream.Position = 0;
                stream.Write(size, 0, size.Length);

                byte[] result = stream.ToArray();
                stream.Close();

                return(result);
            }
        }
예제 #3
0
        public static byte[] SerializeManagementExceptionResponse(Exception exc, long requestId)
        {
            Alachisoft.NCache.Common.Protobuf.Exception ex = GetExceptionResponse(exc);

            Alachisoft.NCache.Common.Protobuf.ManagementResponse response  = new ManagementResponse();
            response.requestId = requestId;
            response.exception = ex;

            return SerializeResponse(response);
        }