diff --git a/ZuneImpl/Service/CommunityCommerce.cs b/ZuneImpl/Service/CommunityCommerce.cs index a6ab1f8..65fad94 100644 --- a/ZuneImpl/Service/CommunityCommerce.cs +++ b/ZuneImpl/Service/CommunityCommerce.cs @@ -23,7 +23,7 @@ namespace Microsoft.Zune.Service } } - public static CultureInfo Culture { get; private set; } + public static CultureInfo Culture { get; private set; } = CultureInfo.CurrentCulture; public static bool IsSignedIn => Escargot.HasToken && MemberInfo != null; diff --git a/ZuneImpl/Service/CommunityCommerce.oz.cs b/ZuneImpl/Service/CommunityCommerce.oz.cs index 8705558..836ccbb 100644 --- a/ZuneImpl/Service/CommunityCommerce.oz.cs +++ b/ZuneImpl/Service/CommunityCommerce.oz.cs @@ -1,9 +1,6 @@ #if OPENZUNE -using System.IO; using System.Net.Http; -using System.Xml.Serialization; -using Zune.Xml.Commerce; using ZuneUI; namespace Microsoft.Zune.Service @@ -19,8 +16,9 @@ namespace Microsoft.Zune.Service try { - HttpRequestMessage request = new(HttpMethod.Post, "https://commerce.zunes.me/v5.0/en-US/account/signin"); - request.Headers.UserAgent.ParseAdd("Zune/5.0"); + string url = Service2.Instance.GetEndPointUri(EServiceEndpointId.SEID_Commerce) + $"/account/signin"; + HttpRequestMessage request = new(HttpMethod.Post, url); + request.Headers.UserAgent.ParseAdd(CommunityService.AppUserAgent); var contentStream = GetSignInRequestBody(); request.Content = new StreamContent(contentStream); diff --git a/ZuneImpl/Service/CommunityService.cs b/ZuneImpl/Service/CommunityService.cs index 1741012..7e63e05 100644 --- a/ZuneImpl/Service/CommunityService.cs +++ b/ZuneImpl/Service/CommunityService.cs @@ -12,6 +12,9 @@ namespace Microsoft.Zune.Service { private bool disposedValue; + public static string AppUserAgent { get; set; } + public static string ApiVerionStr { get; set; } + public EListType ContentTypeToListType(EContentType contentType) { switch (contentType) @@ -411,7 +414,16 @@ namespace Microsoft.Zune.Service public bool LaunchBrowserForExternalUrl(string strUrl, EPassportPolicyId ePassportPolicy) => Service.Instance.LaunchBrowserForExternalUrl(strUrl, ePassportPolicy); - public int Phase3Initialize() => Service.Instance.Phase3Initialize(); + public int Phase3Initialize() + { + var name = System.Reflection.Assembly.GetEntryAssembly()?.GetName(); + if (ApiVerionStr == null) + ApiVerionStr = name?.Version?.ToString(2); + if (AppUserAgent == null) + AppUserAgent = $"{name?.Name}/{ApiVerionStr}"; + + return Service.Instance.Phase3Initialize(); + } public bool PostAppReview(Guid mediaId, string title, string comment, int rating, AsyncCompleteHandler callback) => Service.Instance.PostAppReview(mediaId, title, comment, rating, callback); diff --git a/ZuneImpl/ZuneImpl.csproj b/ZuneImpl/ZuneImpl.csproj index b92d4fe..431e226 100644 --- a/ZuneImpl/ZuneImpl.csproj +++ b/ZuneImpl/ZuneImpl.csproj @@ -5,7 +5,7 @@ x64 Library ZuneImpl - 4.7.0.0 + 4.8.0.0 net35;net40;net6.0 x64;x86 diff --git a/ZuneShell/Microsoft/Zune/Shell/ZuneApplication.cs b/ZuneShell/Microsoft/Zune/Shell/ZuneApplication.cs index 78dd0c8..bdf8a39 100644 --- a/ZuneShell/Microsoft/Zune/Shell/ZuneApplication.cs +++ b/ZuneShell/Microsoft/Zune/Shell/ZuneApplication.cs @@ -108,7 +108,7 @@ namespace Microsoft.Zune.Shell else { SingletonModelItem.Instance.Phase3Init(); - Service.Phase3Initialize(); + Service2.Phase3Initialize(); SignIn.Instance.Phase3Init(); MetadataNotifications.Instance.Phase2Init(); SingletonModelItem.Instance.Phase2Init();