示例#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);
            }
        }
示例#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);
            }
        }