mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-14 08:17:14 +00:00
Trycatch sound stop, only stop if a sound has been played
Closes #3224
mono's impl of soundplayer is different, hence the need to be a little safer here.
bdd772531d/mcs/class/System/System.Media/SoundPlayer.cs (L255)
https://referencesource.microsoft.com/#System/sys/system/Media/SoundPlayer.cs,455
This commit is contained in:
parent
3fecea9e29
commit
8bac5c259a
1 changed files with 10 additions and 1 deletions
|
@ -26,7 +26,16 @@ namespace PKHeX.WinForms.Controls
|
|||
#pragma warning restore CA1031 // Do not catch general exception types
|
||||
}
|
||||
|
||||
public void Stop() => Sounds.Stop();
|
||||
public void Stop()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Sounds.SoundLocation))
|
||||
return;
|
||||
|
||||
try { Sounds.Stop(); }
|
||||
#pragma warning disable CA1031 // Do not catch general exception types
|
||||
catch { Debug.WriteLine("Failed to stop sound."); }
|
||||
#pragma warning restore CA1031 // Do not catch general exception types
|
||||
}
|
||||
|
||||
private static string GetCryPath(ISpeciesForm pk, string cryFolder, int format)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue