Example #1
0
        private void newItemFileMenu_Click(object sender, EventArgs e)
        {
            workerStatus.CancelAsync();

            EnterForm enter = new EnterForm();

            enter.ShowDialog();

            if (enter.Server != null)
            {
                serverPing = new ServerPing(serverIp);
                serverInfo = new ServerInfo(serverIp);
            }

            if (!workerStatus.IsBusy)
            {
                workerStatus.RunWorkerAsync(0);
            }
        }
Example #2
0
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            workerStatus.CancelAsync();

            AddForm add = new AddForm();

            add.ShowDialog();
            if (add.Server != null)
            {
                this.serverIp = add.Server;
                //while (workerStatus.IsBusy) Thread.Sleep(10);
                serverPing = new ServerPing(serverIp);
                serverInfo = new ServerInfo(serverIp);
            }

            if (!workerStatus.IsBusy)
            {
                workerStatus.RunWorkerAsync(0);
            }
        }
Example #3
0
        public bool IsLive()
        {
            ServerPing sp = new ServerPing(this);

            return(sp.Ping() > 0 ? true : false);
        }
Example #4
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            this.sampRegistry = new SampRegistry();

            if (this.sampRegistry.Valid() && this.sampRegistry.Read())
            {
                this.textboxUser.Text = this.sampRegistry.PlayerName;
                this.pathGame         = this.sampRegistry.GetPath();
            }
            else
            {
                TitleWarning title = new TitleWarning();
                string       msg   = "Nemate podesen ili instaliran GTA San Andreas i SAMP.\n" +
                                     "Da li zelite sada odabrati lokaciju instalirane igre?";

                DialogResult result = MessageBoxAdv.Show(msg, title.Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    this.sampRegistry.Default();

                    if (folderDialog.ShowDialog() == DialogResult.OK)
                    {
                        this.sampRegistry.SetPath(folderDialog.SelectedPath);
                        this.pathGame = folderDialog.SelectedPath;
                        this.sampRegistry.Write();
                    }
                }

                this.textboxUser.Text = this.sampRegistry.PlayerName;
            }

            this.userFile = new UserFile();

            if (!this.userFile.Read() || this.userFile.Servers.Length == 0)
            {
                EnterForm enter = new EnterForm();
                enter.ShowDialog();

                if (enter.Server != null)
                {
                    serverPing = new ServerPing(serverIp);
                    serverInfo = new ServerInfo(serverIp);

                    workerStatus.RunWorkerAsync(0);
                    return;
                }
            }
            else
            {
                this.serverIp = new ServerIp(this.userFile.Servers[0].Address, this.userFile.Servers[0].Port);

                if (this.serverIp.Address == null)
                {
                    EnterForm enter = new EnterForm();
                    enter.ShowDialog();

                    if (enter.Server != null)
                    {
                        serverPing = new ServerPing(serverIp);
                        serverInfo = new ServerInfo(serverIp);

                        workerStatus.RunWorkerAsync(0);
                        return;
                    }
                }
            }

            serverPing = new ServerPing(serverIp);
            serverInfo = new ServerInfo(serverIp);
            workerStatus.RunWorkerAsync(0);
        }