private void AddForm_Load(object sender, EventArgs e) { this.userFile = new UserFile(); if (this.userFile.Read()) { foreach (var us in this.userFile.Servers) { ServerIp ip = new ServerIp(us.Address, us.Port); this.serverItems.Add(new ServerItem(ip, us.Hostname, us.Password, us.Rcon)); } } else { this.userFile.Default(); } gridListServers.DataSource = this.serverItems; gridListServers.Grid.ColWidths[1] = 40; gridListServers.Grid.ColWidths[2] = 60; gridListServers.Grid.ColWidths[3] = 235; gridListServers.Grid.ColWidths[4] = 120; gridListServers.Grid.ColWidths[5] = 110; gridListServers.SelectedIndex = -1; buttonDelete.Enabled = false; }
public ServerQuery(ServerIp server) { if (server == null || server.Address == null || server.Port == 0) { throw new ArgumentNullException("Ip adresa i/ili port nisu definisani."); } this.serverIp = server; this.serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); this.serverSocket.SendTimeout = 10000; this.serverSocket.ReceiveTimeout = 10000; try { this.endPoint = new IPEndPoint(serverIp.Address, serverIp.Port); } catch { throw; } }
private void buttonClose_Click(object sender, EventArgs e) { workerServer.CancelAsync(); this.gridListServers.SelectedIndex = -1; this.serverIp = null; this.Close(); }
private void buttonOK_Click(object sender, EventArgs e) { workerServer.CancelAsync(); if (gridListServers.SelectedIndex == -1) { TitleError title = new TitleError(); string msg = "Za promjenu servera odaberite isti sa liste prije potvrde!"; MessageBoxAdv.Show(msg, title.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int index = gridListServers.SelectedIndex; this.serverIp = serverItems[index].GetServer(); var us = this.userFile.ServerList[index]; this.userFile.ServerList.Remove(userFile.ServerList[index]); this.userFile.ServerList.Insert(0, us); } if (!this.userFile.Write()) { TitleError title = new TitleError(); string msg = "Doslo je do greske prilikom spremanja server liste!"; MessageBoxAdv.Show(msg, title.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Close(); }
private void buttonOK_Click(object sender, EventArgs e) { string text; this.serverIp = new ServerIp(this.textAddress.Text, (int)this.numericPort.Value); if (this.serverIp.Address == null) { TitleError error = new TitleError(); text = "Server adresa nije validna, pokusajte ponovo unijeti istu."; MessageBoxAdv.Show(text, error.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); serverIp = null; return; } ServerPing sp = new ServerPing(serverIp); if (sp.Ping() > 0) { this.userFile.ServerList.Insert(0, new UserServer(this.textAddress.Text, (int)this.numericPort.Value)); this.userFile.Write(); this.Close(); return; } TitleWarning warn = new TitleWarning(); text = "Server nije odgovorio na zahtjev, pokusajte ponovo potvrditi!"; MessageBoxAdv.Show(text, warn.Caption, MessageBoxButtons.OK, MessageBoxIcon.Warning); }
public ServerItem(ServerIp server, bool key, int players, int max, string host, string game, string lang) : this(server, host) { this.serverKey = key; this.serverCurPlayers = players; this.serverMaxPlayers = max; this.serverGamemode = game; this.serverLanguage = lang; }
public PlayersForm(ServerIp server) { InitializeComponent(); serverIp = server; labelPlayers.Text = "...loading"; playerList = new List <PlayerInfo>(); }
private string serverLanguage; //jezik servera public ServerInfo(ServerIp server) : base(server) { serverPassword = false; currentPlayers = 0; maxPlayers = 0; serverHostname = null; serverGamemode = null; serverLanguage = null; }
private string serverLanguage; //jezik servera public ServerItem(ServerIp server) { this.serverIp = server; this.serverKey = false; this.serverPassword = null; this.serverCurPlayers = 0; this.serverMaxPlayers = 0; this.serverHostname = null; this.serverGamemode = null; this.serverLanguage = null; }
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); } }
private void buttonAdd_Click(object sender, EventArgs e) { this.Enabled = false; workerServer.CancelAsync(); ServerIp ip = new ServerIp(textAddress.Text, (int)numericPort.Value); if (ip.Address == null) { TitleError title = new TitleError(); string msg = "Server adresa nije validna, molimo vas unesite ispravan ip i port!"; MessageBoxAdv.Show(msg, title.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } serverInfo = new ServerInfo(ip); if (serverInfo.Info()) { serverItems.Add(new ServerItem(ip, serverInfo.Password, serverInfo.CurrentPlayers, serverInfo.MaxPlayers, serverInfo.Hostname, serverInfo.Gamemode, serverInfo.Language)); } else { serverItems.Add(new ServerItem(ip)); } ListSoruce(); gridListServers.SelectedIndex = -1; buttonDelete.Enabled = false; this.Enabled = true; }
public ServerPing(ServerIp server) : base(server) { //pingValue = Ping(); }
public ServerRule(ServerIp server) : base(server) { //nothing }
public ServerClient(ServerIp server) : base(server) { playerClient = new List <PlayerClient>(); }
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); }
public ServerItem(ServerIp server, string host, string password, string rcon) : this(server, host) { this.serverPassword = password; this.serverRcon = rcon; }
public ServerItem(ServerIp server, string host) : this(server) { this.serverHostname = host; }
public ServerPlayer(ServerIp server) : base(server) { playersInfo = new List <PlayerInfo>(); }