public void Call(string name, params object[] data) { bool result = false; foreach (var snippet in LoadedSnippets) { if (snippet.GetType().Name.ToLower().Contains(name.ToLower())) { OnSnippetCalled?.Invoke(snippet); snippet.Run(data); result = true; break; } } if (!result) { OutMgr.CreateConsole().WriteLine("No snippet found to process this command", OutLevel.Error); } }
public void Call <T>(params object[] data) { bool result = false; foreach (var snippet in LoadedSnippets) { if (snippet.GetType() == typeof(T)) { OnSnippetCalled?.Invoke(snippet); snippet.Run(data); result = true; break; } } if (!result) { OutMgr.CreateConsole().WriteLine("No snippet found to process this command", OutLevel.Error); } }