public System.IO.Stream Serialize(ClusterMessage message)
        {
            MemoryStream    ms = new MemoryStream();
            BinaryFormatter bf = new BinaryFormatter();

            bf.Serialize(ms, message); ms.Flush(); ms.Position = 0;
            return(ms);

            //throw new NotImplementedException();
        }
Exemple #2
0
 /* ============================================================================== Send */
 public virtual void Send(ClusterMessage message)
 {
     try
     {
         message.SenderInfo = m_clusterMemberInfo;
         message.SenderInfo.ClusterMemberID = this.ReceiverName;
         Stream messageStream = m_formatter.Serialize(message);
         InternalSend(messageStream, message is DebugMessage);
     }
     catch (Exception e) //logged
     {
         Logger.WriteException(e);
         OnSendException(message, e);
     }
 }
        public ClusterMessage Deserialize(System.IO.Stream data)
        {
            BinaryFormatter bf      = new BinaryFormatter();
            ClusterMessage  message = null;

            try
            {
                message = (ClusterMessage)bf.Deserialize(data);
            }
            catch (SerializationException e) //logged
            {
                Logger.WriteException(e);
                message = new UnknownMessageType(data);
            }
            return(message);
        }
Exemple #4
0
 public ExceptionEventArgs(Exception exception, ClusterMessage message)
 {
     Exception = exception;
     Message   = message;
 }
Exemple #5
0
 public MessageReceivedEventArgs(ClusterMessage message)
 {
     Message = message;
 }