public ServerForm(string clientId, string serverId, string chordAddress, int chordPort) { InitializeComponent(); statusBox.ReadOnly = true; string serverName = serverId; Config.Instance.ChooseClientSetOfReplicas(clientId); ServerConfig serverConfiguration = (Config.Instance.ServersConfiguration.Where(p => p.Name == serverId)).ToArray<ServerConfig>()[0]; List<string> replicas = new List<string>((from p in Config.Instance.ServersConfiguration where p.Name.Equals(serverId) != true select p.Address + ":" + p.Port + "/" + p.Name).ToList<string>()); this.Text += " @ " + serverConfiguration.Address + ":" + serverConfiguration.Port; PADIBook.Server.Server serv = new PADIBook.Server.Server(serverConfiguration.Name, serverConfiguration.Address, serverConfiguration.Port, replicas, chordAddress, chordPort); ServerManager.Instance.RegisterServer(serv); ServerManager.Instance.StartServer(); }
public ServerForm(string clientId, string serverId, string chordAddress, int chordPort) { InitializeComponent(); statusBox.ReadOnly = true; string serverName = serverId; Config.Instance.ChooseClientSetOfReplicas(clientId); ServerConfig serverConfiguration = (Config.Instance.ServersConfiguration.Where(p => p.Name == serverId)).ToArray <ServerConfig>()[0]; List <string> replicas = new List <string>((from p in Config.Instance.ServersConfiguration where p.Name.Equals(serverId) != true select p.Address + ":" + p.Port + "/" + p.Name).ToList <string>()); this.Text += " @ " + serverConfiguration.Address + ":" + serverConfiguration.Port; PADIBook.Server.Server serv = new PADIBook.Server.Server(serverConfiguration.Name, serverConfiguration.Address, serverConfiguration.Port, replicas, chordAddress, chordPort); ServerManager.Instance.RegisterServer(serv); ServerManager.Instance.StartServer(); }
private void StartButton_Click(object sender, EventArgs e) { if (!comboBox.Text.Equals("")) { try { string serverName = comboBox.Text; Config.Instance.ChooseClientSetOfReplicas(setComboBox.Text); ServerConfig serverConfiguration = (Config.Instance.ServersConfiguration.Where(p => p.Name == comboBox.Text)).ToArray <ServerConfig>()[0]; List <string> replicas = new List <string>((from p in Config.Instance.ServersConfiguration where p.Name.Equals(comboBox.Text) != true select p.Address + ":" + p.Port + "/" + p.Name).ToList <string>()); AddressPort = serverConfiguration.Address + ":" + serverConfiguration.Port; PADIBook.Server.Server serv; if (includeChordNodeCheckBox.Checked) { if (chordNodeAddressTextBox.Text == "") { MessageBox.Show("Por favor insira um endereço para o nó do Chord."); return; } serv = new PADIBook.Server.Server(serverConfiguration.Name, serverConfiguration.Address, serverConfiguration.Port, replicas, chordNodeAddressTextBox.Text, Int32.Parse(chordPortTextBox.Text)); } else { serv = new PADIBook.Server.Server(serverConfiguration.Name, serverConfiguration.Address, serverConfiguration.Port, replicas); } ServerManager.Instance.RegisterServer(serv); ServerManager.Instance.StartServer(); this.Close(); } catch (FormatException) { MessageBox.Show("Unable to parse port number."); } } }
private void StartButton_Click(object sender, EventArgs e) { if (!comboBox.Text.Equals("")) { try { string serverName = comboBox.Text; Config.Instance.ChooseClientSetOfReplicas(setComboBox.Text); ServerConfig serverConfiguration = (Config.Instance.ServersConfiguration.Where(p => p.Name == comboBox.Text)).ToArray<ServerConfig>()[0]; List<string> replicas = new List<string>((from p in Config.Instance.ServersConfiguration where p.Name.Equals(comboBox.Text) != true select p.Address + ":" + p.Port + "/" + p.Name).ToList<string>()); AddressPort = serverConfiguration.Address + ":" + serverConfiguration.Port; PADIBook.Server.Server serv; if (includeChordNodeCheckBox.Checked) { if (chordNodeAddressTextBox.Text == "") { MessageBox.Show("Por favor insira um endereço para o nó do Chord."); return; } serv = new PADIBook.Server.Server(serverConfiguration.Name, serverConfiguration.Address, serverConfiguration.Port, replicas, chordNodeAddressTextBox.Text, Int32.Parse(chordPortTextBox.Text)); } else { serv = new PADIBook.Server.Server(serverConfiguration.Name, serverConfiguration.Address, serverConfiguration.Port, replicas); } ServerManager.Instance.RegisterServer(serv); ServerManager.Instance.StartServer(); this.Close(); } catch (FormatException) { MessageBox.Show("Unable to parse port number."); } } }
public void RegisterServer(Server server) { this.server = server; }