-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from Sergio0694/dev
Minor fixes
- Loading branch information
Showing
7 changed files
with
169 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
UICompositionAnimations/Extensions/System/UriExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using JetBrains.Annotations; | ||
|
||
namespace System | ||
{ | ||
/// <summary> | ||
/// An extension <see langword="class"/> for the <see cref="Uri"/> type | ||
/// </summary> | ||
public static class UriExtensions | ||
{ | ||
/// <summary> | ||
/// Returns an <see cref="Uri"/> that starts with the ms-appx:// prefix | ||
/// </summary> | ||
/// <param name="uri">The input <see cref="Uri"/> to process</param> | ||
/// <remarks>This is needed because the XAML converter doesn't use the ms-appx:// prefix</remarks> | ||
[Pure, NotNull] | ||
internal static Uri ToAppxUri([NotNull] this Uri uri) | ||
{ | ||
if (uri.Scheme.Equals("ms-resource")) | ||
{ | ||
string path = uri.AbsolutePath.StartsWith("/Files") | ||
? uri.AbsolutePath.Replace("/Files", string.Empty) | ||
: uri.AbsolutePath; | ||
return new Uri($"ms-appx://{path}"); | ||
} | ||
|
||
return uri; | ||
} | ||
|
||
/// <summary> | ||
/// Returns an <see cref="Uri"/> that starts with the ms-appx:// prefix | ||
/// </summary> | ||
/// <param name="path">The input relative path to convert</param> | ||
[Pure, NotNull] | ||
public static Uri ToAppxUri([NotNull] this string path) | ||
{ | ||
string prefix = $"ms-appx://{(path.StartsWith('/') ? string.Empty : "/")}"; | ||
return new Uri($"{prefix}{path}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters