Esempio n. 1
0
        private void BtnPlay_Click(object sender, EventArgs e)
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(Properties.Settings.Default.XMLServersListFile);
            XmlNodeList nodes = xmlDoc.SelectNodes("/Servers/Server");

            foreach (XmlNode node in nodes)
            {
                if (node.Attributes["name"].InnerText == Properties.Settings.Default.SelectedServer)
                {
                    UpdateWoWConfigAndStart
                    (
                        node["WoWPath"].InnerText,
                        node["Realmlist"].InnerText,
                        Convert.ToBoolean(node.Attributes["fill"].InnerText) ? node["Account"].InnerText : string.Empty,
                        Convert.ToBoolean(node.Attributes["cache"].InnerText)
                    );
                }
            }
            xmlDoc.Save(Properties.Settings.Default.XMLServersListFile);

            WoWRealmListChanger MWL = (WoWRealmListChanger)FindForm();

            // send app to system tray
            MWL.WindowState = FormWindowState.Minimized;
            MWL.notifyIcon.ShowBalloonTip(1000);
        }
Esempio n. 2
0
        private void BtnModify_Click(object sender, EventArgs e)
        {
            CMessageBox  myCMessageBox = new CMessageBox();
            DialogResult result        = myCMessageBox.Show("Edit Server", "Do you really want to modify this server?");

            if (result == DialogResult.Yes)
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(Properties.Settings.Default.XMLServersListFile);
                foreach (XmlNode node in xmlDoc.SelectNodes("/Servers/Server"))
                {
                    if (node.Attributes["name"].InnerText == Properties.Settings.Default.SelectedServer)
                    {
                        node.Attributes["name"].InnerText  = TxbServerName.Text;
                        node["Realmlist"].InnerText        = TxbRealmlist.Text;
                        node["Account"].InnerText          = TxbAccount.Text;
                        node["WoWPath"].InnerText          = TxbWoWPath.Text;
                        node.Attributes["cache"].InnerText = CbCache.Checked.ToString();
                        node.Attributes["fill"].InnerText  = CbFill.Checked.ToString();
                    }
                }
                xmlDoc.Save(Properties.Settings.Default.XMLServersListFile);

                Properties.Settings.Default.SelectedServer = TxbServerName.Text;
                Properties.Settings.Default.Save();

                WoWRealmListChanger MWL = (WoWRealmListChanger)FindForm();
                MWL.ClearDisplayPanel();
                MWL.PanelDisplay.Controls.Add(new UserControlServersList());
            }
        }
Esempio n. 3
0
        private void BtnAddorModify_Click(object sender, EventArgs e)
        {
            WoWRealmListChanger MWL = (WoWRealmListChanger)FindForm();

            MWL.ClearDisplayPanel();
            MWL.PanelDisplay.Controls.Add(new UserControlEditServer());
        }
Esempio n. 4
0
        private void BtnAddNew_Click(object sender, EventArgs e)
        {
            CMessageBox  myCMessageBox = new CMessageBox();
            DialogResult result        = myCMessageBox.Show("New Server", "Add new server to list?\n\n" + TxbServerName.Text);

            if (result == DialogResult.Yes)
            {
                bool IsDuplicate = false;

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(Properties.Settings.Default.XMLServersListFile);
                XmlNodeList nodes = xmlDoc.SelectNodes("/Servers/Server");

                foreach (XmlNode node in nodes)
                {
                    if (node.Attributes["name"].InnerText == TxbServerName.Text)
                    {
                        IsDuplicate = true;
                    }
                }

                if (IsDuplicate)
                {
                    CMessageBox myAlertBox = new CMessageBox();
                    myAlertBox.Show("Alertbox", "That server name already exists, please chose another name!", Color.Red, Color.IndianRed, true);
                    myAlertBox.Dispose();
                }
                else
                {
                    XDocument xdoc = XDocument.Load(Properties.Settings.Default.XMLServersListFile);
                    XElement  root = xdoc.Element("Servers");
                    root.Add(new XElement("Server",
                                          new XAttribute("name", TxbServerName.Text),
                                          new XAttribute("cache", CbCache.Checked.ToString()),
                                          new XAttribute("fill", CbFill.Checked.ToString()),

                                          new XElement("Realmlist", TxbRealmlist.Text),
                                          new XElement("Account", TxbAccount.Text),
                                          new XElement("WoWPath", TxbWoWPath.Text)
                                          )
                             );

                    xdoc.Save(Properties.Settings.Default.XMLServersListFile);

                    WoWRealmListChanger MWL = (WoWRealmListChanger)FindForm();
                    MWL.ClearDisplayPanel();
                    MWL.PanelDisplay.Controls.Add(new UserControlServersList());
                }
            }
            myCMessageBox.Dispose();
        }
Esempio n. 5
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                CMessageBox  myCMessageBox = new CMessageBox();
                DialogResult result        = myCMessageBox.Show("Confirm Removal", "Do you really want to remove that server?");
                if (result == DialogResult.Yes)
                {
                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load(Properties.Settings.Default.XMLServersListFile);
                    XmlNodeList nodes  = xmlDoc.SelectNodes("/Servers/Server");
                    XmlNode     parent = xmlDoc.SelectSingleNode("/Servers");

                    foreach (XmlNode node in nodes)
                    {
                        if (node.Attributes["name"].InnerText == Properties.Settings.Default.SelectedServer)
                        {
                            parent.RemoveChild(node);
                        }
                    }

                    xmlDoc.Save(Properties.Settings.Default.XMLServersListFile);

                    WoWRealmListChanger MWL = (WoWRealmListChanger)FindForm();
                    MWL.ClearDisplayPanel();
                    MWL.PanelDisplay.Controls.Add(new UserControlServersList());
                }
                myCMessageBox.Dispose();
            }
            catch (Exception ex)
            {
                CMessageBox myAlertBox = new CMessageBox();
                myAlertBox.Show("Alertbox", ex.Message, Color.Red, Color.IndianRed, true);
                myAlertBox.Dispose();
            }
        }