Update ASF base code to SK 2.0 alpha5

There is a lot of changes in this one, I like how we got rid of SteamProtocol and got SteamProtocols instead.
This commit is contained in:
JustArchi
2017-07-21 02:13:03 +02:00
parent be349d0557
commit f564cc5ebb
11 changed files with 34 additions and 175 deletions

View File

@@ -24,7 +24,6 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using Newtonsoft.Json;
using SteamKit2.Discovery;
@@ -32,17 +31,17 @@ using SteamKit2.Discovery;
namespace ArchiSteamFarm {
internal sealed class InMemoryServerListProvider : IServerListProvider {
[JsonProperty(Required = Required.DisallowNull)]
private readonly ConcurrentHashSet<IPEndPoint> Servers = new ConcurrentHashSet<IPEndPoint>();
private readonly ConcurrentHashSet<ServerRecord> Servers = new ConcurrentHashSet<ServerRecord>();
public Task<IEnumerable<IPEndPoint>> FetchServerListAsync() => Task.FromResult<IEnumerable<IPEndPoint>>(Servers);
public Task<IEnumerable<ServerRecord>> FetchServerListAsync() => Task.FromResult<IEnumerable<ServerRecord>>(Servers);
public Task UpdateServerListAsync(IEnumerable<IPEndPoint> endPoints) {
if (endPoints == null) {
ASF.ArchiLogger.LogNullError(nameof(endPoints));
public Task UpdateServerListAsync(IEnumerable<ServerRecord> endpoints) {
if (endpoints == null) {
ASF.ArchiLogger.LogNullError(nameof(endpoints));
return Task.CompletedTask;
}
HashSet<IPEndPoint> newServers = new HashSet<IPEndPoint>(endPoints);
HashSet<ServerRecord> newServers = new HashSet<ServerRecord>(endpoints);
if (!Servers.ReplaceIfNeededWith(newServers)) {
return Task.CompletedTask;