コード例 #1
0
 public async Task Test1() {
     SharedSupport.Init();
     var serverAddress = new ServerAddress(IPAddress.Parse("37.220.18.218"), 27016);
     var query = new SourceServerQuery(serverAddress, "dayz",
         new SourceQueryParser());
     await
         query.UpdateAsync(new ServerQueryState {
             Server = new ArmaServer(A.Fake<Arma3Game>(), serverAddress)
         });
 }
コード例 #2
0
 public async Task ServerInfo() {
     var mq = new SourceMasterQuery("dayz");
     var servers = await mq.GetParsedServers(false, 200).ConfigureAwait(false);
     //TODO: not all servers returned will respond, allow timeout or verify good servers?
     servers = servers.OrderBy(x => Guid.NewGuid()).Take(3);
     foreach (var d in servers) {
         var split = d.Settings["address"].Split(':');
         var sq = new SourceServerQuery(new ServerAddress(IPAddress.Parse(split[0]), Convert.ToInt32(split[1])),
             "dayz", new SourceQueryParser());
         var state = new ServerQueryState {Server = A.Fake<Server>()};
         await sq.UpdateAsync(state).ConfigureAwait(false);
         state.Exception.Should().BeNull();
         state.Success.Should().BeTrue();
     }
 }