// Token: 0x0600001C RID: 28 RVA: 0x000027E4 File Offset: 0x000017E4 public void addCategory(string path, string template, string filename) { if (template.Length == 0) { throw new XmlException(string.Concat(new string[] { "The category with a pattern: ", path, " found in file: ", filename, " has an empty template tag. ABORTING" })); } if (path.Trim().Length == 0) { this.template = template; this.filename = filename; return; } string[] array = path.Trim().Split(" ".ToCharArray()); string text = MakeCaseInsensitive.TransformInput(array[0]); string path2 = path.Substring(text.Length, path.Length - text.Length).Trim(); if (this.children.ContainsKey(text)) { Node node = this.children[text]; node.addCategory(path2, template, filename); return; } Node node2 = new Node(); node2.word = text; node2.addCategory(path2, template, filename); this.children.Add(node2.word, node2); }
// Token: 0x060000A7 RID: 167 RVA: 0x00006AAC File Offset: 0x00005AAC public void removeSetting(string name) { string text = MakeCaseInsensitive.TransformInput(name); this.orderedKeys.Remove(text); this.removeFromHash(text); }
/// <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); }
/// <summary> /// Updates the named setting with a new value whilst retaining the position in the /// dictionary /// </summary> /// <param name="name">the name of the setting</param> /// <param name="value">the new value</param> public void UpdateSetting(string name, string value) { string key = MakeCaseInsensitive.TransformInput(name); if (this.orderedKeys.Contains(key)) { this.RemoveFromHash(key); this.settingsHash.Add(MakeCaseInsensitive.TransformInput(key), value); } }
// Token: 0x060000AB RID: 171 RVA: 0x00006B4C File Offset: 0x00005B4C public string grabSetting(string name) { string text = MakeCaseInsensitive.TransformInput(name); if (this.containsSettingCalled(text)) { return(this.settingsHash[text]); } return(string.Empty); }
/// <summary> /// Adds a bespoke setting to the Settings class (accessed via the grabSettings(string name) /// method. /// </summary> /// <param name="name">The name of the new setting</param> /// <param name="value">The value associated with this setting</param> public void AddSetting(string name, string value) { string key = MakeCaseInsensitive.TransformInput(name); if (key.Length > 0) { this.RemoveSetting(key); this.orderedKeys.Add(key); this.settingsHash.Add(MakeCaseInsensitive.TransformInput(key), value); } }
// Token: 0x060000A9 RID: 169 RVA: 0x00006AF8 File Offset: 0x00005AF8 public void updateSetting(string name, string value) { string text = MakeCaseInsensitive.TransformInput(name); if (this.orderedKeys.Contains(text)) { this.removeFromHash(text); this.settingsHash.Add(MakeCaseInsensitive.TransformInput(text), value); } }
// Token: 0x060000A6 RID: 166 RVA: 0x00006A68 File Offset: 0x00005A68 public void addSetting(string name, string value) { string text = MakeCaseInsensitive.TransformInput(name); if (text.Length > 0) { this.removeSetting(text); this.orderedKeys.Add(text); this.settingsHash.Add(MakeCaseInsensitive.TransformInput(text), value); } }
/// <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; } }
/// <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> /// 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 GetSetting(string name) { string normalizedName = MakeCaseInsensitive.TransformInput(name); if (this.ContainsSetting(normalizedName)) { return((string)this.SettingsHash[normalizedName]); } else { return(string.Empty); } }
/// <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 (containsSettingCalled(normalizedName)) { return(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); // 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: 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); }
// 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)); }
public void testNormalizedToUpper() { string testInput = "abcdefghijklmnopqrstuvwxyz1234567890"; mockCaseInsensitive = new MakeCaseInsensitive(_mockChatBot, testInput); Assert.AreEqual("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", mockCaseInsensitive.Transform()); }
// Token: 0x060000A8 RID: 168 RVA: 0x00006AD4 File Offset: 0x00005AD4 private void removeFromHash(string name) { string key = MakeCaseInsensitive.TransformInput(name); this.settingsHash.Remove(key); }