コード例 #1
0
        private void PropertyWindow_Load(object sender, EventArgs e)
        {
            lavaMapBrowser = new LavaMapBrowser();
            accountSetup = new MCForgeAccountSetup();

            Object[] colors = new Object[16];
            colors[0] = ("black"); colors[1] = ("navy");
            colors[2] = ("green"); colors[3] = ("teal");
            colors[4] = ("maroon"); colors[5] = ("purple");
            colors[6] = ("gold"); colors[7] = ("silver");
            colors[8] = ("gray"); colors[9] = ("blue");
            colors[10] = ("lime"); colors[11] = ("aqua");
            colors[12] = ("red"); colors[13] = ("pink");
            colors[14] = ("yellow"); colors[15] = ("white");
            cmbDefaultColour.Items.AddRange(colors);
            cmbIRCColour.Items.AddRange(colors);
            cmbColor.Items.AddRange(colors);
            cmbGlobalChatColor.Items.AddRange(colors);
            button3.Enabled = Server.WomDirect;

            if (Server.irc) grpIRC.BackColor = Color.White;
            else grpIRC.BackColor = Color.LightGray;
            if (Server.useMySQL) grpSQL.BackColor = Color.White;
            else grpSQL.BackColor = Color.LightGray;

            string opchatperm = String.Empty;
            string adminchatperm = String.Empty;
            string verifyadminsperm = String.Empty;
            string grieferstonerank = String.Empty;
            string afkkickrank = String.Empty;
            string viewqueuerank = String.Empty;
            string enterqueuerank = String.Empty;
            string leavequeuerank = String.Empty;
            string clearqueuerank = String.Empty;
            string gotonextrank = String.Empty;

            foreach (Group grp in Group.GroupList)
            {
                cmbDefaultRank.Items.Add(grp.name);
                cmbOpChat.Items.Add(grp.name);
                cmbAdminChat.Items.Add(grp.name);
                cmbVerificationRank.Items.Add(grp.name);
                lsCmbSetupRank.Items.Add(grp.name);
                lsCmbControlRank.Items.Add(grp.name);
                cmbGrieferStoneRank.Items.Add(grp.name);
                cmbAFKKickPerm.Items.Add(grp.name);
                cmbViewQueue.Items.Add(grp.name);
                cmbEnterQueue.Items.Add(grp.name);
                cmbLeaveQueue.Items.Add(grp.name);
                cmbClearQueue.Items.Add(grp.name);
                cmbGotoNext.Items.Add(grp.name);

                if (grp.Permission == Server.opchatperm)
                    opchatperm = grp.name;
                if (grp.Permission == Server.adminchatperm)
                    adminchatperm = grp.name;
                if (grp.Permission == Server.verifyadminsrank)
                    verifyadminsperm = grp.name;
                if (grp.Permission == Server.grieferStoneRank)
                    grieferstonerank = grp.name;
                if (grp.Permission == Server.afkkickperm)
                    afkkickrank = grp.name;
                if (grp.Permission == Server.reviewenter)
                    enterqueuerank = grp.name;
                if (grp.Permission == Server.reviewleave)
                    leavequeuerank = grp.name;
                if (grp.Permission == Server.reviewview)
                    viewqueuerank = grp.name;
                if (grp.Permission == Server.reviewclear)
                    clearqueuerank = grp.name;
                if (grp.Permission == Server.reviewnext)
                    gotonextrank = grp.name;
            }
            listPasswords.Items.Clear();
            if (Directory.Exists("extra/passwords"))
            {
                DirectoryInfo di = new DirectoryInfo("extra/passwords/");
                FileInfo[] fi = di.GetFiles("*.xml");
                Thread.Sleep(10);
                foreach (FileInfo file in fi)
                {
                    listPasswords.Items.Add(file.Name.Replace(".xml", ""));
                }
            }
            cmbDefaultRank.SelectedIndex = 1;
            cmbOpChat.SelectedIndex = (opchatperm != String.Empty ? cmbOpChat.Items.IndexOf(opchatperm) : 1);
            cmbAdminChat.SelectedIndex = (adminchatperm != String.Empty ? cmbAdminChat.Items.IndexOf(adminchatperm) : 1);
            cmbVerificationRank.SelectedIndex = (verifyadminsperm != String.Empty ? cmbVerificationRank.Items.IndexOf(verifyadminsperm) : 1);
            cmbGrieferStoneRank.SelectedIndex = (grieferstonerank != String.Empty ? cmbGrieferStoneRank.Items.IndexOf(grieferstonerank) : 1);
            cmbAFKKickPerm.SelectedIndex = (afkkickrank != String.Empty ? cmbAFKKickPerm.Items.IndexOf(afkkickrank) : 1);
            cmbEnterQueue.SelectedIndex = (enterqueuerank != String.Empty ? cmbEnterQueue.Items.IndexOf(enterqueuerank) : 1);
            cmbLeaveQueue.SelectedIndex = (leavequeuerank != String.Empty ? cmbLeaveQueue.Items.IndexOf(leavequeuerank) : 1);
            cmbViewQueue.SelectedIndex = (viewqueuerank != String.Empty ? cmbViewQueue.Items.IndexOf(viewqueuerank) : 1);
            cmbClearQueue.SelectedIndex = (clearqueuerank != String.Empty ? cmbClearQueue.Items.IndexOf(clearqueuerank) : 1);
            cmbGotoNext.SelectedIndex = (gotonextrank != String.Empty ? cmbGotoNext.Items.IndexOf(gotonextrank) : 1);

            for (byte b = 1; b < 50; b++)
                cmbGrieferStoneType.Items.Add(Block.Name(b));

            //Load server stuff
            LoadProp("properties/server.properties");
            LoadRanks();
            try
            {
                LoadCommands();
                LoadBlocks();
                LoadExtraCmdCmds();
            }
            catch
            {
                Server.s.Log("Failed to load commands and blocks!");
            }

            try
            {
                LoadLavaSettings();
                UpdateLavaMapList();
                UpdateLavaControls();
            }
            catch
            {
                Server.s.Log("Failed to load Lava Survival settings!");
            }

            try
            {
                lavaUpdateTimer = new System.Timers.Timer(10000);
                lavaUpdateTimer.AutoReset = true;
                lavaUpdateTimer.Elapsed += new System.Timers.ElapsedEventHandler(delegate
                {
                    UpdateLavaControls();
                    UpdateLavaMapList(false);
                });
                lavaUpdateTimer.Start();
            }
            catch
            {
                Server.s.Log("Failed to start lava control update timer!");
            }
            try { nudCooldownTime.Value = Server.reviewcooldown; }
            catch { }
            try { reviewlist_update(); }
            catch (Exception ex) { Server.ErrorLog(ex); }
        }
コード例 #2
0
 private void button5_Click(object sender, EventArgs e)
 {
     try
     {
         accountSetup.Show();
         accountSetup.Focus();
     }
     catch (ObjectDisposedException)
     {
         accountSetup = new MCForgeAccountSetup();
         accountSetup.Show();
         accountSetup.Focus();
     }
     catch (Exception ex) { Server.ErrorLog(ex); }
 }