Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: GetWinUIThemeResourceUrl shouldn't format a string #11991

Merged
Merged
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
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