Skip to content

Commit

Permalink
perf: GetWinUIThemeResourceUrl shouldn't format a string
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Apr 15, 2023
1 parent b3dc305 commit 8471381
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Uno.UI/UI/Xaml/XamlFilePathHelper.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace Uno.UI.Xaml
{
internal static class XamlFilePathHelper
{
private const string WinUIThemeResourceURLFormatString = "Microsoft.UI.Xaml/Themes/themeresources_v{0}.xaml";
public const string AppXIdentifier = AppXScheme + ":///";
public const string AppXScheme = "ms-appx";
public const string MSResourceIdentifier = "ms-resource:///";
Expand Down Expand Up @@ -49,7 +48,15 @@ internal static string ResolveAbsoluteSource(string origin, string relativeTarge
internal static bool IsAbsolutePath(string relativeTargetPath) => relativeTargetPath.StartsWith(AppXIdentifier, StringComparison.Ordinal)
|| relativeTargetPath.StartsWith(MSResourceIdentifier, StringComparison.Ordinal);

internal static string GetWinUIThemeResourceUrl(int version) => string.Format(CultureInfo.InvariantCulture, WinUIThemeResourceURLFormatString, version);
internal static string GetWinUIThemeResourceUrl(int version)
{
return version switch
{
1 => "Microsoft.UI.Xaml/Themes/themeresources_v1.xaml",
2 => "Microsoft.UI.Xaml/Themes/themeresources_v2.xaml",
_ => throw new ArgumentOutOfRangeException(nameof(version), $"'version' must be between 1 and 2. Found {version}."),
};
}

private static string GetAbsolutePath(string originDirectory, string relativeTargetPath)
{
Expand Down

0 comments on commit 8471381

Please sign in to comment.