protected override void OnStart(string[] args)
        {
            Packet.RegisterPacket(typeof(Packets.PacketLockDesktop));
            Packet.RegisterPacket(typeof(Packets.PacketSleep));
            Packet.RegisterPacket(typeof(Packets.PacketHibernate));
            Packet.RegisterPacket(typeof(Packets.PacketShutdown));
            Packet.RegisterPacket(typeof(Packets.PacketRestart));
            Packet.RegisterPacket(typeof(Packets.PacketMessageBox));

            Packet.PacketRecieved += Packet_PacketRecieved;

            server = new TcpRemoteServer();
            server.Start();

            multicast = new DeviceDiscovery();
            multicast.BeginCast();
        }
        public static void Main(string[] args)
        {
            //Register packets

            Packet.RegisterPacket(typeof(PacketMessage), 0x04);
            Packet.RegisterPacket(typeof(PacketCommand), 0x05);
            Packet.RegisterPacket(typeof(PacketBeep), 0x06);

            //End register

            Logger.Init();
            Logger.OnRecieveLog += OnLog;
            Logger.OnRecieveErrorLog += OnError;
            _server = new TcpRemoteServer();
            Packet.PacketRecieved += Packet_PacketRecieved;

            _server.Start();
            Logger.Log("Server Started (" + _server.LocalIP + ")");

            RemoteClient.ClientJoined += Client_ClientJoined;
            RemoteClient.ClientLeft += Client_ClientLeft;

            _mouse = new WirelessMouse();
            _mouse.Start();

            // if (!Paramaters.Multicating) return;

            //_cast = new DeviceDiscovery();
            //_cast.BeginCast();

            //Logger.Log("Casting server started");

            while (ReadLine())
            {
                // Block //
            }
        }
        static void Exit()
        {
            Logger.DeInit();

            _cast?.EndCast();

            _server?.Stop();

            _mouse?.Stop();

            _cast = null;
            _server = null;
        }
        void HandleNetwork()
        {
            //--- Packet Registers ---

            Packet.RegisterPacket ( typeof ( PacketControl ), 0x0a );
            Packet.RegisterPacket ( typeof ( PacketVideo ), 0x09 );

            //--- End register ---

            Logger.Init ();
            Logger.OnRecieveLog += OnLog;
            Logger.OnRecieveErrorLog += OnLog;
            _server = new TcpRemoteServer ();
            Packet.PacketRecieved += PacketRecieved;

            _server.Start ();
            Logger.Log ( "Server Started (" + _server.LocalIP.ToString () + ")" );

            RemoteClient.ClientJoined += Client_ClientJoined;
            RemoteClient.ClientLeft += Client_ClientLeft;

            _castServer = new DeviceDiscovery ();
            _castServer.BeginCast();

            Logger.Log ( "Casting server started" );
        }