Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }