Skip to content

Commit a4d7b15

Browse files
committed
refactor: format the version to YYYY.NN
Signed-off-by: leo <longshuang@msn.cn>
1 parent 83f2358 commit a4d7b15

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Views/About.axaml.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ public string Copyright
1919

2020
public About()
2121
{
22-
var ver = Assembly.GetExecutingAssembly().GetName().Version;
22+
var assembly = Assembly.GetExecutingAssembly();
23+
var ver = assembly.GetName().Version;
2324
if (ver != null)
24-
Version = $"{ver.Major}.{ver.Minor}";
25-
var attributes = Assembly.GetExecutingAssembly()
26-
.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
27-
if (attributes.Length > 0)
28-
Copyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
25+
Version = $"{ver.Major}.{ver.Minor:D2}";
26+
27+
var copyright = assembly.GetCustomAttribute<AssemblyCopyrightAttribute>();
28+
Copyright = copyright?.Copyright;
2929

3030
DataContext = this;
3131
InitializeComponent();

0 commit comments

Comments
 (0)