public virtual string Get(string name) { // validation if (KB.Contains(name) == false) { throw new Exception(string.Format("The logical name '{0}' doesn't exist", name)); } return(Convert.ToString(KB[name])); }
public virtual void Remove(string name) { // validation if (AllowToUpdate == false) { throw new Exception("The Knowledge Base is locked"); } if (KB.Contains(name) == false) { throw new Exception(string.Format("The logical name '{0}' doesn't exist", name)); } // fire event if (OnBeforeClearKnowledgeBase(name) == false) { return; } // remove name from the KB KB.Remove(name); // fire event OnClearKnowledgeBase(name); }
public virtual void Update(string name, string val) { // validation if (AllowToUpdate == false) { throw new Exception("The Knowledge Base is locked"); } if (KB.Contains(name) == false) { throw new Exception(string.Format("The logical name '{0}' doesn't exist", name)); } // fire event if (OnBeforeChangeKnowledgeBase(name, val) == false) { return; } // update value in the KB KB[name] = val; // fire event OnChangedKnowledgeBase(name, val); }
public virtual bool Exists(string name) { return(KB.Contains(name)); }
public virtual string Mapping(string name) { return(KB.Contains(name) == true?Convert.ToString(KB[name]) : name); }