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); }
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); }
private byte[] GetComputerNameHash() { return(HashAlgorithm .Create("MD5").ComputeHash(Encoding.UTF8.GetBytes(_computerNameProvider.Get()))); }