Skip to content

Commit

Permalink
fix: use root xmlns
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiegel committed Jun 18, 2024
1 parent f66b9b8 commit 2522f46
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions src/Resizetizer/src/GeneratePackageAppxManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public class GeneratePackageAppxManifest_v0 : Task

const string ErrorVersionNumberCombination = "ApplicationDisplayVersion '{0}' was not a valid 3 part semver version number and/or ApplicationVersion '{1}' was not a valid integer.";

static readonly XNamespace xmlnsUap = "http://schemas.microsoft.com/appx/manifest/uap/windows10";

[Required]
public string IntermediateOutputPath { get; set; } = null!;

Expand Down Expand Up @@ -181,7 +179,7 @@ void UpdateManifest(XDocument appx)
}

// <uap:VisualElements>
var xvisual = xmlnsUap + "VisualElements";
var xvisual = xmlns + "VisualElements";
var visual = application.Element(xvisual);
if (visual == null)
{
Expand All @@ -190,7 +188,7 @@ void UpdateManifest(XDocument appx)
}

// <uap:DefaultTile>
var xtile = xmlnsUap + "DefaultTile";
var xtile = xmlns + "DefaultTile";
var tile = visual.Element(xtile);
if (tile == null)
{
Expand All @@ -199,7 +197,7 @@ void UpdateManifest(XDocument appx)
}

// <uap:ShowNameOnTiles>
var xshowname = xmlnsUap + "ShowNameOnTiles";
var xshowname = xmlns + "ShowNameOnTiles";
var showname = tile.Element(xshowname);
if (showname == null)
{
Expand All @@ -226,7 +224,7 @@ void UpdateManifest(XDocument appx)
UpdateDefaultTileSquare310Logo(tile, appIconInfo);

// <ShowOn>
var xshowon = xmlnsUap + "ShowOn";
var xshowon = xmlns + "ShowOn";
var showons = showname.Elements(xshowon).ToArray();
if (showons.All(x => x.Attribute("Tile")?.Value != "square150x150Logo"))
{
Expand All @@ -242,7 +240,7 @@ void UpdateManifest(XDocument appx)
if (splashInfo != null)
{
// <uap:SplashScreen>
var xsplash = xmlnsUap + "SplashScreen";
var xsplash = xmlns + "SplashScreen";
var splash = visual.Element(xsplash);
if (splash == null)
{
Expand Down Expand Up @@ -523,19 +521,19 @@ private static void SetVersion(XElement target, XName attributeName, string vers
}
}

static bool IsVersionAttribute(XAttribute attribute, XName attributeName)
{
var currentAttributeName = attribute.Name.LocalName;
var expectedAttributeName = attributeName.LocalName;

var currentAttributeNamespace = attribute.Name.Namespace.NamespaceName;
var expectedAttributeNamespace = attributeName.NamespaceName;

// The Version may not have a current Namespace and should use the default namespace
if (string.IsNullOrEmpty(currentAttributeNamespace))
return currentAttributeName == expectedAttributeName;

return currentAttributeName == expectedAttributeName && currentAttributeNamespace == expectedAttributeNamespace;
static bool IsVersionAttribute(XAttribute attribute, XName attributeName)
{
var currentAttributeName = attribute.Name.LocalName;
var expectedAttributeName = attributeName.LocalName;

var currentAttributeNamespace = attribute.Name.Namespace.NamespaceName;
var expectedAttributeNamespace = attributeName.NamespaceName;

// The Version may not have a current Namespace and should use the default namespace
if (string.IsNullOrEmpty(currentAttributeNamespace))
return currentAttributeName == expectedAttributeName;

return currentAttributeName == expectedAttributeName && currentAttributeNamespace == expectedAttributeNamespace;
}

public static bool TryMergeVersionNumbers(string? displayVersion, string? version, out string? finalVersion)
Expand Down

0 comments on commit 2522f46

Please sign in to comment.