示例#1
0
        private void btn_quickCon_Click(object sender, EventArgs e)
        {
            lbl_error.Text = "Error : ";
            bool errorOccured = false;

            if (!Utils.IsValidIpAddress(Utils.ParseIPFromIPPort(txtBox_hostAddr.Text)))
            {
                lbl_error.Text += "invalid host address ";
                errorOccured    = true;
            }
            if (txtBox_nickname.Text.Length == 0)
            {
                lbl_error.Text += "invalid nickname";
                errorOccured    = true;
            }

            if (errorOccured)
            {
                ShowErrorLabel(5000); return;
            }

            if (chckBox_debugMode.Checked)
            {
                GTAUtils.LaunchGTAInjected(Utils.ParseIPFromIPPort(txtBox_hostAddr.Text), Utils.ParsePortFromIPPort(txtBox_hostAddr.Text), txtBox_nickname.Text, txtBox_password.Text, true);
            }
            else
            {
                GTAUtils.LaunchGTAInjected(Utils.ParseIPFromIPPort(txtBox_hostAddr.Text), Utils.ParsePortFromIPPort(txtBox_hostAddr.Text), txtBox_nickname.Text, txtBox_password.Text);
            }

            this.Close();
            return;
        }
示例#2
0
        public settingsWindow()
        {
            InitializeComponent();
            fileDialog_gtaSaExe.Filter = "Exe Files|*.exe";
            string gtaPath = ConfigFile.GetUserConfig("gtapath");

            if (gtaPath.Length == 0)
            {
                txtBox_gtaPath.Text = GTAUtils.GetGTADir();
            }
            else
            {
                txtBox_gtaPath.Text = gtaPath;
            }

            txtBox_setNick.Text = ConfigFile.GetUserConfig("defaultnick");
        }
示例#3
0
        private void toolStripBtn_connect_Click(object sender, EventArgs e)
        {
            int    nickOption = 0; // for debug purpose
            string nick       = ConfigFile.GetUserConfig("defaultnick");

            if (chckBox_useNicknameDefault.Checked && (!String.IsNullOrWhiteSpace(toolStripTxtBox_nickname.Text)))
            {
                nickOption = 1;
                nick       = toolStripTxtBox_nickname.Text;
            }
            else if (!String.IsNullOrWhiteSpace(grid_serverList.GetSelectedServer().Nickname))
            {
                nickOption = 2;
                nick       = grid_serverList.GetSelectedServer().Nickname;
            }
            Debug.WriteLine("Version : " + grid_serverList.GetSelectedServer().GetVersion());
            Debug.WriteLine("Nickname used (" + nickOption + ") : " + nick);
            GTAUtils.ConnectClientTo(grid_serverList.GetSelectedServer(), nick, false);
        }
示例#4
0
文件: Utils.cs 项目: vic1997/SAMP_Ex
        public static bool CreateDefaultConfigFile(string path)
        {
            try
            {
                XDocument doc = new XDocument(
                    new XDeclaration("1.0", "utf-8", "yes"),
                    new XComment("Launcher configuration file"),
                    new XElement("configuration",
                                 new XElement("user",
                                              new XElement("defaultnick", ""),
                                              new XElement("gtapath", GTAUtils.GetGTADir()))),
                    new XElement("sampdll"));

                doc.Save(path);

                return(false);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }