示例#1
0
        /// <summary>
        /// Returns the value of a setting given the name of the setting
        /// </summary>
        /// <param name="name">the name of the setting whose value we're interested in</param>
        /// <returns>the value of the setting</returns>
        public string grabSetting(string name)
        {
            string normalizedName = MakeCaseInsensitive.TransformInput(name);

            if (this.containsSettingCalled(normalizedName))
            {
                return((string)this.settingsHash[normalizedName]);
            }
            else
            {
                return(string.Empty);
            }
        }
        /// <summary>
        /// Checks to see if a setting of a particular name exists
        /// </summary>
        /// <param name="name">The setting name to check</param>
        /// <returns>Existential truth value</returns>
        public bool containsSettingCalled(string name)
        {
            string normalizedName = MakeCaseInsensitive.TransformInput(name);

            if (normalizedName.Length > 0)
            {
                return(this.orderedKeys.Contains(normalizedName));
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        /// <summary>
        /// Checks to see if a setting of a particular name exists
        /// </summary>
        /// <param name="name">The setting name to check</param>
        /// <returns>Existential truth value</returns>
        public bool containsSettingCalled(string name)
        {
            string normalizedName = MakeCaseInsensitive.TransformInput(name);

            // Check if it's size is > 0 and then
            // look in list for it.
            if (normalizedName.Length > 0)
            {
                return(this.orderedKeys.Contains(normalizedName));
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// Removes a named setting from the Dictionary<,>
        /// </summary>
        /// <param name="name">the key for the Dictionary<,></param>
        private void removeFromHash(string name)
        {
            string normalizedName = MakeCaseInsensitive.TransformInput(name);

            this.settingsHash.Remove(normalizedName);
        }
        // Token: 0x060000AC RID: 172 RVA: 0x00006B7C File Offset: 0x00005B7C
        public bool containsSettingCalled(string name)
        {
            string text = MakeCaseInsensitive.TransformInput(name);

            return(text.Length > 0 && this.orderedKeys.Contains(text));
        }
        // Token: 0x060000A8 RID: 168 RVA: 0x00006AD4 File Offset: 0x00005AD4
        private void removeFromHash(string name)
        {
            string key = MakeCaseInsensitive.TransformInput(name);

            this.settingsHash.Remove(key);
        }
 /// <summary>
 /// Removes the named setting from this class
 /// </summary>
 /// <param name="name">The name of the setting to remove</param>
 public void RemoveSetting(string name)
 {
     string normalizedName = MakeCaseInsensitive.TransformInput(name);
     this.orderedKeys.Remove(normalizedName);
     this.RemoveFromHash(normalizedName);
 }
示例#8
0
        // Token: 0x0600001D RID: 29 RVA: 0x000028E0 File Offset: 0x000018E0
        public string evaluate(string path, SubQuery query, Request request, MatchState matchstate, StringBuilder wildcard)
        {
            if (request.StartedOn.AddMilliseconds(request.bot.TimeOut) < DateTime.Now)
            {
                request.bot.writeToLog(string.Concat(new string[]
                {
                    "WARNING! Request timeout. User: "******" raw input: \"",
                    request.rawInput,
                    "\""
                }));
                request.hasTimedOut = true;
                return(string.Empty);
            }
            path = path.Trim();
            if (this.children.Count == 0)
            {
                if (path.Length > 0)
                {
                    this.storeWildCard(path, wildcard);
                }
                return(this.template);
            }
            if (path.Length == 0)
            {
                return(this.template);
            }
            string[] array = path.Split(" \r\n\t".ToCharArray());
            string   text  = MakeCaseInsensitive.TransformInput(array[0]);
            string   path2 = path.Substring(text.Length, path.Length - text.Length);

            if (this.children.ContainsKey("_"))
            {
                Node          node          = this.children["_"];
                StringBuilder stringBuilder = new StringBuilder();
                this.storeWildCard(array[0], stringBuilder);
                string text2 = node.evaluate(path2, query, request, matchstate, stringBuilder);
                if (text2.Length > 0)
                {
                    if (stringBuilder.Length > 0)
                    {
                        switch (matchstate)
                        {
                        case MatchState.UserInput:
                            query.InputStar.Add(stringBuilder.ToString());
                            stringBuilder.Remove(0, stringBuilder.Length);
                            break;

                        case MatchState.That:
                            query.ThatStar.Add(stringBuilder.ToString());
                            break;

                        case MatchState.Topic:
                            query.TopicStar.Add(stringBuilder.ToString());
                            break;
                        }
                    }
                    return(text2);
                }
            }
            if (this.children.ContainsKey(text))
            {
                MatchState matchstate2 = matchstate;
                if (text == "<THAT>")
                {
                    matchstate2 = MatchState.That;
                }
                else if (text == "<TOPIC>")
                {
                    matchstate2 = MatchState.Topic;
                }
                Node          node2          = this.children[text];
                StringBuilder stringBuilder2 = new StringBuilder();
                string        text3          = node2.evaluate(path2, query, request, matchstate2, stringBuilder2);
                if (text3.Length > 0)
                {
                    if (stringBuilder2.Length > 0)
                    {
                        switch (matchstate)
                        {
                        case MatchState.UserInput:
                            query.InputStar.Add(stringBuilder2.ToString());
                            stringBuilder2.Remove(0, stringBuilder2.Length);
                            break;

                        case MatchState.That:
                            query.ThatStar.Add(stringBuilder2.ToString());
                            stringBuilder2.Remove(0, stringBuilder2.Length);
                            break;

                        case MatchState.Topic:
                            query.TopicStar.Add(stringBuilder2.ToString());
                            stringBuilder2.Remove(0, stringBuilder2.Length);
                            break;
                        }
                    }
                    return(text3);
                }
            }
            if (this.children.ContainsKey("*"))
            {
                Node          node3          = this.children["*"];
                StringBuilder stringBuilder3 = new StringBuilder();
                this.storeWildCard(array[0], stringBuilder3);
                string text4 = node3.evaluate(path2, query, request, matchstate, stringBuilder3);
                if (text4.Length > 0)
                {
                    if (stringBuilder3.Length > 0)
                    {
                        switch (matchstate)
                        {
                        case MatchState.UserInput:
                            query.InputStar.Add(stringBuilder3.ToString());
                            stringBuilder3.Remove(0, stringBuilder3.Length);
                            break;

                        case MatchState.That:
                            query.ThatStar.Add(stringBuilder3.ToString());
                            break;

                        case MatchState.Topic:
                            query.TopicStar.Add(stringBuilder3.ToString());
                            break;
                        }
                    }
                    return(text4);
                }
            }
            if (this.word == "_" || this.word == "*")
            {
                this.storeWildCard(array[0], wildcard);
                return(this.evaluate(path2, query, request, matchstate, wildcard));
            }
            wildcard = new StringBuilder();
            return(string.Empty);
        }