Flow.Launcher/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/AccessLink.cs

30 lines
739 B
C#
Raw Permalink Normal View History

using System;
2020-06-06 12:13:22 +00:00
using System.Linq;
using System.Text.Json.Serialization;
2020-06-06 12:13:22 +00:00
2021-01-26 09:48:06 +00:00
namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks
2020-06-06 12:13:22 +00:00
{
public class AccessLink
2020-06-06 12:13:22 +00:00
{
public string Path { get; set; }
2021-01-26 09:01:12 +00:00
public ResultType Type { get; set; } = ResultType.Folder;
[JsonIgnore]
public string Name
2020-06-06 12:13:22 +00:00
{
get
{
var path = Path.EndsWith(Constants.DirectorySeperator) ? Path[0..^1] : Path;
if (path.EndsWith(':'))
return path[0..^1] + " Drive";
return path.Split(new[] { System.IO.Path.DirectorySeparatorChar }, StringSplitOptions.None)
.Last();
2020-06-06 12:13:22 +00:00
}
}
}
}