Exemplo n.º 1
0
 private Task Run(CancellationToken ct)
 {
     if (AppId == (uint)SteamGameIds.Arma3)
     {
         return(SteamActions.PerformArmaSteamAction(async api => {
             SteamApi = api;
             await RunWebsite(ct).ConfigureAwait(false);
         }, (uint)SteamGameIds.Arma3, _steamSessionFactory));
     }
     SteamApi = new DummyApi();
     return(DoWithSteamSession(() => RunWebsite(ct)));
 }
Exemplo n.º 2
0
        public async Task GetServers()
        {
            LoggingSetup.Setup("Tests");
            LockedWrapper.callFactory = new SafeCallFactory(); // workaround for accessviolation errors
            var serverFilterBuilder = ServerFilterBuilder.Build();

            serverFilterBuilder.FilterByAddresses(new[] {
                new IPEndPoint(IPAddress.Parse("5.189.150.147"), 2302),
                new IPEndPoint(IPAddress.Parse("5.189.136.56"), 2302),
                new IPEndPoint(IPAddress.Parse("80.241.208.192"), 2302)
            });
            var s = await
                    SteamActions.PerformArmaSteamAction(
                steamApi => PerformAction(steamApi, serverFilterBuilder.GetServerFilterWrap()), (uint)SteamGameIds.Arma3,
                new SteamSession.SteamSessionFactory()).ConfigureAwait(false);

            s.Count.Should().Be(3);
            var json = s.ToJson(true);

            Console.WriteLine(json);
            @"C:\temp\crawl\arma-servers.json".ToAbsoluteFilePath().WriteText(json);
        }