Beispiel #1
0
        /// <summary>
        /// Trigered function when the server want to communicate with the Monitor
        /// </summary>
        /// <param name="header"></param>
        /// <param name="connection"></param>
        /// <param name="data">Data send by the server</param>
        public static void ServerRequest(PacketHeader header, Connection connection, string data)
        {
            Console.WriteLine("New request received from the server");
            NetTools.Packet dataObject = JsonConvert.DeserializeObject <NetTools.Packet>(data);

            CallBackFct(dataObject);
        }
Beispiel #2
0
        /// <summary>
        /// Callback used when a service want to communicate with the server
        /// </summary>
        /// <param name="obj">The <see cref="Network.NetTools.Packet"/> sent by the service</param>
        /// <returns></returns>
        public static int MessageBusCallback(Network.NetTools.Packet obj)
        {
            switch (obj.Data.Key)
            {
            case PacketCommand.REACTION:
                TriggerReactionEvent e = JsonConvert.DeserializeObject <TriggerReactionEvent>(obj.Data.Value.ToString());
                Add(e);
                break;
            }

            return(0);
        }