Exemple #1
0
        private static void BoxDbAdd(IrcMessage theMessage)
        {
            Match match = Regex.Match(theMessage.CommandLine, "boxdb add \"(?<short>[^\"]*)\" \"(?<full>[^\"]*)\" (?<regex>.*)");

            if (!match.Success)
            {
                theMessage.Answer("Zu wenig Parameter: boxdb add \"(?<short>[^\"]*)\" \"(?<full>[^\"]*)\" (?<regex>.*)");
                return;
            }

            Box box = BoxDatabase.GetBoxByShortName(match.Groups["short"].Value);

            string[] regexes = Regex.Matches(match.Groups["regex"].Value, "\"(?<value>[^\"]*)\"").Cast <Match>().Select(x => x.Groups["value"].Value).ToArray();
            if (box == null)
            {
                box = BoxDatabase.AddBox(match.Groups["short"].Value, match.Groups["full"].Value, regexes);
                theMessage.Answer("Box erfolgreich hinzugefügt");
            }
            else
            {
                box.FullName = match.Groups["full"].Value;
                box.AddRegex(regexes);
                theMessage.Answer("Box Infos geupdated");
            }
        }
Exemple #2
0
        private static void BoxDbRegex(IrcMessage theMessage)
        {
            Match match = Regex.Match(theMessage.CommandLine, "boxdb regex \"(?<short>[^\"]*)\" (?<regex>.*)");

            if (!match.Success)
            {
                theMessage.Answer("Zu wenig Parameter: boxdb regex \"(?<short>[^\"]*)\" (?<regex>.*)");
                return;
            }

            Box box = BoxDatabase.GetBoxByShortName(match.Groups["short"].Value);

            if (box == null)
            {
                theMessage.Answer("Für diesen ShortName konnte ich keine Box ermitteln");
                return;
            }

            string[] regexes = Regex.Matches(match.Groups["regex"].Value, "\"(?<value>[^\"]*)\"").Cast <Match>().Select(x => x.Groups["value"].Value).ToArray();
            box.AddRegex(regexes);
            theMessage.Answer("Regex(e) erfolgreich hinzugefügt");
        }