public PCNetworkManager(NetworkMessagesEventArgs incomingMsg)
        {
            SQLiteCRUD          sql    = new SQLiteCRUD(ConnectionStringManager.GetConnectionString(ConnectionStringManager.DataBases.PCControllerDB));
            NetworkMessageModel netMsg = new NetworkMessageModel();

            if (incomingMsg.IncomingMessage is null)
            {
                netMsg.IncomingMessage = string.Empty;
            }
            else
            {
                netMsg.IncomingMessage = incomingMsg.IncomingMessage;
            }

            if (incomingMsg.OutgoingMessage is null)
            {
                netMsg.IncomingMessage = string.Empty;
            }
            else
            {
                netMsg.OutgoingMessage = incomingMsg.OutgoingMessage;
            }

            if (incomingMsg.RemoteIP is null)
            {
                incomingMsg.RemoteIP = string.Empty;
            }
            else
            {
                netMsg.RemoteIP = incomingMsg.RemoteIP;
            }

            if (incomingMsg.IncomingMessage is null)
            {
                incomingMsg.Timestamp = string.Empty;
            }
            else
            {
                netMsg.Timestamp = incomingMsg.Timestamp;
            }

            if (incomingMsg.RemotePort is null)
            {
                incomingMsg.RemotePort = string.Empty;
            }
            else
            {
                netMsg.RemotePort = incomingMsg.RemotePort;
            }

            netMsg.UDPPort = incomingMsg.UDPPort;

            this.UDPPortSet?.Invoke(this, incomingMsg.UDPPort);

            sql.InsertNetMessage(netMsg);
        }
Esempio n. 2
0
        private void PCNetworkManagerOnMessage(object sender, NetworkMessagesEventArgs e)
        {
            NetWorkTimer(false);
            Thread.Sleep(10);
            NetWorkTimer(true);

            PCNetworkManager pc = new(e);

            RemoteControlIP          = e.RemoteIP;
            RemoteControlPort        = e.RemotePort;
            RemoteControlTimeStamp   = e.Timestamp;
            RemoteControlLastMessage = e.IncomingMessage;

            RaisePropertyChanged(() => RemoteControlIP);
            RaisePropertyChanged(() => RemoteControlPort);
            RaisePropertyChanged(() => RemoteControlTimeStamp);
            RaisePropertyChanged(() => RemoteControlLastMessage);

            _log.Info("Message from PC network shutdown controller {sender} {e}", sender, e);
        }