Skip to content

Commit

Permalink
打开插件文件夹
Browse files Browse the repository at this point in the history
  • Loading branch information
kitUIN committed Aug 16, 2023
1 parent 45f38d3 commit b36b60c
Showing 1 changed file with 54 additions and 2 deletions.
56 changes: 54 additions & 2 deletions ShadowViewer.Core/Extensions/UriExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static async void LaunchUriAsync(this Uri uri)
}
}
/// <summary>
/// 从资源管理器打开
/// 从资源管理器打开文件夹
/// </summary>
public static async void LaunchFolderAsync(this StorageFolder folder)
{
Expand All @@ -24,6 +24,51 @@ public static async void LaunchFolderAsync(this StorageFolder folder)
}
}
/// <summary>
/// 从资源管理器打开文件夹
/// </summary>
public static async void LaunchFolderAsync(this string path)
{
var folder = await ToStorageFolder(path);
LaunchFolderAsync(folder);
}

/// <summary>
/// 从资源管理器打开文件
/// </summary>
public static async void LaunchFolderAsync(this Uri uri)
{

var folder = await ToStorageFolder(uri.DecodePath());
LaunchFolderAsync(folder);
}

/// <summary>
/// 从资源管理器打开文件
/// </summary>
public static async void LaunchFileAsync(this StorageFile folder)
{
if (folder != null)
{
await Launcher.LaunchFileAsync(folder);
}
}
/// <summary>
/// 从资源管理器打开文件
/// </summary>
public static async void LaunchFileAsync(this Uri uri)
{
var file = await GetFile(uri);
LaunchFileAsync(file);
}
/// <summary>
/// 从资源管理器打开文件
/// </summary>
public static async void LaunchFileAsync(this string uri)
{
var file = await GetFile(uri);
LaunchFileAsync(file);
}
/// <summary>
/// Join
/// </summary>
public static string JoinToString(this ObservableCollection<string> tags,string separator = ",")
Expand All @@ -35,7 +80,14 @@ public static string JoinToString(this ObservableCollection<string> tags,string
/// </summary>
public static async Task<StorageFile> GetFile(this Uri uri)
{
return await StorageFile.GetFileFromPathAsync(uri.DecodePath());
return await GetFile(uri.DecodePath());
}
/// <summary>
/// 获取文件
/// </summary>
public static async Task<StorageFile> GetFile(this string path)
{
return await StorageFile.GetFileFromPathAsync(path);
}
public static string DecodePath(this StorageFile file)
{
Expand Down

0 comments on commit b36b60c

Please sign in to comment.