コード例 #1
0
        protected override void RefreshCommandSuggestions(List <CommandData> suggestedCommands)
        {
            if (m_FilterCommandData == null)
            {
                MethodInfo filterMethodInfo = this.GetType().GetMethod("CommandFilterChannel", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
                m_FilterCommandData = new CommandData(filterMethodInfo, "filter");
                QuantumConsoleProcessor.TryAddCommand(m_FilterCommandData);
            }

            if (m_FilterMethod == null)
            {
                m_FilterMethod = this.GetType().GetMethod("CommandFilterChannelWildcard", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
            }

            string[] channels = LogChannel.GetAllChannelIds();
            foreach (var channel in channels)
            {
                if (m_RegisteredFilterChannels.Contains(channel))
                {
                    continue;
                }

                m_RegisteredFilterChannels.Add(channel);
                QuantumConsoleProcessor.TryAddCommand(new CommandData(m_FilterMethod, $"filter {channel}"));
            }

            base.RefreshCommandSuggestions(suggestedCommands);
        }