コード例 #1
0
        public void MultipleQueriesTest()
        {
            IQueryConnection conn = new QueryConnection();

            // Exampleserver: ARK VALGUERO Server
            conn.Host = "89.163.146.91";
            conn.Port = 27023;

            conn.Connect();
            var players1 = conn.GetPlayers();
            var players2 = conn.GetPlayers();

            //conn.Disconnect();
            // Console.WriteLine(players1.ToString());
            // Console.WriteLine(players2.ToString());
            // Console.WriteLine(players3.ToString());
            // Console.WriteLine(players4.ToString());
            // Console.WriteLine(players5.ToString());
        }
コード例 #2
0
        static void Main(string[] args)
        {
            IQueryConnection conn = new QueryConnection();

            conn.Host = "127.0.0.1";
            conn.Port = 27015;

            conn.Connect();

            var info = conn.GetInfo();

            Console.WriteLine($"Server info: {info.ToString()}");
            var players = conn.GetPlayers();

            Console.WriteLine($"Current players: {string.Join("; ", players.Players.Select(p => p.Name))}");
            var rules = conn.GetRules();

            Console.WriteLine($"Rules: {string.Join("; ", rules.Rules.Select(r => $"{r.Key}: {r.Value}"))}");
        }