Esempio n. 1
0
        public void execute(BaseSocketPacket data)
        {
            Dictionary <string, object> response = (Dictionary <string, object>)data.value;

            if (response.ContainsKey("result"))
            {
                Dictionary <string, Dictionary <string, Object> > gmeAccounts = new Dictionary <string, Dictionary <string, Object> >();
                try
                {
                    Dictionary <string, Object> gmsacc = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, Object> >(response["data"].ToString());
                    foreach (KeyValuePair <string, Object> datax in gmsacc)
                    {
                        Dictionary <string, Object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, Object> >(datax.Value.ToString());
                        gmeAccounts.Add(datax.Key, dic);
                    }
                }
                catch
                { }
                PWAdmin.getInstance().updateAccountManagment(gmeAccounts);
                if (response.ContainsKey("afected"))
                {
                    MessageBox.Show("Succesfuly changed: " + response["afected"] + " rows.");
                }
                if (response.ContainsKey("ERR"))
                {
                    MessageBox.Show(response["ERR"].ToString());
                }
            }
        }
Esempio n. 2
0
        public void execute(BaseSocketPacket data)
        {
            Dictionary <string, object> response = (Dictionary <string, object>)data.value;

            if (response.ContainsKey("result"))
            {
                int resp = int.Parse(response["result"].ToString());
                switch (resp)
                {
                case 0:
                    PWAdmin.getInstance().updateXmlRoleForm(response);
                    break;

                case 10000:
                    PWAdmin.getInstance().resetallForm(false);
                    MessageBox.Show("Character roleId/userId must be numeric!");
                    break;

                default:
                    PWAdmin.getInstance().resetallForm(false);
                    MessageBox.Show("No character found!");
                    break;
                }
            }
        }
Esempio n. 3
0
        public void execute(BaseSocketPacket data)
        {
            Dictionary <string, object> response = (Dictionary <string, object>)data.value;

            if (response.ContainsKey("result"))
            {
                int resp = int.Parse(response["result"].ToString());
                switch (resp)
                {
                case 0:
                    Dictionary <string, GmAccount> gmeAccounts = new Dictionary <string, GmAccount>();
                    try
                    {
                        Dictionary <string, object> gmsacc = JsonConvert.DeserializeObject <Dictionary <string, object> >(response["gmsacc"].ToString());
                        foreach (KeyValuePair <string, object> datax in gmsacc)
                        {
                            Dictionary <string, object> gmInfo = JsonConvert.DeserializeObject <Dictionary <string, object> >(datax.Value.ToString());
                            GmAccount gm = new GmAccount();
                            if (gmInfo.ContainsKey("perms"))
                            {
                                String[] perms = JsonConvert.DeserializeObject <String[]>(gmInfo["perms"].ToString());
                                gm.permisions = perms.ToList <String>();
                            }
                            if (gmInfo.ContainsKey("info"))
                            {
                                String[] info = JsonConvert.DeserializeObject <String[]>(gmInfo["info"].ToString());
                                gm.id   = info[0];
                                gm.name = info[1];
                            }
                            gmeAccounts.Add(gm.id, gm);
                        }
                    }
                    catch
                    { }
                    PWAdmin.server_cache.gmeAccounts = gmeAccounts;
                    PWAdmin.getInstance().updateGMScreeen();
                    PWAdmin.getInstance().unlockGMPANEL();
                    break;

                case 10000:
                    PWAdmin.getInstance().unlockGMPANEL();
                    MessageBox.Show("No such Account!");
                    break;

                case 10001:
                    PWAdmin.getInstance().unlockGMPANEL();
                    MessageBox.Show("Role ID or User ID must be numeric!");
                    break;

                default:
                    PWAdmin.getInstance().unlockGMPANEL();
                    MessageBox.Show("Unknown server errror!");
                    break;
                }
            }
        }
Esempio n. 4
0
        public void execute(BaseSocketPacket data)
        {
            Dictionary <string, object> response = (Dictionary <string, object>)data.value;

            if (response.ContainsKey("result"))
            {
                int result = int.Parse(response["result"].ToString());
                if (result == 0)
                {
                    PWAdmin.getInstance().drawEventTab(response);
                }
            }
        }
Esempio n. 5
0
        private void onDisconect(object sender, EventArgs e)
        {
            String type = (e as BaseSocketEvent)._type;

            switch (type)
            {
            case BaseSocketEvent.IO_ERROR:
                if (baseSocket != null || baseSocket == null)
                {
                    ProfileView.instance().progress_bar("Ready", 0, 0);
                    Constants.Authed = false;
                    try
                    {
                        PWAdmin.getInstance().resetallForm(false);
                        PWAdmin.getInstance().unlockMaps("Ready");

                        ProfileView.instance().DologinDone();
                    }
                    catch { }
                }
                break;

            case BaseSocketEvent.SECURITY_ERROR:
                break;

            case BaseSocketEvent.CLOSE:
                ProfileView.instance().progress_bar("Ready", 0, 0);
                Constants.Authed = false;
                try
                {
                    PWAdmin.getInstance().resetallForm(false);
                    PWAdmin.getInstance().unlockMaps("Ready");
                    ProfileView.instance().DologinDone();
                }
                catch { }
                disconect();
                break;
            }
        }
Esempio n. 6
0
        public void execute(BaseSocketPacket data)
        {
            Dictionary <string, object> response = (Dictionary <string, object>)data.value;

            if (response.ContainsKey("result"))
            {
                int result = int.Parse(response["result"].ToString());
                switch (result)
                {
                case 0:
                    if (response.ContainsKey("afected"))
                    {
                        MessageBox.Show("Succesfuly changed: " + response["afected"] + " rows.");
                    }
                    PWAdmin.getInstance().updateAccountManagment();
                    break;

                default:
                    MessageBox.Show("Unable to run the query now. Please try again later!");
                    PWAdmin.getInstance().updateAccountManagment();
                    break;
                }
            }
        }
Esempio n. 7
0
        public void execute(BaseSocketPacket data)
        {
            Dictionary <string, object> response = (Dictionary <string, object>)data.value;

            if (response.ContainsKey("result"))
            {
                int result = Int32.Parse(response["result"].ToString());
                switch (result)
                {
                case 0:
                    if (!Constants.Authed && data.type == 3)
                    {
                        BaseSocketPacket         packet = new BaseSocketPacket();
                        HashMap <string, object> sd     = new HashMap <string, object>();
                        sd["buildId"] = Constants.build;
                        sd["yek"]     = Constants.ke;
                        sd["usr"]     = ProfileView.profile.userName;
                        sd["pwd"]     = ProfileView.profile.passWord;
                        sd["key"]     = ProfileView.profile.keyString;
                        packet.module = Module.USER;
                        packet.cmd    = Cmd.AUTH;
                        packet.value  = sd;
                        ProfileView.instance().progress_bar("Connected !", 0, 0);
                        if (Iobserver.instance() != null)
                        {
                            Iobserver.instance().send(packet);
                        }
                    }

                    if (data.type == 2 && response.ContainsKey("data") && Constants.Authed)
                    {
                        Dictionary <string, object> sysInfo = JsonConvert.DeserializeObject <Dictionary <string, object> >(response["data"].ToString());
                        foreach (KeyValuePair <string, object> datax in sysInfo)
                        {
                            String[]     demonData = JsonConvert.DeserializeObject <String[]>(datax.Value.ToString());
                            MessageClass msgc      = new MessageClass();
                            int          key       = Int32.Parse(datax.Key);
                            msgc.to      = demonData[0];
                            msgc.channel = demonData[2];
                            msgc.from    = demonData[1];

                            msgc.message = demonData[3];
                            msgc.time    = demonData[4];
                            PWAdmin.getInstance().add_chat_line(key, msgc);
                        }
                    }

                    break;

                case 100:
                    // INVALID_STRUCTURE_HWKEY
                    ProfileView.instance().progress_bar("Invalid password!", 0, 0);
                    Constants.canRecoonect = false;
                    if (Iobserver.instance() != null)
                    {
                        Iobserver.instance().close();
                    }
                    break;

                case 101:
                    // INVALID_BUILD
                    Constants.canRecoonect = false;
                    if (Iobserver.instance() != null)
                    {
                        Iobserver.instance().close();
                    }
                    break;

                case 102:
                    // INVALID_BUILD
                    ProfileView.instance().progress_bar("Not enough privileges!", 0, 0);
                    Constants.canRecoonect = false;
                    if (Iobserver.instance() != null)
                    {
                        Iobserver.instance().close();
                    }
                    break;
                }
            }
        }
Esempio n. 8
0
        public void execute(BaseSocketPacket data)
        {
            Dictionary <string, object> response = (Dictionary <string, object>)data.value;

            if (response.ContainsKey("result"))
            {
                int result = Int32.Parse(response["result"].ToString());
                switch (result)
                {
                case 0:
                    PWAdmin.server_cache.reset();
                    Dictionary <string, object> game = new Dictionary <string, object>();
                    try
                    {
                        game = JsonConvert.DeserializeObject <Dictionary <string, object> > (response["game"].ToString());
                    }
                    catch { }

                    Dictionary <string, object> allMapsData = new Dictionary <string, object>();
                    if (game.ContainsKey("allMaps"))
                    {
                        allMapsData = JsonConvert.DeserializeObject <Dictionary <string, object> >(game["allMaps"].ToString());

                        foreach (KeyValuePair <string, object> datax in allMapsData)
                        {
                            int id = 0;
                            Int32.TryParse(datax.Value.ToString(), out id);
                            PWAdmin.server_cache.getMapByName(datax.Key).status = id;
                        }
                    }

                    Dictionary <string, object> demons_update = new Dictionary <string, object>();
                    if (game.ContainsKey("allDemons"))
                    {
                        demons_update = JsonConvert.DeserializeObject <Dictionary <string, object> >(game["allDemons"].ToString());
                    }

                    foreach (KeyValuePair <string, object> datax in demons_update)
                    {
                        try
                        {
                            String[] demonData = JsonConvert.DeserializeObject <String[]>(datax.ToString());
                            int      idd       = Int32.Parse(demonData[0]);
                            int      status    = Int32.Parse(demonData[1]);
                            PWAdmin.server_cache.updateDemonByID(idd, status);
                        }
                        catch { }
                    }


                    Dictionary <string, object> sysInfo = new Dictionary <string, object>();
                    if (response.ContainsKey("data"))
                    {
                        sysInfo = JsonConvert.DeserializeObject <Dictionary <string, object> >(response["data"].ToString());
                    }

                    foreach (KeyValuePair <string, object> datax in sysInfo)
                    {
                        try
                        {
                            switch (datax.Key)
                            {
                            case "availableProcessors":
                                PWAdmin.server_cache.numCores = datax.Value.ToString();
                                break;

                            case "getSystemCpuLoad":
                                PWAdmin.server_cache.ghzused = datax.Value.ToString();
                                break;
                            }
                        }
                        catch { }
                    }
                    if (game != null)
                    {
                        foreach (KeyValuePair <string, object> datax in game)
                        {
                            try
                            {
                                switch (datax.Key)
                                {
                                case "map_online_count":
                                    PWAdmin.server_cache.map_online_count = datax.Value.ToString();
                                    break;

                                case "totalAcc":
                                    PWAdmin.server_cache.totalAcc = datax.Value.ToString();
                                    break;

                                case "totalOnline":
                                    PWAdmin.server_cache.onlineAcc = datax.Value.ToString();
                                    break;

                                case "mem":
                                    String[] mem = JsonConvert.DeserializeObject <String[]>(datax.Value.ToString());
                                    PWAdmin.server_cache.ramfree  = mem[3];
                                    PWAdmin.server_cache.ramtotal = mem[1];
                                    PWAdmin.server_cache.ramused  = mem[2];
                                    break;

                                case "swp":
                                    String[] swp = JsonConvert.DeserializeObject <String[]>(datax.Value.ToString());
                                    PWAdmin.server_cache.swpfree  = swp[3];
                                    PWAdmin.server_cache.swptotal = swp[1];
                                    PWAdmin.server_cache.swpused  = swp[2];
                                    break;

                                case "CPUmhz":
                                    PWAdmin.server_cache.ghzmax = datax.Value.ToString();
                                    break;
                                }
                            }
                            catch { }
                        }
                    }
                    BaseSocketPacket         packet = new BaseSocketPacket();
                    HashMap <string, object> sd     = new HashMap <string, object>();
                    packet.module = Module.PWADMIN;
                    packet.cmd    = Cmd.ANALLMAPUPDATE;
                    sd["maps"]    = "";
                    packet.value  = sd;
                    if (Iobserver.instance() != null)
                    {
                        Iobserver.instance().send(packet);
                    }

                    PWAdmin.getInstance().update_serverStatus();
                    break;
                }
            }
        }