Esempio n. 1
0
        public static bool TryParse(IRCSharp.Kernel.Model.Query.IRCCommandQuery ircQuery, out IRCSharp.Kernel.Model.Query.UserdefinedCommandQuery userdefinedCommandQuery)
        {
            UserdefinedCommandParser parser = new UserdefinedCommandParser();
            bool parsed = false;
            Model.Query.UserdefinedCommandQuery query = null;
            if (ircQuery.Command == Model.Query.IRCCommand.PRIVMSG && IsUserdefinedCommand(ircQuery.Parameter))
            {
                string commandName = parser.ParseCommandName(ircQuery.Parameter);
                IList<string> commandNameParameters = parser.ParseCommandParameters(ircQuery.Parameter);
                query = new Model.Query.UserdefinedCommandQuery(commandName, ircQuery);
                query.AddParameters(commandNameParameters);
                parsed = true;
            }

            userdefinedCommandQuery = query;
            return parsed;
        }
Esempio n. 2
0
        //TODO: remake method call. Network should not be part of this. Wrap this up in some context that holds network and line.
        public static bool TryParse(string network, string line, out Model.Query.UserdefinedCommandQuery query)
        {
            UserdefinedCommandParser parser = new UserdefinedCommandParser();
            IRCSharp.Kernel.Model.Query.IRCCommandQuery ircQuery = null;
            Model.Query.UserdefinedCommandQuery output = null;
            bool parsedIRCQuery = IRCSharp.Kernel.Parser.IRC.IRCQueryParser.TryParse(network, line, out ircQuery);
            bool parsed = false;

            if (ircQuery.Command == Model.Query.IRCCommand.PRIVMSG && IsUserdefinedCommand(ircQuery.Parameter))
            {
                string commandName = parser.ParseCommandName(ircQuery.Parameter);
                IList<string> commandNameParameters = parser.ParseCommandParameters(ircQuery.Parameter);
                query = new Model.Query.UserdefinedCommandQuery(commandName, ircQuery);
                query.AddParameters(commandNameParameters);
                parsed = true;

            }

            query = output;
            return parsed;
        }