mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
feature: shows selected revision file size if it's a binary file
This commit is contained in:
parent
f6eb1281b5
commit
f4b396596b
3 changed files with 7 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
namespace SourceGit.Models {
|
||||
public class RevisionBinaryFile {
|
||||
public long Size { get; set; } = 0;
|
||||
}
|
||||
|
||||
public class RevisionTextFile {
|
||||
|
|
|
@ -353,8 +353,9 @@ namespace SourceGit.ViewModels {
|
|||
Task.Run(() => {
|
||||
var isBinary = new Commands.IsBinary(_repo, _commit.SHA, file.Path).Result();
|
||||
if (isBinary) {
|
||||
var size = new Commands.QueryFileSize(_repo, file.Path, _commit.SHA).Result();
|
||||
Dispatcher.UIThread.Invoke(() => {
|
||||
ViewRevisionFileContent = new Models.RevisionBinaryFile();
|
||||
ViewRevisionFileContent = new Models.RevisionBinaryFile() { Size = size };
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -81,6 +81,10 @@
|
|||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<Path Width="64" Height="64" Data="{StaticResource Icons.Error}" Fill="{DynamicResource Brush.FG2}"/>
|
||||
<TextBlock Margin="0,16,0,0" Text="{DynamicResource Text.BinaryNotSupported}" FontSize="18" FontWeight="Bold" HorizontalAlignment="Center" Foreground="{DynamicResource Brush.FG2}"/>
|
||||
<StackPanel Margin="0,8,0,0" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<TextBlock Classes="monospace" Text="{Binding Size}" Foreground="{DynamicResource Brush.FG2}"/>
|
||||
<TextBlock Text="{DynamicResource Text.Bytes}" Margin="8,0,0,0" Foreground="{DynamicResource Brush.FG2}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
|
|
Loading…
Reference in a new issue