修复不扫描的bug

This commit is contained in:
LanZhan-Harmony
2026-04-06 20:43:46 +08:00
parent 505cd31b8a
commit 03b0617ee0
3 changed files with 32 additions and 11 deletions

View File

@@ -83,6 +83,7 @@ public sealed partial class EditAlbumInfoDialog
await Task.Run(async () =>
{
ATL.Settings.ID3v2_tagSubVersion = 3;
var hasChanges = false;
foreach (var tempSong in _tempSongs)
{
try
@@ -108,12 +109,20 @@ public sealed partial class EditAlbumInfoDialog
{
_logger.EditingSongInfoIO(tempSong.Title);
}
else
{
hasChanges = true;
}
}
catch (Exception ex)
{
_logger.EditingSongInfoOther(tempSong.Title, ex);
}
}
if (hasChanges)
{
_ = Data.MusicLibrary.LoadLibraryAgainAsync();
}
});
Data.IsMusicProcessing = false;

View File

@@ -155,14 +155,18 @@ public sealed partial class EditSongInfoDialog
{
_logger.EditingSongInfoIO(_title);
}
else
{
_ = Data.MusicLibrary.LoadLibraryAgainAsync();
}
}
catch (Exception ex)
{
_logger.EditingSongInfoOther(_title, ex);
}
Data.IsMusicProcessing = false;
});
Data.IsMusicProcessing = false;
}
private void OpenFileLocationButton_Click(object sender, RoutedEventArgs e)

View File

@@ -4,16 +4,24 @@ public static class NetworkHelper
{
public static async Task<bool> IsInternetAvailableAsync()
{
try
for (var i = 0; i < 3; i++)
{
using var client = new HttpClient();
client.Timeout = TimeSpan.FromSeconds(5);
var response = await client.GetAsync("https://music.163.com");
return response.IsSuccessStatusCode;
}
catch
{
return false;
try
{
using var client = new HttpClient();
client.Timeout = TimeSpan.FromSeconds(5);
var response = await client.GetAsync("https://music.163.com");
if (response.IsSuccessStatusCode)
{
return true;
}
}
catch { }
if (i < 2)
{
await Task.Delay(300);
}
}
return false;
}
}