Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions ZenovaLauncher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions ZenovaLauncher/Profiles/ProfileLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,10 @@ private async Task<bool> 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)
{
Expand All @@ -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
Expand Down
10 changes: 0 additions & 10 deletions ZenovaLauncher/Utils/WUProtocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>())
{
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"),
Expand Down
36 changes: 0 additions & 36 deletions ZenovaLauncher/Utils/WUTokenHelper.cs

This file was deleted.

14 changes: 1 addition & 13 deletions ZenovaLauncher/Versions/VersionDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -152,17 +151,6 @@ private async Task<string> 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);
Expand Down
1 change: 0 additions & 1 deletion ZenovaLauncher/ZenovaLauncher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@
<Compile Include="Utils\PackageStatusHelper.cs" />
<Compile Include="Utils\Preferences.cs" />
<Compile Include="Utils\SingleInstance.cs" />
<Compile Include="Utils\WUTokenHelper.cs" />
<Compile Include="Utils\ZenovaUpdater.cs" />
<Compile Include="Versions\MinecraftVersion.cs" />
<Compile Include="Profiles\Profile.cs" />
Expand Down