This commit is contained in:
Zhe Fang
2025-07-28 09:18:38 -04:00
parent 45eb2a1506
commit 06379ebaba
5 changed files with 15 additions and 10 deletions

View File

@@ -102,7 +102,7 @@
</Style>
<Style x:Key="GhostSliderStyle" TargetType="Slider">
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}" />
<Setter Property="Background" Value="{ThemeResource ControlStrokeColorOnAccentDefaultBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource SliderBorderThemeThickness}" />
<Setter Property="Foreground" Value="{ThemeResource TextFillColorPrimaryBrush}" />
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />

View File

@@ -164,7 +164,7 @@ namespace BetterLyrics.WinUI3.Helper
{
List<LyricsLine> originalLines = [];
List<LyricsLine> translationLines = [];
var xdoc = XDocument.Parse(raw);
var xdoc = XDocument.Parse(raw, LoadOptions.PreserveWhitespace);
var body = xdoc.Descendants().FirstOrDefault(e => e.Name.LocalName == "body");
if (body == null) return;
var ps = body.Descendants().Where(e => e.Name.LocalName == "p");
@@ -190,16 +190,18 @@ namespace BetterLyrics.WinUI3.Helper
.Where(s => s.Attribute(XName.Get("role", "http://www.w3.org/ns/ttml#metadata"))?.Value == "x-translation")
.ToList();
// 原文(非 CJK 语言添加空格)
string originalText = string.Concat(originalTextSpans.Select(s => s.Value));
if (!LanguageHelper.IsCJK(originalText))
// 处理原文span后的空白
for (int i = 0; i < originalTextSpans.Count; i++)
{
foreach (var span in originalTextSpans)
var span = originalTextSpans[i];
var nextNode = span.NodesAfterSelf().FirstOrDefault();
if (nextNode is XText textNode)
{
span.Value += " ";
span.Value += textNode.Value;
}
originalText = string.Concat(originalTextSpans.Select(s => s.Value));
}
// 拼接空白字符后的原文
string originalText = string.Concat(originalTextSpans.Select(s => s.Value));
var originalCharTimings = new List<LyricsChar>();
int originalStartIndex = 0;

View File

@@ -63,6 +63,7 @@ namespace BetterLyrics.WinUI3.Helper
}
var castedWindow = (Window)window;
castedWindow.Restore();
castedWindow.Activate();
}
public static void RestartApp(string args = "")

View File

@@ -6,6 +6,7 @@ using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using CommunityToolkit.Mvvm.Messaging.Messages;
using Microsoft.UI.Xaml;
using System;
namespace BetterLyrics.WinUI3.ViewModels
{
@@ -40,7 +41,7 @@ namespace BetterLyrics.WinUI3.ViewModels
{
DockModeHelper.Disable(lyricsWindow);
}
Application.Current.Exit();
Environment.Exit(0);
}
[RelayCommand]

View File

@@ -10,6 +10,7 @@ using CommunityToolkit.Mvvm.Messaging.Messages;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Input;
using System;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -272,7 +273,7 @@ namespace BetterLyrics.WinUI3.Views
private void CloseButton_Click(object sender, RoutedEventArgs e)
{
DockModeHelper.Disable(this);
Application.Current.Exit();
Environment.Exit(0);
}
private void MaximiseButton_Click(object sender, RoutedEventArgs e)