Esempio n. 1
0
        public LcuRequester(Lockfile lockfile, LcuConfig config)
        {
            _tokenBucket = config.TokenBucketProvider();

            _concurrentRequestSemaphore = config.MaxConcurrentRequests <= 0
                ? null
                : new SemaphoreSlim(config.MaxConcurrentRequests);

            _clientHandler = new HttpClientHandler
            {
                ClientCertificateOptions = ClientCertificateOption.Manual,
                ServerCertificateCustomValidationCallback = (req, cert, chain, polErrs) =>
                                                            config.CertificateValidationCallback(req, cert, chain, polErrs)
            };

            _client = new HttpClient(_clientHandler);
            _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
                "Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes($"{USERNAME}:{lockfile.Password}")));
            _client.BaseAddress = new UriBuilder(lockfile.Protocol, "127.0.0.1", lockfile.Port).Uri;

            Console.WriteLine(Convert.ToBase64String(Encoding.ASCII.GetBytes($"{USERNAME}:{lockfile.Password}")));
        }
Esempio n. 2
0
 public Lcu(Lockfile lockfile, LcuConfig config) : base()
 {
     _requester = new LcuRequester(lockfile, config);
     wamp       = new Wamp(lockfile, config);
 }
Esempio n. 3
0
 public Lcu(Lockfile lockfile) : this(lockfile, new LcuConfig())
 {
 }