Esempio n. 1
0
        private void ComposeWithHeaders(HttpRequestMessage httpRequest)
        {
            string computerName = _computerNameProvider.Get();
            string launcherId   = _launcherIdProvider.Get();
            string hardwareId   = _hardwareIdProvider.Get();

            httpRequest.Headers.TryAddWithoutValidation("Computer-Name", computerName);
            httpRequest.Headers.TryAddWithoutValidation("Hardware-Id", hardwareId);
            httpRequest.Headers.TryAddWithoutValidation("Launcher-Id", launcherId);
        }
Esempio n. 2
0
        public async Task ConnectAsync(string accessToken)
        {
            _ws = new ClientWebSocket();

            string computerName = Convert.ToBase64String(
                Encoding.Default.GetBytes(_computerNameProvider.Get()));
            string launcherId = _launcherIdProvider.Get();
            string hardwareId = Convert.ToBase64String(
                Encoding.Default.GetBytes(_hardwareIdProvider.Get()));

            string uriString = _wsAddress
                               .AddOrUpdateParameterToUrl("token", accessToken)
                               .AddOrUpdateParameterToUrl("computer-name", computerName)
                               .AddOrUpdateParameterToUrl("launcher-id", launcherId)
                               .AddOrUpdateParameterToUrl("hardware-id", hardwareId);

            await _ws.ConnectAsync(new Uri(uriString), CancellationToken.None);
        }
Esempio n. 3
0
 private byte[] GetComputerNameHash()
 {
     return(HashAlgorithm
            .Create("MD5").ComputeHash(Encoding.UTF8.GetBytes(_computerNameProvider.Get())));
 }