/// <summary> /// Figure out the user agent and add it to the header collection. /// </summary> /// <param name="userAgent">User agent header collection.</param> private static void AddUserAgent(ICollection<ProductInfoHeaderValue> userAgent) { userAgent.Add(new ProductInfoHeaderValue("CSharpAnalytics", "0.1")); var agentParts = new[] { "Windows NT " + SystemInformation.GetWindowsVersionAsync().Result, GetProcessorArchitectureAsync().Result }; userAgent.Add(new ProductInfoHeaderValue("(" + String.Join("; ", agentParts) + ")")); }
/// <summary> /// Figure out the user agent and add it to the header collection. /// </summary> /// <param name="userAgent">User agent header collection.</param> /// <param name="packageId">PackageId to extract application name and version from.</param> private static void AddUserAgent(ICollection<ProductInfoHeaderValue> userAgent, PackageId packageId) { userAgent.Add(new ProductInfoHeaderValue(packageId.Name, FormatVersion(packageId.Version))); var agentParts = new[] { "Windows NT " + SystemInformation.GetWindowsVersionAsync().Result, GetProcessorArchitectureAsync().Result }; userAgent.Add(new ProductInfoHeaderValue("(" + String.Join("; ", agentParts) + ")")); }