Exemple #1
0
        public static async Task Main()
        {
            try
            {
                Console.WriteLine("Gt server testing");
                ManagedENet.Startup();
                await UpdateItemsDat();

                IPEndPoint address = new IPEndPoint(IPAddress.Any, 17091);
                Server = new ENetHost(address, 1024, 10);
                Server.ChecksumWithCRC32();
                Server.CompressWithRangeCoder();

                await SetItemsDataDB();
                await SetItemsDB();

                await DbContext.OpenConnection();

                Console.WriteLine("Success at opening MySql connection!");
                Server.OnConnect += Server_OnConnect;
                Server.StartServiceThread();
                Thread.Sleep(-1);
            }
            catch (Exception e)
            {
                Console.WriteLine("Critical error occured ! Message : " + e.Message);
            }
        }
        public static bool Initialize()
        {
            // Setting up ENet-Client ->
            if (g_Client == null)
            {
                AllocConsole();
                Console.WriteLine("[ACCOUNT-CHECKER] Account Checker Bot/Client (C) 2020 playingo (aka DEERUX), github.com/playingoDEERUX/growbrewproxy\n" +
                                  "DO NOT CLOSE THIS WINDOW, OTHERWISE THE ENTIRE PROXY WILL CLOSE (except do it when you wanna exit from it)! \n" +
                                  "Although, you can still click on stop checking accounts to gain performance for proxy-only again.");

                if (accountsToCheck == null)
                {
                    Console.WriteLine("[ACCOUNT-CHECKER] ERROR: Could not start Account Checking, accountsToCheck list was null.");
                    return(false);
                }

                if (accountsToCheck.Count() <= 0)
                {
                    Console.WriteLine("[ACCOUNT-CHECKER] ERROR: Could not start Account Checking, there were no accounts loaded.");
                    return(false);
                }

                leftToCheckIndex    = accountsToCheck.Count() - 1;
                g_Client            = new ENetHost(1, 2);
                g_Client.OnConnect += Client_OnConnect;
                g_Client.ChecksumWithCRC32();
                g_Client.CompressWithRangeCoder();
                g_Client.StartServiceThread();
                Console.WriteLine("[ACCOUNT-CHECKER] Initialized Global Client Host and started service thread!\n" +
                                  "\nClick 'Connect and check all accounts' to start checking!");
            }
            return(true);
        }
        void LaunchProxy()
        {
            if (!srvRunning)
            {
                srvRunning    = true;
                clientRunning = true;

                // Setting up ENet-Server ->
                m_Host            = new ENetHost(new IPEndPoint(IPAddress.Any, 2), 16, 2); // allow only 1 peer to be connected at the same time
                m_Host.OnConnect += Host_OnConnect;
                m_Host.ChecksumWithCRC32();
                m_Host.CompressWithRangeCoder();
                m_Host.StartServiceThread();

                // Setting up ENet-Client ->
                client            = new ENetHost(16, 2);
                client.OnConnect += Client_OnConnect;
                client.ChecksumWithCRC32();
                client.CompressWithRangeCoder();
                client.StartServiceThread();


                // Setting up controls
                runproxy.Enabled             = false; // too lazy to make it so u can disable it via button
                labelsrvrunning.Text         = "Server is running!";
                labelsrvrunning.ForeColor    = Color.Green;
                labelclientrunning.Text      = "Client is running!";
                labelclientrunning.ForeColor = Color.Green;
            }
        }
 private void animaButton2_Click(object sender, EventArgs e)
 {
     eNet            = new ENetHost(1, 2);
     eNet.OnConnect += Client_OnConnect;
     eNet.CompressWithRangeCoder();
     eNet.ChecksumWithCRC32();
     eNet.StartServiceThread();
     eNetP = eNet.Connect(new System.Net.IPEndPoint(IPAddress.Parse(Growtopia_Master_IP), Growtopia_Master_Port), 2, 0);
 }
Exemple #5
0
        private static void Main(string[] args)
        {
            ManagedENet.Startup();

            Console.WriteLine("Setting up Local Server");
            LocalServer = new ENetHost(new IPEndPoint(IPAddress.Any, 17091), 1024, 10, 0, 0);
            LocalServer.ChecksumWithCRC32();
            LocalServer.CompressWithRangeCoder();

            LocalServer.OnConnect += (sender, eventArgs) =>
            {
                LogClient("Connected!");

                RemotePeer = RemoteServer.Connect(RemoteEndpoint, 1, 0);

                RemotePeer.OnReceive += (o, packet) =>
                {
                    SendToClient(packet);
                };

                eventArgs.Peer.OnReceive += (o, packet) =>
                {
                    SendToRemote(packet);
                };

                eventArgs.Peer.OnDisconnect += (o, u) =>
                {
                    RemotePeer.DisconnectNow(0);
                    LogClient("Disconnected!");
                };
            };

            LocalServer.StartServiceThread();

            Console.WriteLine("Setting up Remote Server");

            RemoteServer = new ENetHost(1, 10);
            RemoteServer.ChecksumWithCRC32();
            RemoteServer.CompressWithRangeCoder();

            RemoteServer.OnConnect += (sender, eventArgs) => LogServer("Connected!");

            RemoteServer.StartServiceThread();

            while (true)
            {
                Thread.Sleep(5);
            }
        }
 private void animaButton5_Click(object sender, EventArgs e)
 {
     animaTextBox4.Enabled = false;
     animaTextBox3.Enabled = false;
     animaButton6.Enabled  = false;
     animaButton5.Enabled  = false;
     ManagedENet.Startup();
     eNet            = new ENetHost(1, 2);
     eNet.OnConnect += Client_OnConnect;
     eNet.CompressWithRangeCoder();
     eNet.ChecksumWithCRC32();
     eNet.StartServiceThread();
     eNetP = eNet.Connect(new System.Net.IPEndPoint(IPAddress.Parse(Growtopia_Master_IP), Growtopia_Master_Port), 2, 0);
     updatestatus("Connected!", 2);
 }
Exemple #7
0
        public ChatForm(IPEndPoint endPoint, bool connect) : this()
        {
            ManagedENet.Startup();

            IsClient     = connect;
            nameBox.Text = string.Format("Test{0}", new Random().Next(1, 10));
            if (IsClient)
            {
                chatBox.Enabled = false;
            }

            m_Host            = IsClient ? new ENetHost(1, 1) : new ENetHost(endPoint, ENetHost.MaximumPeers, 1);
            m_Host.OnConnect += Host_OnConnect;
            if (IsClient)
            {
                m_Host.Connect(endPoint, 1, 0);
            }
            m_Host.StartServiceThread();
        }
Exemple #8
0
        public static async Task Main()
        {
            try
            {
                SendDateTime();
                Console.WriteLine("GT SERVER IN C#");
                ManagedENet.Startup();
                await UpdateItemsDat();

                // To check the log. recommend not to lol
                //UseLog = true;

                IPEndPoint address = new IPEndPoint(IPAddress.Any, 17091);
                Server = new ENetHost(address, 1024, 10);
                Server.ChecksumWithCRC32();
                Server.CompressWithRangeCoder();

                await SetItemsDataDB();
                await SetItemsDB();

                await DbContext.OpenConnection();

                SendDateTime();
                Console.WriteLine("Success at opening MySql connection!");
                SendDateTime();
                Console.WriteLine("Server created.");
                Server.OnConnect += Server_OnConnect;
                Server.StartServiceThread();
                Thread.Sleep(-1);
            }
            catch (Exception e)
            {
                SendDateTime();
                Console.WriteLine("Critical error occured ! Message : " + e.Message);
            }
        }
 public void Run() => _host.StartServiceThread();