From 8502f9105f0e59a6ce7f4cc4ee223d0503be0ea7 Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Mon, 8 Jun 2020 23:29:37 +0200
Subject: [PATCH] Add sound notification file size warning as it's now loaded
 into memory

---
 Dialogs/Settings/TabSettingsSounds.cs | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Dialogs/Settings/TabSettingsSounds.cs b/Dialogs/Settings/TabSettingsSounds.cs
index a12ee40f..6227bf24 100644
--- a/Dialogs/Settings/TabSettingsSounds.cs
+++ b/Dialogs/Settings/TabSettingsSounds.cs
@@ -72,6 +72,14 @@ private void btnBrowseSound_Click(object sender, EventArgs e){
             };
 
             if (dialog.ShowDialog() == DialogResult.OK){
+                try{
+                    if (new FileInfo(dialog.FileName).Length > (1024 * 1024) && !FormMessage.Warning("Sound Notification", "The sound file is larger than 1 MB, this will cause increased memory usage. Use this file anyway?", FormMessage.Yes, FormMessage.No)){
+                        return;
+                    }
+                }catch{
+                    // ignore
+                }
+
                 tbCustomSound.Text = dialog.FileName;
             }
         }