Example #1
0
        static void Main()
        {
            if (!debugGui)
            {
                AllocConsole(); // needs to be the first call in the program to prevent weird bugs
            }
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ClientSocket socket = new ClientSocket();

            string guildID = "754465589958803548";

            if (File.Exists("guildid.txt"))
            {
                guildID = File.ReadAllText("guildid.txt");
            }

            Task.Factory.StartNew(() => socket.Connect("http://localhost:8123", guildID)); //synchronously force the socket to connect, and also broadcast the guildID

            Task.Factory.StartNew(() => GameMemReader.getInstance().RunLoop());            // run loop in background

            if (debugGui)
            {
                Application.Run(new MainForm());
            }
            else
            {
                (new DebugConsole()).Run();
            }
        }
Example #2
0
        static void Main()
        {
            if (doConsole)
            {
                AllocConsole(); // needs to be the first call in the program to prevent weird bugs
            }
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ClientSocket socket = new ClientSocket();

            string hostPath = "host.txt";

            //TODO make proper properties file
            string host = File.Exists(hostPath) ? File.ReadAllText(hostPath) : "http://localhost:8123";
            var    form = new UserForm(socket);

            conInterface = new FormConsole(form);                               //Create the Form Console interface.
            Task.Factory.StartNew(() => socket.Connect(host));                  //synchronously force the socket to connect
            Task.Factory.StartNew(() => GameMemReader.getInstance().RunLoop()); // run loop in background
            //(new DebugConsole(debugGui)).Run();

            Application.Run(form);
            //test
        }
        private void doConnect(string url)
        {
            clientSocket.OnConnected += (sender, e) =>
            {
                Settings.PersistentSettings.host = url;

                clientSocket.SendConnectCode(ConnectCodeBox.Text, (sender, e) =>
                {
                    if (lastJoinedLobby != null) // Send the game code _after_ the connect code
                    {
                        clientSocket.SendRoomCode(lastJoinedLobby);
                    }
                });
            };

            try
            {
                clientSocket.Connect(url);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK);
                ConnectCodeBox.Enabled = true;
                ConnectButton.Enabled  = true;
                URLTextBox.Enabled     = true;
                return;
            }
        }
Example #4
0
        static void Main()
        {
            if (doConsole)
            {
                AllocConsole(); // needs to be the first call in the program to prevent weird bugs
            }
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ClientSocket socket = new ClientSocket();
            var          form   = new UserForm(socket);

            Settings.conInterface = new FormConsole(form);                                 //Create the Form Console interface.
            Task.Factory.StartNew(() => socket.Connect(Settings.PersistentSettings.host)); //synchronously force the socket to connect
            Task.Factory.StartNew(() => GameMemReader.getInstance().RunLoop());            // run loop in background

            //AllocConsole();
            Application.Run(form);

            //test
        }