Exemple #1
0
        internal static MalockNodeMessage Deserialize(Stream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            BinaryReader      br = new BinaryReader(stream);
            MalockNodeMessage m  = new MalockNodeMessage();

            if (!MalockMessage.DeserializeTo(m, br))
            {
                return(null);
            }
            m.Timeout = br.ReadInt32();
            string s;

            if (!MalockMessage.TryFromStringInReadStream(br, out s))
            {
                return(null);
            }
            m.Key = s;
            if (!MalockMessage.TryFromStringInReadStream(br, out s))
            {
                return(null);
            }
            m.Identity = s;
            return(m);
        }
Exemple #2
0
        internal static MalockNodeMessage New(string key, string identity, byte command, int sequence, int timeout)
        {
            MalockNodeMessage message = new MalockNodeMessage();

            message.Sequence = sequence;
            message.Key      = key;
            message.Command  = command;
            message.Timeout  = timeout;
            message.Identity = identity;
            return(message);
        }
Exemple #3
0
 internal static bool TryDeserialize(Stream stream, out MalockNodeMessage message)
 {
     return((message = MalockNodeMessage.Deserialize(stream)) != null);
 }