mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add FileSize/Created/LastModified Info for Preview
This commit is contained in:
parent
1596c59638
commit
dcf72bca5b
3 changed files with 48 additions and 1 deletions
|
|
@ -129,6 +129,21 @@ namespace Flow.Launcher.Plugin
|
|||
/// <value>default: 0</value>
|
||||
public int Score { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// File Size
|
||||
/// </summary>
|
||||
public string FileSize { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Created
|
||||
/// </summary>
|
||||
public string FileCreated { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Last Modified Date File
|
||||
/// </summary>
|
||||
public string LastModifed { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// A list of indexes for the characters to be highlighted in Title
|
||||
/// </summary>
|
||||
|
|
@ -204,7 +219,10 @@ namespace Flow.Launcher.Plugin
|
|||
Score = Score,
|
||||
TitleHighlightData = TitleHighlightData,
|
||||
OriginQuery = OriginQuery,
|
||||
PluginDirectory = PluginDirectory
|
||||
PluginDirectory = PluginDirectory,
|
||||
FileCreated = FileCreated,
|
||||
FileSize = FileSize,
|
||||
LastModifed = LastModifed
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -300,6 +318,8 @@ namespace Flow.Launcher.Plugin
|
|||
IsMedia = false,
|
||||
PreviewDelegate = null,
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -490,6 +490,18 @@
|
|||
x:Name="PreviewSubTitle"
|
||||
Style="{DynamicResource PreviewItemSubTitleStyle}"
|
||||
Text="{Binding Result.SubTitle}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="FileSize" />
|
||||
<TextBlock Style="{DynamicResource PreviewItemSubTitleStyle}" Text="{Binding Result.FileSize}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Created" />
|
||||
<TextBlock Style="{DynamicResource PreviewItemSubTitleStyle}" Text="{Binding Result.FileCreated}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Last Modified" />
|
||||
<TextBlock Style="{DynamicResource PreviewItemSubTitleStyle}" Text="{Binding Result.LastModifed}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ using System.Threading.Tasks;
|
|||
using System.Windows;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.Everything;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Shapes;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer.Search
|
||||
{
|
||||
|
|
@ -239,6 +241,16 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
|
||||
var title = Path.GetFileName(filePath);
|
||||
|
||||
/* Preview Detail */
|
||||
long fileSize = new System.IO.FileInfo(filePath).Length;
|
||||
string fileSizStr = fileSize.ToString();
|
||||
|
||||
DateTime created = System.IO.File.GetCreationTime(filePath);
|
||||
string createdStr = created.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
DateTime lastModified = System.IO.File.GetLastWriteTime(filePath);
|
||||
string lastModifiedStr = lastModified.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
|
||||
var result = new Result
|
||||
{
|
||||
Title = title,
|
||||
|
|
@ -248,6 +260,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
AutoCompleteText = GetAutoCompleteText(title, query, filePath, ResultType.File),
|
||||
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
|
||||
Score = score,
|
||||
FileSize = fileSizStr,
|
||||
FileCreated = createdStr,
|
||||
LastModifed = lastModifiedStr,
|
||||
CopyText = filePath,
|
||||
Action = c =>
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue