Skip to content

Commit 63a06ba

Browse files
committed
feature: show the git source revision in About dialog (#2308)
Signed-off-by: leo <longshuang@msn.cn>
1 parent 3465888 commit 63a06ba

5 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/Resources/Locales/en_US.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
22
<x:String x:Key="Text.About" xml:space="preserve">About</x:String>
3+
<x:String x:Key="Text.About.GitSourceRevision" xml:space="preserve">Git Source Revision:</x:String>
34
<x:String x:Key="Text.About.Menu" xml:space="preserve">About SourceGit</x:String>
45
<x:String x:Key="Text.About.ReleaseDate" xml:space="preserve">Release Date: {0}</x:String>
56
<x:String x:Key="Text.About.ReleaseNotes" xml:space="preserve">Release Notes</x:String>

src/Resources/Locales/zh_CN.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
</ResourceDictionary.MergedDictionaries>
55

66
<x:String x:Key="Text.About" xml:space="preserve">关于软件</x:String>
7+
<x:String x:Key="Text.About.GitSourceRevision" xml:space="preserve">基于GIT代码版本: </x:String>
78
<x:String x:Key="Text.About.Menu" xml:space="preserve">关于本软件</x:String>
89
<x:String x:Key="Text.About.ReleaseDate" xml:space="preserve">发布日期:{0}</x:String>
910
<x:String x:Key="Text.About.ReleaseNotes" xml:space="preserve">浏览版本更新说明</x:String>

src/Resources/Locales/zh_TW.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
</ResourceDictionary.MergedDictionaries>
55

66
<x:String x:Key="Text.About" xml:space="preserve">關於</x:String>
7+
<x:String x:Key="Text.About.GitSourceRevision" xml:space="preserve">構建於 GIT 源代碼修訂版: </x:String>
78
<x:String x:Key="Text.About.Menu" xml:space="preserve">關於 SourceGit</x:String>
89
<x:String x:Key="Text.About.ReleaseDate" xml:space="preserve">發行日期: {0}</x:String>
910
<x:String x:Key="Text.About.ReleaseNotes" xml:space="preserve">版本說明</x:String>

src/Views/About.axaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@
7171
</StackPanel>
7272

7373
<TextBlock x:Name="TxtReleaseDate" Margin="0,28,0,0" Foreground="{DynamicResource Brush.FG2}"/>
74+
75+
<StackPanel x:Name="PnlGitSourceRevision" Orientation="Horizontal" Margin="0,2,0,0" IsVisible="False">
76+
<TextBlock Foreground="{DynamicResource Brush.FG2}" Text="{DynamicResource Text.About.GitSourceRevision}"/>
77+
<SelectableTextBlock x:Name="TxtGitSourceRevision" Margin="4,0,0,0" Foreground="{DynamicResource Brush.FG2}"/>
78+
</StackPanel>
79+
7480
<TextBlock x:Name="TxtCopyright" Margin="0,2,0,0" Foreground="{DynamicResource Brush.FG2}"/>
7581
</StackPanel>
7682
</StackPanel>

src/Views/About.axaml.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ public About()
2727
}
2828
}
2929

30+
var informationVersion = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
31+
if (informationVersion != null)
32+
{
33+
var infoVer = informationVersion.InformationalVersion;
34+
var idx = infoVer.IndexOf('+');
35+
if (idx > 0 && infoVer.Length > idx + 11)
36+
{
37+
TxtGitSourceRevision.Text = infoVer.Substring(idx + 1, 10);
38+
PnlGitSourceRevision.IsVisible = true;
39+
}
40+
}
41+
3042
var copyright = assembly.GetCustomAttribute<AssemblyCopyrightAttribute>();
3143
if (copyright != null)
3244
TxtCopyright.Text = copyright.Copyright;

0 commit comments

Comments
 (0)