File tree Expand file tree Collapse file tree 7 files changed +39
-2
lines changed Expand file tree Collapse file tree 7 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ private bool FillDb()
125
125
IsDisabled = false ,
126
126
FileSize = addon . FileSize ,
127
127
Author = addon . Author ,
128
+ UpdateDate = DateTime . Now . ToUniversalTime ( )
128
129
} ) ;
129
130
130
131
this . SaveChanges ( ) ;
Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ public sealed class VersionsDbEntity
36
36
[ Column ( "is_disabled" ) ]
37
37
public required bool IsDisabled { get ; set ; }
38
38
39
+ [ Column ( "updated" ) ]
40
+ public required DateTime UpdateDate { get ; set ; }
41
+
39
42
40
43
public AddonsDbEntity AddonsTable { get ; set ; }
41
44
}
Original file line number Diff line number Diff line change @@ -85,7 +85,8 @@ internal List<DownloadableAddonEntity> GetAddons(GameEnum gameEnum)
85
85
Author = version . Value . Author ,
86
86
Dependencies = depsResult ,
87
87
Installs = hasInstalls ? installsNumber : 0 ,
88
- Score = hasScore ? scoreNumber : 0
88
+ Score = hasScore ? scoreNumber : 0 ,
89
+ UpdateDate = version . Value . UpdateDate
89
90
} ;
90
91
91
92
result . Add ( newDownloadable ) ;
@@ -213,6 +214,7 @@ internal bool AddAddonToDatabase(AddonsJsonEntity addon)
213
214
IsDisabled = false ,
214
215
FileSize = addon . FileSize ,
215
216
Author = addon . Author ,
217
+ UpdateDate = DateTime . Now . ToUniversalTime ( )
216
218
} ) ;
217
219
218
220
dbContext . SaveChanges ( ) ;
Original file line number Diff line number Diff line change 47
47
Padding =" 2"
48
48
ItemsSource =" {Binding DownloadableList}"
49
49
SelectedItem =" {Binding SelectedDownloadable}"
50
+ SelectionMode =" Single"
50
51
GridLinesVisibility =" Horizontal"
51
52
IsReadOnly =" True"
52
53
CornerRadius =" 4"
59
60
<DataGridTextColumn Header =" Score" Binding =" {Binding Score}" />
60
61
<DataGridTextColumn Header =" Downloads" Binding =" {Binding Installs}" />
61
62
<DataGridTextColumn Header =" Status" Binding =" {Binding Status}" FontWeight =" Bold" />
63
+ <DataGridTextColumn Header =" Updated" Binding =" {Binding UpdateDateString}" SortMemberPath =" UpdateDate" />
62
64
</DataGrid .Columns>
63
65
</DataGrid >
64
66
Original file line number Diff line number Diff line change 2
2
using BuildLauncher . ViewModels ;
3
3
using Common . Helpers ;
4
4
using CommunityToolkit . Mvvm . Input ;
5
+ using System . ComponentModel ;
5
6
6
7
namespace BuildLauncher . Controls
7
8
{
Original file line number Diff line number Diff line change @@ -47,6 +47,9 @@ public sealed class DownloadableAddonEntity : IDownloadableAddon
47
47
[ JsonPropertyName ( "Author" ) ]
48
48
public string ? Author { get ; set ; }
49
49
50
+ [ JsonPropertyName ( "UpdateDate" ) ]
51
+ public DateTime UpdateDate { get ; set ; }
52
+
50
53
51
54
[ JsonIgnore ]
52
55
public bool IsInstalled { get ; set ; }
@@ -75,6 +78,29 @@ public string Status
75
78
[ JsonIgnore ]
76
79
public string FileSizeString => FileSize . ToSizeString ( ) ;
77
80
81
+ [ JsonIgnore ]
82
+ public string UpdateDateString
83
+ {
84
+ get
85
+ {
86
+ var now = DateTime . UtcNow ;
87
+ var span = now - UpdateDate ;
88
+
89
+ if ( span . TotalDays < 1 )
90
+ {
91
+ return "Today" ;
92
+ }
93
+ else if ( span . TotalDays < 2 )
94
+ {
95
+ return "Yesterday" ;
96
+ }
97
+ else
98
+ {
99
+ return $ "{ ( int ) span . TotalDays } days ago";
100
+ }
101
+ }
102
+ }
103
+
78
104
79
105
public string ToMarkdownString ( )
80
106
{
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ public interface IDownloadableAddon
10
10
string Title { get ; set ; }
11
11
Uri DownloadUrl { get ; set ; }
12
12
long FileSize { get ; set ; }
13
- string FileSizeString { get ; }
14
13
string Version { get ; set ; }
15
14
bool HasNewerVersion { get ; set ; }
16
15
bool IsInstalled { get ; set ; }
@@ -19,6 +18,9 @@ public interface IDownloadableAddon
19
18
string ? Description { get ; set ; }
20
19
int Installs { get ; set ; }
21
20
int Score { get ; set ; }
21
+ DateTime UpdateDate { get ; set ; }
22
+ string FileSizeString { get ; }
23
+ string UpdateDateString { get ; }
22
24
23
25
string ToMarkdownString ( ) ;
24
26
}
You can’t perform that action at this time.
0 commit comments