mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-23 02:16:00 -05: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:
@@ -26,7 +26,16 @@ public void PlayCry(ISpeciesForm pk, int format)
|
||||
#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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user