public static ASMDB getInstance() { if (instance == null) { instance = new ASMDB(); } return(instance); }
private void refreshList() { accounts = ASMDB.getInstance().getAccounts(); acctList.Items.Clear(); foreach (Account acct in accounts) { acctList.Items.Add(acct); } }
private void refresh() { string version = Globals.instance.getGameVersion(); if (version != null && !version.Equals("")) { txtVersion.Text = version; } else { return; } if (gv != null) { if (gv.engine != null) { TimeSpan ts = gv.engine.timeRunning(); string timeRun = String.Format("{0} Days, {1} Hrs, {2} Mins, {3} Secs", ts.Days, ts.Hours, ts.Minutes, ts.Seconds); txtUptime.Text = timeRun; } } else { return; } // check db availabil8ity. if not available, go no furhter if (!NetUtils.isConnected(Globals.instance.getDbHost(), Globals.instance.getDbPort())) { return; } ASMDB.getInstance().refreshAll(); txtFree.Text = ASMDB.getInstance().getPlayerCount(Membership.Free).ToString(); txtPremium.Text = ASMDB.getInstance().getPlayerCount(Membership.Premium).ToString(); txtVIP.Text = ASMDB.getInstance().getPlayerCount(Membership.VIP).ToString(); txtChars.Text = ASMDB.getInstance().getToonCount(Races.All).ToString(); txtAChars.Text = ASMDB.getInstance().getToonCount(Races.Asmo).ToString(); txtEChars.Text = ASMDB.getInstance().getToonCount(Races.Elyo).ToString(); txtOChars.Text = ASMDB.getInstance().getOnlineToonCount(Races.All).ToString(); txtOAChars.Text = ASMDB.getInstance().getOnlineToonCount(Races.Asmo).ToString(); txtOEChars.Text = ASMDB.getInstance().getOnlineToonCount(Races.Elyo).ToString(); toonList.Items.Clear(); List <Toon> onlineToons = ASMDB.getInstance().getOnlineToons(); foreach (Toon toon in onlineToons) { toonList.Items.Add(toon.name); } }
private void doUpdate() { Account acct = current; if (txtId.BackColor == Color.Yellow) { acct.id = int.Parse(txtId.Text); } if (txtAcctName.BackColor == Color.Yellow) { acct.name = txtAcctName.Text; } if (txtPWHash.BackColor == Color.Yellow) { acct.password = txtPWHash.Text; } acct.email = txtEmail.Text; acct.activated = (byte)(chkActivated.Checked ? 1 : 0);; acct.access_level = (AccountType)cbxAccessLvl.SelectedIndex; acct.membership = (Membership)cbxMembership.SelectedIndex; acct.old_membership = (Membership)cbxPMembership.SelectedIndex; acct.expire = dpExpiry.Value; if (acct.expire.Year == 2050) { acct.expire = DateTime.MinValue; } acct.toll = int.Parse(txtToll.Text); txtQues.Text = acct.question; acct.answer = txtAns.Text; acct.question = txtQues.Text; if (ASMDB.getInstance().updateAccount(acct)) { resetColors(); acctList.Items.Remove(current); acctList.Items.Add(current); acctList.SelectedItem = current; } }
private void chatControl_Click(object sender, EventArgs e) { if (chatControl.DialogResult == DialogResult.Yes) { if (cv == null || cv.IsDisposed) { // of not created yet or has been closed cv = new ChatView(this); cv.Show(); } if (cv != null && !cv.IsDisposed) { cv.start(); } } else { if (cv != null && !cv.IsDisposed) { cv.stop(); } } ASMDB db = ASMDB.getInstance(); }
private void clearDatabaseErrorsToolStripMenuItem_Click(object sender, EventArgs e) { ASMDB asmdb = ASMDB.getInstance(); asmdb.clearMySQLErrors(); }