Beispiel #1
0
        public mainWindow()
        {
            InitializeComponent();
            if (ConfigFile.Load("config.xml") == false)
            {
                Utils.CreateDefaultConfigFile(System.IO.Directory.GetCurrentDirectory() + @"\\config.xml");
            }
            if (FavFile.Load("favlist.xml") == false)
            {
                Utils.CreateDefaultFavList(System.IO.Directory.GetCurrentDirectory() + @"\\favlist.xml");
            }

            Server myServ = new Server("s2.gta-multiplayer.cz:7777", ConfigFile.GetUserConfig("defaultnick"));

            grid_serverList.UpdateTimerInterval = 3000;

            toolStripTxtBox_nickname.Text = ConfigFile.GetUserConfig("defaultnick");

            WebLists.Load("http://monitor.sacnr.com/list/masterlist.txt", "http://monitor.sacnr.com/list/hostedlist.txt");
            FavFile.GenerateFavList();

            grid_serverList.AddServerList(FavFile.FavList);

            grid_serverList.StartUpdateTimer();
        }
Beispiel #2
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            if (Utils.IsValidIpAddress(Utils.ParseIPFromIPPort(txtBox_serverip.Text)) && Utils.IsValidPort(Utils.ParsePortFromIPPort(txtBox_serverip.Text)))
            {
                string defaultnick = txtBox_defaultnick.Text;
                if (String.IsNullOrWhiteSpace(txtBox_defaultnick.Text))
                {
                    defaultnick = ConfigFile.GetUserConfig("defaultnick");
                }

                if (!FavFile.AddServer(new Server(txtBox_serverip.Text, defaultnick), defaultnick))
                {
                    lbl_error.Text = "Something is broken (maybe you already have this server ?) !";
                    ShowErrorLabel(3000);
                }
                else
                {
                    FavFile.GenerateFavList();
                    FavFile.Save();
                    this.Close();
                }
            }
            else
            {
                lbl_error.Text = "Incorrect IP Format";
                ShowErrorLabel(3000);
            }
        }