Skip to content

Commit

Permalink
Fallback to not filter dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aetopia committed Sep 20, 2024
1 parent d89fb9d commit 7365866
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/BedrockUpdater.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ApplicationManifest>Resources/.manifest</ApplicationManifest>
<ApplicationIcon>Resources/.ico</ApplicationIcon>

<AssemblyVersion>1.2.3.2</AssemblyVersion>
<AssemblyVersion>1.2.4.0</AssemblyVersion>
<AssemblyTitle>Bedrock Updater</AssemblyTitle>
<Product>Bedrock Updater</Product>
<Copyright>Copyright (C) 2024</Copyright>
Expand Down
50 changes: 25 additions & 25 deletions src/Store.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using Windows.Management.Deployment;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Json;
using System.IO;

struct Product
{
Expand Down Expand Up @@ -61,28 +60,28 @@ static class Store
static readonly string displaycatalog = $"https://displaycatalog.mp.microsoft.com/v7.0/products/{{0}}?languages=iv&market={GlobalizationPreferences.HomeGeographicRegion}";

static readonly (string String, ProcessorArchitecture Architecture) native = (
RuntimeInformation.OSArchitecture.ToString().ToLowerInvariant(),
RuntimeInformation.OSArchitecture switch
{
Architecture.X86 => ProcessorArchitecture.X86,
Architecture.X64 => ProcessorArchitecture.X64,
Architecture.Arm => ProcessorArchitecture.Arm,
Architecture.Arm64 => ProcessorArchitecture.Arm64,
_ => ProcessorArchitecture.Unknown
});
RuntimeInformation.OSArchitecture.ToString().ToLowerInvariant(),
RuntimeInformation.OSArchitecture switch
{
Architecture.X86 => ProcessorArchitecture.X86,
Architecture.X64 => ProcessorArchitecture.X64,
Architecture.Arm => ProcessorArchitecture.Arm,
Architecture.Arm64 => ProcessorArchitecture.Arm64,
_ => ProcessorArchitecture.Unknown
});

static readonly (string String, ProcessorArchitecture Architecture) compatible = (
RuntimeInformation.OSArchitecture switch
{
Architecture.X64 => "x86",
Architecture.Arm64 => "arm",
_ => null
}, RuntimeInformation.OSArchitecture switch
{
Architecture.X64 => ProcessorArchitecture.X86,
Architecture.Arm64 => ProcessorArchitecture.Arm,
_ => ProcessorArchitecture.Unknown
});
RuntimeInformation.OSArchitecture switch
{
Architecture.X64 => "x86",
Architecture.Arm64 => "arm",
_ => null
}, RuntimeInformation.OSArchitecture switch
{
Architecture.X64 => ProcessorArchitecture.X86,
Architecture.Arm64 => ProcessorArchitecture.Arm,
_ => ProcessorArchitecture.Unknown
});

static readonly WebClient client = new() { BaseAddress = "https://fe3cr.delivery.mp.microsoft.com/ClientWebService/client.asmx/" };

Expand Down Expand Up @@ -162,16 +161,17 @@ static IEnumerable<Identity> Filter(this Product product, Dictionary<string, Ide
{
if (dictionary.Count == 0) return [];

var values = dictionary.Where(_ => _.Value.MainPackage).Select(_ => _.Value);
var value = values.FirstOrDefault(_ => _.Architecture == native.Architecture) ?? values.FirstOrDefault(_ => _.Architecture == compatible.Architecture);
var values = dictionary.Select(_ => _.Value);
var enumerable = values.Where(_ => _.MainPackage);
var package = enumerable.FirstOrDefault(_ => _.Architecture == native.Architecture || _.Architecture == compatible.Architecture);

var source = Get(string.Format(displaycatalog, product.Id))
.Descendants("FrameworkDependencies")
.FirstOrDefault(_ => _.Parent.Element("PackageFullName").Value == value.PackageFullName)?
.FirstOrDefault(_ => _.Parent.Element("PackageFullName").Value == package.PackageFullName)?
.Descendants("PackageIdentity")
.Select(_ => _.Value);

return source is null ? [] : dictionary.Where(_ => _.Value.Architecture == value.Architecture && (_.Value.MainPackage || source.Contains(_.Value.PackageIdentity[0]))).Select(_ => _.Value);
return values.Where(_ => _.Architecture == package.Architecture && (_.MainPackage || (source?.Contains(_.PackageIdentity[0]) ?? true)));
}

static List<Update> Verify(this IEnumerable<Identity> source, XElement updates)
Expand Down

0 comments on commit 7365866

Please sign in to comment.