-
Notifications
You must be signed in to change notification settings - Fork 2
/
ColumnStyles.cs
32 lines (27 loc) · 925 Bytes
/
ColumnStyles.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using Terminal.Gui;
namespace AppCompare;
public static class ColumnStyles {
public static readonly TableView.ColumnStyle FileInfoLengthNumber = new () {
Alignment = TextAlignment.Right,
RepresentationGetter = (object o) => {
(FileInfo? file, long length) = ((FileInfo?, long)) o;
if ((length == 0) || (file is not null && file.Attributes.HasFlag (FileAttributes.ReparsePoint)))
return "";
return length.ToString ("N0");
},
};
public static readonly TableView.ColumnStyle LongNumber = new () {
Alignment = TextAlignment.Right,
RepresentationGetter = (object o) => {
var value = (long) o;
return value == 0 ? "" : value.ToString ("N0");
},
};
public static readonly TableView.ColumnStyle Percentage = new () {
Alignment = TextAlignment.Right,
RepresentationGetter = (object o) => {
var value = (double) o;
return Double.IsNaN (value) ? "" : value.ToString ("P1");
},
};
}