mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-14 20:24:57 +00:00
Added check for key to Clear command
If the key was wrong or wasn't in the group, a `KeyNotFoundException` was thrown. Also added acknowledgment of a successful deletion
This commit is contained in:
@@ -36,12 +36,26 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <param name="groupName"></param>
|
/// <param name="groupName"></param>
|
||||||
static void ClearEventsFromGroup(string groupName)
|
static void ClearEventsFromGroup(string groupName)
|
||||||
{
|
{
|
||||||
|
if (!EventGroups.ContainsKey(groupName))
|
||||||
|
{
|
||||||
|
Debug.Console(0,
|
||||||
|
"[Scheduler]: Unable to delete events from group '{0}'. Group not found in EventGroups dictionary.",
|
||||||
|
groupName);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var group = EventGroups[groupName];
|
var group = EventGroups[groupName];
|
||||||
|
|
||||||
if (group != null)
|
if (group != null)
|
||||||
|
{
|
||||||
group.ClearAllEvents();
|
group.ClearAllEvents();
|
||||||
|
|
||||||
|
Debug.Console(0, "[Scheduler]: All events deleted from group '{0}'", groupName);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Debug.Console(0, "[Scheduler]: Unable to delete events from group '{0}'. Group not found in EventGroups dictionary.", groupName);
|
Debug.Console(0,
|
||||||
|
"[Scheduler]: Unable to delete events from group '{0}'. Group not found in EventGroups dictionary.",
|
||||||
|
groupName);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ListAllEventGroups(string command)
|
static void ListAllEventGroups(string command)
|
||||||
|
|||||||
Reference in New Issue
Block a user