public static IServiceCollection UseBlacklistFromAddress(this IServiceCollection services, string address) { AsyncHelper.TryAsync(async() => { var list = await SimpleHttp.DownloadAsString(address); var provider = new BlackListPorivder(list.Split('\n')); services.AddSingleton(provider); }, 3); return(services); }
public static IServiceCollection AddWarpgateServer(this IServiceCollection services, string warpgateEndpoint) { AsyncHelper.TryAsync(async() => { var response = await SimpleHttp.DownloadAsString(warpgateEndpoint); var serverModel = JsonConvert.DeserializeObject <IndexViewModel>(response); services.AddSingleton(new WarpgateLocator(warpgateEndpoint, serverModel.WarpPattern)); }, 5); services.AddLibraryDependencies(); return(services); }
public static IServiceCollection AddArchonServer(this IServiceCollection services, string serverEndpoint) { AsyncHelper.TryAsync(async() => { var response = await SimpleHttp.DownloadAsString(serverEndpoint); var serverModel = JsonConvert.DeserializeObject <IndexViewModel>(response); var publicKey = new RSAParameters { Modulus = serverModel.Modulus.Base64ToBytes(), Exponent = serverModel.Exponent.Base64ToBytes() }; services.AddSingleton(new ArchonLocator(serverEndpoint, publicKey)); }, 5); services.AddLibraryDependencies(); return(services); }
public static IServiceCollection AddProbeServer( this IServiceCollection services, string serverEndpoint) { AsyncHelper.TryAsync(async() => { var serverConfigString = await SimpleHttp.DownloadAsString(serverEndpoint); var serverConfig = JsonConvert.DeserializeObject <IndexViewModel>(serverConfigString); var openFormat = serverConfig.OpenPattern; var downloadFormat = serverConfig.DownloadPattern; var playerFormat = serverConfig.PlayerPattern; services.AddSingleton(new ProbeLocator(serverEndpoint, openFormat, downloadFormat, playerFormat)); }, 5); services.AddLibraryDependencies(); return(services); }