diff --git a/ZenovaLauncher/App.xaml.cs b/ZenovaLauncher/App.xaml.cs index a8493eb..53fe6dc 100644 --- a/ZenovaLauncher/App.xaml.cs +++ b/ZenovaLauncher/App.xaml.cs @@ -75,11 +75,8 @@ public void AppStart(object sender, StartupEventArgs e) Trace.AutoFlush = true; ZenovaUpdater.instance = new ZenovaUpdater(); Trace.WriteLine("ZenovaUpdater.instance " + sw.ElapsedMilliseconds + " ms"); - VersionDownloader.standard = new VersionDownloader(); - Trace.WriteLine("VersionDownloader.standard " + sw.ElapsedMilliseconds + " ms"); - VersionDownloader.user = new VersionDownloader(); - await VersionDownloader.user.EnableUserAuthorization(); - Trace.WriteLine("VersionDownloader.user " + sw.ElapsedMilliseconds + " ms"); + VersionDownloader.instance = new VersionDownloader(); + Trace.WriteLine("VersionDownloader.instance " + sw.ElapsedMilliseconds + " ms"); VersionManager.instance = new VersionManager(VersionsDirectory); Trace.WriteLine("VersionManager.instance " + sw.ElapsedMilliseconds + " ms"); ProfileManager.instance = new ProfileManager(DataDirectory); diff --git a/ZenovaLauncher/Profiles/ProfileLauncher.cs b/ZenovaLauncher/Profiles/ProfileLauncher.cs index 711999f..d31921b 100644 --- a/ZenovaLauncher/Profiles/ProfileLauncher.cs +++ b/ZenovaLauncher/Profiles/ProfileLauncher.cs @@ -281,11 +281,10 @@ private async Task Download(Profile p) Trace.WriteLine("Download start"); string dlPath = v.GameDirectory + ".Appx"; - VersionDownloader downloader = v.Beta ? VersionDownloader.user : VersionDownloader.standard; try { Trace.WriteLine("Initializing Download"); - await downloader.Download(v.UUID, "1", dlPath, (current, total) => + await VersionDownloader.instance.Download(v.UUID, "1", dlPath, (current, total) => { if (LaunchInfo.Status == LaunchStatus.InitializingDownload) { @@ -302,7 +301,7 @@ await downloader.Download(v.UUID, "1", dlPath, (current, total) => { Trace.WriteLine("Download failed:\n" + e.ToString()); if (!(e is TaskCanceledException)) - Utils.ShowErrorDialog("Download failed", string.Format("An error occured while downloading Minecraft {0}.{1}", v.Name, v.Beta ? " Ensure the selected account is the one registered for beta versions in the Xbox Insider app." : "")); + Utils.ShowErrorDialog("Download failed", string.Format("An error occured while downloading Minecraft {0}.{1}", v.Name, v.Beta ? " The Minecraft Xbox Insider beta program has ended." : "")); return false; } try diff --git a/ZenovaLauncher/Utils/WUProtocol.cs b/ZenovaLauncher/Utils/WUProtocol.cs index 219d463..6f7717c 100644 --- a/ZenovaLauncher/Utils/WUProtocol.cs +++ b/ZenovaLauncher/Utils/WUProtocol.cs @@ -17,22 +17,12 @@ public class WUProtocol private static XNamespace wuws = "http://schemas.microsoft.com/msus/2014/10/WindowsUpdateAuthorization"; private static XNamespace wuclient = "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService"; - public string[] MSAUserToken { get; set; } - private XElement BuildWUTickets() { XElement tickets = new XElement(wuws + "WindowsUpdateTicketsToken", new XAttribute(secutil + "id", "ClientMSA"), new XAttribute(XNamespace.Xmlns + "wsu", secutil), new XAttribute(XNamespace.Xmlns + "wuws", wuws)); - foreach (string token in MSAUserToken ?? Enumerable.Empty()) - { - tickets.Add(new XElement("TicketType", - new XAttribute("Name", "MSA"), - new XAttribute("Version", "1.0"), - new XAttribute("Policy", "MBI_SSL"), - new XElement("User", token))); - } tickets.Add(new XElement("TicketType", "", new XAttribute("Name", "AAD"), new XAttribute("Version", "1.0"), diff --git a/ZenovaLauncher/Utils/WUTokenHelper.cs b/ZenovaLauncher/Utils/WUTokenHelper.cs deleted file mode 100644 index 39b1a49..0000000 --- a/ZenovaLauncher/Utils/WUTokenHelper.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Threading.Tasks; -using Windows.Security.Authentication.Web.Core; -using Windows.Security.Credentials; -using Windows.Security.Cryptography; - -namespace ZenovaLauncher -{ - class WUTokenHelper - { - public static async Task GetWUToken(string[] accountIds) - { - var tokens = new List(); - - foreach (string accountId in accountIds) - { - WebAccountProvider provider = await WebAuthenticationCoreManager.FindAccountProviderAsync("https://login.microsoft.com", "consumers"); - WebAccount account = await WebAuthenticationCoreManager.FindAccountAsync(provider, accountId); - - WebTokenRequest request = new WebTokenRequest(provider, "service::dcat.update.microsoft.com::MBI_SSL", "{28520974-CE92-4F36-A219-3F255AF7E61E}"); - - WebTokenRequestResult result = await WebAuthenticationCoreManager.GetTokenSilentlyAsync(request, account); - string token = result.ResponseData[0].Token; - var tokenBinary = CryptographicBuffer.ConvertStringToBinary(token, BinaryStringEncoding.Utf16LE); - var tokenBase64 = CryptographicBuffer.EncodeToBase64String(tokenBinary); - Trace.WriteLine("Token = " + token); - Trace.WriteLine("TokenBase64 = " + tokenBase64); - - tokens.Add(tokenBase64); - } - return tokens.ToArray(); - } - } -} diff --git a/ZenovaLauncher/Versions/VersionDownloader.cs b/ZenovaLauncher/Versions/VersionDownloader.cs index e6ba3fd..151653b 100644 --- a/ZenovaLauncher/Versions/VersionDownloader.cs +++ b/ZenovaLauncher/Versions/VersionDownloader.cs @@ -17,8 +17,7 @@ namespace ZenovaLauncher { public class VersionDownloader { - public static VersionDownloader standard; - public static VersionDownloader user; + public static VersionDownloader instance; private readonly HttpClient _client = new HttpClient(); private readonly WUProtocol _protocol = new WUProtocol(); @@ -152,17 +151,6 @@ private async Task GetDownloadUrl(string updateIdentity, string revision return null; } - public async Task EnableUserAuthorization() - { - RegistryKey accountIdsReg = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\IdentityCRL\\UserTileData"); - if (accountIdsReg != null) - { - string[] accountsIds = Array.FindAll(accountIdsReg.GetValueNames(), s => !s.EndsWith("_ETAG")); - _protocol.MSAUserToken = await WUTokenHelper.GetWUToken(accountsIds); - } - accountIdsReg.Close(); - } - public async Task Download(string updateIdentity, string revisionNumber, string destination, DownloadProgress progress, CancellationToken cancellationToken) { string link = await GetDownloadUrl(updateIdentity, revisionNumber); diff --git a/ZenovaLauncher/ZenovaLauncher.csproj b/ZenovaLauncher/ZenovaLauncher.csproj index d69d295..89cb5b3 100644 --- a/ZenovaLauncher/ZenovaLauncher.csproj +++ b/ZenovaLauncher/ZenovaLauncher.csproj @@ -110,7 +110,6 @@ -