コード例 #1
0
        void ProcessStuff(byte[] message)
        {
            MemoryStream        ms  = new MemoryStream(message);
            WatchdogCommMessage msg = (WatchdogCommMessage)serializer.Deserialize(ms);

            if (msg.GetName() == StartPublishMessage.GetClassName())
            {
                if (GotStartPublishMessage != null)
                {
                    GotStartPublishMessage(this, new WatchdogMessageEventArgs <StartPublishMessage> ((StartPublishMessage)msg));
                }
            }
            if (msg.GetName() == StopPublishMessage.GetClassName())
            {
                if (GotStopPublishMessage != null)
                {
                    GotStopPublishMessage(this, new WatchdogMessageEventArgs <StopPublishMessage>((StopPublishMessage)msg));
                }
            }
            else if (msg.GetName() == WatchdogStatusMessage.GetClassName())
            {
                if (GotWatchdogStatusMessage != null)
                {
                    GotWatchdogStatusMessage(this, new WatchdogMessageEventArgs <WatchdogStatusMessage>((WatchdogStatusMessage)msg));
                }
            }
            else if (msg.GetName() == StartStopPublishMessageReply.GetClassName())
            {
                if (GotStartPublishMessageReply != null)
                {
                    GotStartPublishMessageReply(this, new WatchdogMessageEventArgs <StartStopPublishMessageReply>((StartStopPublishMessageReply)msg));
                }
            }
            else if (msg.GetName() == WatchdogTerminateMessage.GetClassName())
            {
                if (GotWatchdogTerminateMessage != null)
                {
                    GotWatchdogTerminateMessage(this, new WatchdogMessageEventArgs <WatchdogTerminateMessage>((WatchdogTerminateMessage)msg));
                }
            }
            else if (msg.GetName() == CommandMessage.GetClassName())
            {
                if (GotCommandMessage != null)
                {
                    GotCommandMessage(this, new WatchdogMessageEventArgs <CommandMessage>((CommandMessage)msg));
                }
            }
        }
コード例 #2
0
 public override string GetName()
 {
     return(StartStopPublishMessageReply.GetClassName());
 }