private static int Main(string[] args)
        {
            if (args.Length > 0)
            {
                Console.WriteLine(args[0]);
                if ("background".Equals(args[0]))
                {
                    IS_SOCK_MODE = true;
                }
                else if ("discover".Equals(args[0]))
                {
                    IS_SOCK_MODE = false;
                }
                else if ("pair".Equals(args[0]))
                {
                    IS_SOCK_MODE = false;
                }
            }

            try
            {
                if (IS_SOCK_MODE)
                {
                    sPairingServer = new PairingServer();
                    sPairingServer.NewMessageReceived += NewMessageReceived;
                    sPairingServer.Start();
                }
                else
                {
                    ParseCommandLineAndExecuteActions(args);
                }

                return(0);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Failed: {ex.Message}");
                if (WaitOnError)
                {
                    Console.ReadLine();
                }

                return(1);
            }
        }
        private static void NewMessageReceived(PairingServer pairingServer, Socket socket, EndPoint epFrom, string newMessage)
        {
            if (string.IsNullOrEmpty(newMessage))
            {
                return;
            }

            string[] parameters = newMessage.Split("/");

            string opCoode = parameters[0];

            if ("features".Equals(opCoode))
            {
                HandleFeaturesCommand(epFrom, parameters);
            }
            else if ("pair".Equals(opCoode))
            {
                HandlePairCommand(epFrom, parameters);
            }
        }