Exemplo n.º 1
0
        public void loadColors()
        {
            //Retrieve color settings from registry.
            RegistryControl reg = new RegistryControl();

            windowColor = Color.FromArgb(int.Parse(reg.GetSetting("SH", "Minebot SMP", "bcr", 255).ToString()), int.Parse(reg.GetSetting("SH", "Minebot SMP", "bcg", 255).ToString()), int.Parse(reg.GetSetting("SH", "Minebot SMP", "bcb", 255).ToString()));
            TextColor   = Color.FromArgb(int.Parse(reg.GetSetting("SH", "Minebot SMP", "ter", 0).ToString()), int.Parse(reg.GetSetting("SH", "Minebot SMP", "teg", 0).ToString()), int.Parse(reg.GetSetting("SH", "Minebot SMP", "teb", 0).ToString()));
            TextAColor  = Color.FromArgb(int.Parse(reg.GetSetting("SH", "Minebot SMP", "bgr", 192).ToString()), int.Parse(reg.GetSetting("SH", "Minebot SMP", "bgg", 192).ToString()), int.Parse(reg.GetSetting("SH", "Minebot SMP", "bgb", 192).ToString()));

            flatten  = Boolean.Parse(reg.GetSetting("SH", "Minebot SMP", "flat", "false").ToString());
            colorize = Boolean.Parse(reg.GetSetting("SH", "Minebot SMP", "colored", "true").ToString());

            if (flatten == true)
            {
                btnSend.FlatStyle = FlatStyle.Flat;
            }
            else
            {
                btnSend.FlatStyle = FlatStyle.Standard;
            }

            //Set the colors from this form, the other forms will pull from this form to color themselves.
            this.BackColor           = windowColor;
            this.ForeColor           = TextColor;
            btnSend.ForeColor        = TextColor;
            btnSend.BackColor        = windowColor;
            this.lstOnline.BackColor = TextAColor;
            lstOnline.ForeColor      = TextColor;
            console.BackColor        = TextAColor;
            console.ForeColor        = TextColor;
            chat.BackColor           = TextAColor;
            chat.ForeColor           = TextColor;
            this.ResumeLayout(false);
            this.PerformLayout();
        }
Exemplo n.º 2
0
        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            RegistryControl Reg = new RegistryControl();

            Reg.SaveSetting("SH", "Minebot SMP", "flat", checkBox2.Checked.ToString());
            myform.loadColors();
        }
Exemplo n.º 3
0
        private void btnRemAdmin_Click(object sender, EventArgs e)
        {
            RegistryControl Reg = new RegistryControl();

            string selected = (string)lstAdmins.SelectedItem;
            string admins   = (string)Reg.GetSetting("SH", "Minebot SMP", "Admins", "");

            if (selected == null)
            {
                return;
            }

            admins = admins.Replace(selected + "|", "");
            Reg.SaveSetting("SH", "Minebot SMP", "Admins", admins);
            lstAdmins.Items.Clear();
            myform.admins.Clear();

            string[] mysplits = admins.Split('|');

            for (int i = 0; i < mysplits.Length; i++)
            {
                if (mysplits[i] != "")
                {
                    myform.admins.Add(mysplits[i]);
                    lstAdmins.Items.Add(mysplits[i]);
                }
            }

            if (!myform.admins.Contains("Minebot"))
            {
                myform.admins.Add("Minebot");
                lstAdmins.Items.Add("Minebot");
            }
        }
Exemplo n.º 4
0
        private void btnAddAdmin_Click(object sender, EventArgs e)
        {
            RegistryControl Reg = new RegistryControl();

            string name   = Interaction.InputBox("What is the admin's in-game username?", "Username");
            string admins = (string)Reg.GetSetting("SH", "Minebot SMP", "Admins", "");

            admins += name + "|";
            Reg.SaveSetting("SH", "Minebot SMP", "Admins", admins);
            myform.admins.Clear();
            lstAdmins.Items.Clear();

            string[] mysplits = admins.Split('|');

            for (int i = 0; i < mysplits.Length; i++)
            {
                if (mysplits[i] != "")
                {
                    myform.admins.Add(mysplits[i]);
                    lstAdmins.Items.Add(mysplits[i]);
                }
            }

            if (!myform.admins.Contains("Minebot"))
            {
                myform.admins.Add("Minebot");
                lstAdmins.Items.Add("Minebot");
            }
        }
Exemplo n.º 5
0
        private void btnAddFav_Click(object sender, EventArgs e)
        {
            // As much as I wanted to stay away from VB Methods, there is no equivelant of this in C#.
            string          name = Interaction.InputBox("What is the name for your server?", "Server Name");
            string          ip   = Interaction.InputBox("What is the server's IP?", "Server IP");
            string          port = Interaction.InputBox("What is the server's port?", "Server Port");
            RegistryControl reg  = new RegistryControl();

            string Favorites = (string)reg.GetSetting("SH", "Minebot SMP", "Fav", "");

            Favorites += name + "|" + ip + "|" + port + "=";
            reg.SaveSetting("SH", "Minebot SMP", "Fav", Favorites);
            lstFav.Items.Clear();

            if (Favorites.Contains("=") && Favorites.Contains("|"))
            {
                string[] Favsplit = Favorites.Split('=');

                for (int i = 0; i < (Favsplit.Length); i++)
                {
                    if (Favsplit[i] != "")
                    {
                        favs.Add(Favsplit[i]);
                        lstFav.Items.Add(Favsplit[i].Split('|')[0]);
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void button3_Click(object sender, EventArgs e)
        {
            colorDialog1.ShowDialog();
            myform.windowColor = colorDialog1.Color;

            RegistryControl Reg = new RegistryControl();

            Reg.SaveSetting("SH", "Minebot SMP", "ter", colorDialog1.Color.R.ToString());
            Reg.SaveSetting("SH", "Minebot SMP", "teg", colorDialog1.Color.G.ToString());
            Reg.SaveSetting("SH", "Minebot SMP", "teb", colorDialog1.Color.B.ToString());
            myform.loadColors();
        }
Exemplo n.º 7
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Load interface Customizations
            loadColors();

            // Load bot allowed administrators.

            RegistryControl Reg = new RegistryControl();

            admins = new List <string>();

            string AdminString = Reg.GetSetting("SH", "Minebot SMP", "admins", "").ToString();

            if (AdminString != "")
            {
                string[] mysplits = AdminString.Split('|');

                for (int i = 0; i < mysplits.Length; i++)
                {
                    if (mysplits[i] != "")
                    {
                        admins.Add(mysplits[i]);
                    }
                }
            }

            // Load IRC settings
            try
            {
                ircIP   = (string)Reg.GetSetting("SH", "Minebot SMP", "ircIP", "irc.esper.net");
                ircPort = int.Parse(Reg.GetSetting("SH", "Minebot SMP", "ircPort", 6667).ToString());
                channel = (string)Reg.GetSetting("SH", "Minebot SMP", "ircChan", "#bot");
                ircname = (string)Reg.GetSetting("SH", "Minebot SMP", "ircName", "VBMinebot");
            }
            catch (Exception f)
            {
                puts("An error occured while loading IRC settings. This shouldn't affect functionality of the bot. \n" + f.Message);
            }

            // Load command prefix

            RegistryControl reg = new RegistryControl();

            prefix = (string)reg.GetSetting("SH", "Minebot SMP", "prefix", "+");

            admins.Add("Minebot");

            putsc("=_=_=_= C# Minebot =_=_=_=", Color.Yellow);
            putsc("=+=+=+= Version 1.5 =+=+=+=", Color.Blue);
            putsc("======= by Umby24 ========", Color.Red);
            putsc("-------- All settings loaded ---------", Color.Orange);
        }
Exemplo n.º 8
0
        private void btnRemFav_Click(object sender, EventArgs e)
        {
            string name = lstFav.GetItemText(lstFav.SelectedItem);

            if (name == "" || name == null)
            {
                MessageBox.Show("No item selected.");
                return;
            }

            RegistryControl reg = new RegistryControl();
            string          fullstring;
            string          Favorites = (string)reg.GetSetting("SH", "Minebot SMP", "Fav", "");
            string          temp      = Favorites.Substring(0, Favorites.IndexOf(name));


            if (temp.Length != 0)
            {
                fullstring = Favorites.Replace(temp, "");
            }
            else
            {
                fullstring = Favorites;
            }

            fullstring = fullstring.Substring(0, fullstring.IndexOf("=") + 1);
            Favorites  = Favorites.Replace(fullstring, "");
            reg.SaveSetting("SH", "Minebot SMP", "Fav", Favorites);
            lstFav.Items.Clear();

            if (Favorites.Contains("=") && Favorites.Contains("|"))
            {
                string[] Favsplit = Favorites.Split('=');
                for (int i = 0; i < (Favsplit.Length); i++)
                {
                    if (Favsplit[i] != "")
                    {
                        favs.Add(Favsplit[i]);
                        lstFav.Items.Add(Favsplit[i].Split('|')[0]);
                    }
                }
            }
        }
Exemplo n.º 9
0
        public void startIRC()
        {
            RegistryControl Reg = new RegistryControl();

            ircIP = (string)Reg.GetSetting("SH", "Minebot SMP", "ircIP", "irc.esper.net");

            int.TryParse((string)Reg.GetSetting("SH", "Minebot SMP", "ircPort", 6667), out ircPort);
            channel = (string)Reg.GetSetting("SH", "Minebot SMP", "ircChan", "#bot");
            ircname = (string)Reg.GetSetting("SH", "Minebot SMP", "ircName", "VBMimebot");

            IRCSock               = new Winsock();
            IRCSock.BufferSize    = 8192;
            IRCSock.LegacySupport = true;
            IRCSock.Protocol      = Winsock_Orcas.WinsockProtocol.Tcp;
            IRCSock.Connected    += new Winsock_Orcas.IWinsock.ConnectedEventHandler(IRCSock_Connected);
            IRCSock.DataArrival  += new Winsock_Orcas.IWinsock.DataArrivalEventHandler(IRCSock_DataArrival);
            IRCSock.Connect(ircIP, ircPort);

            puts(Environment.NewLine + "Connecting.");
        }
Exemplo n.º 10
0
        private void Settings_Load(object sender, EventArgs e)
        {
            favs = new List <string>();
            RegistryControl reg = new RegistryControl();

            linkLabel1.Links.Add(0, linkLabel1.Text.Length, linkLabel1.Text);
            linkLabel2.Links.Add(0, linkLabel2.Text.Length, linkLabel2.Text);

            checkBox2.Checked = myform.flatten;
            txtIP.Text        = (string)reg.GetSetting("SH", "Minebot SMP", "IP", "smp.mcsteamed.net");
            txtPort.Text      = reg.GetSetting("SH", "Minebot SMP", "Port", 25566).ToString();
            txtUN.Text        = (string)reg.GetSetting("SH", "Minebot SMP", "Username", "Minebot");
            txtPW.Text        = (string)reg.GetSetting("SH", "Minebot SMP", "Password", "pie");
            txtIrcIP.Text     = (string)reg.GetSetting("SH", "Minebot SMP", "ircIP", "irc.esper.net");
            txtIRCPort.Text   = reg.GetSetting("SH", "Minebot SMP", "ircPort", 6667).ToString();
            txtIrcChan.Text   = (string)reg.GetSetting("SH", "Minebot SMP", "ircChan", "#bot");
            txtIrcNick.Text   = (string)reg.GetSetting("SH", "Minebot SMP", "ircName", "VBMimebot");
            cbOnline.Checked  = bool.Parse((string)reg.GetSetting("SH", "Minebot SMP", "Online", true));
            txtPrefix.Text    = (string)reg.GetSetting("SH", "Minebot SMP", "prefix", "+");

            // Load in admins from main form
            for (int i = 0; i < (myform.admins.Count); i++)
            {
                lstAdmins.Items.Add(myform.admins[i]);
            }

            string Favorites = (string)reg.GetSetting("SH", "Minebot SMP", "Fav", "");

            if (Favorites.Contains("=") && Favorites.Contains("|"))
            {
                string[] Favsplit = Favorites.Split('=');
                for (int i = 0; i < (Favsplit.Length); i++)
                {
                    if (Favsplit[i] != "")
                    {
                        favs.Add(Favsplit[i]);
                        lstFav.Items.Add(Favsplit[i].Split('|')[0]);
                    }
                }
            }
        }
Exemplo n.º 11
0
        private void txtPrefix_TextChanged(object sender, EventArgs e)
        {
            RegistryControl reg = new RegistryControl();

            reg.SaveSetting("SH", "Minebot SMP", "prefix", txtPrefix.Text);
        }
Exemplo n.º 12
0
        private void txtIrcNick_TextChanged(object sender, EventArgs e)
        {
            RegistryControl Reg = new RegistryControl();

            Reg.SaveSetting("SH", "Minebot SMP", "ircName", txtIrcNick.Text);
        }
Exemplo n.º 13
0
        private void txtPW_TextChanged(object sender, EventArgs e)
        {
            RegistryControl Reg = new RegistryControl();

            Reg.SaveSetting("SH", "Minebot SMP", "Password", txtPW.Text);
        }
Exemplo n.º 14
0
        private void cbOnline_CheckedChanged(object sender, EventArgs e)
        {
            RegistryControl Reg = new RegistryControl();

            Reg.SaveSetting("SH", "Minebot SMP", "Online", cbOnline.Checked.ToString());
        }