コード例 #1
0
        public void AddNewServer(string address)
        {
            // ignore if address already exists
            if (ServerModel.Servers.Any(s => s.EndPoint.ToString() == address))
            {
                return;
            }

            ServerModel.AddServer(address);
            ServerModel.QueryServers();

            // save to file
            var addresses = ServerModel.Servers.Select(x => x.EndPoint.ToString()).ToArray();

            File.WriteAllLines(savefile, addresses);
        }