Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0a73894

Browse files
author
Aytackydln
committed
Make URLs clickable in changelogs window
1 parent2db78a5 commit0a73894

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

‎Project-Aurora/Project-Aurora/Controls/Window_Changelogs.xaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
<StackPanel>
1717
<TextBlockFontSize="32"Text="{Binding VersionTag}" />
1818
<mdXaml:MarkdownScrollViewer
19+
VerticalAlignment="Stretch"
20+
HorizontalAlignment="Stretch"
21+
ClickAction="DisplayWithRelativePath"
22+
OnHyperLinkClicked="OnLinkClicked"
1923
MarkdownStyleName="Sasabune"Markdown="{Binding Content}"Margin="20, 20, 5, 50" />
2024
<Separator />
2125
</StackPanel>

‎Project-Aurora/Project-Aurora/Controls/Window_Changelogs.xaml.cs‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
usingSystem;
2+
usingSystem.Diagnostics;
3+
usingSystem.Windows;
24
usingSystem.Windows.Input;
35
usingAuroraRgb.Modules;
46
usingAuroraRgb.Modules.Updates;
@@ -41,4 +43,21 @@ private void UIElement_OnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
4143
ScrollViewer.ScrollToVerticalOffset(ScrollViewer.VerticalOffset-e.Delta);
4244
e.Handled=true;
4345
}
46+
47+
publicvoidOnLinkClicked(stringurl)
48+
{
49+
try
50+
{
51+
ProcessStartInfopsi=new()
52+
{
53+
FileName=url,
54+
UseShellExecute=true
55+
};
56+
Process.Start(psi);
57+
}
58+
catch(Exceptionexc)
59+
{
60+
Global.logger.Error(exc,"Could not open link: {0}",url);
61+
}
62+
}
4463
}

‎Project-Aurora/Project-Aurora/Modules/UpdateModule.cs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
usingSystem.Diagnostics;
33
usingSystem.IO;
44
usingSystem.Linq;
5+
usingSystem.Text.RegularExpressions;
56
usingSystem.Threading.Tasks;
67
usingAuroraRgb.Modules.Updates;
78
usingCommon.Utils;
@@ -79,9 +80,17 @@ private static async Task<AuroraChangelog> ReadChangelog(string changelogPath)
7980
{
8081
varversionTag=Path.GetFileNameWithoutExtension(changelogPath);
8182
varcontent=awaitFile.ReadAllTextAsync(changelogPath);
83+
content=ConvertUrlsClickable(content);
8284

8385
returnnewAuroraChangelog(versionTag,content);
8486
}
87+
88+
privatestaticstringConvertUrlsClickable(stringmdContent)
89+
{
90+
// Simple regex to match URLs
91+
conststringurlPattern=@"(?<!\()https?:\/\/[^\s/$.?#].[^\s]*";
92+
returnRegex.Replace(mdContent,urlPattern, match=>$"[{match.Value}]({match.Value})");
93+
}
8594

8695
publicoverrideValueTaskDisposeAsync()
8796
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp