예제 #1
0
        protected CompiledKnowledgeBase(SerializationInfo info, StreamingContext context)
        {
            this._synonyms            = (Hashtable)info.GetValue("s", typeof(Hashtable));
            this._replacements        = (ArrayList)info.GetValue("r", typeof(ArrayList));
            this._inputs              = (Hashtable)info.GetValue("i", typeof(Hashtable));
            this._outputs             = (Hashtable)info.GetValue("o", typeof(Hashtable));
            this._knowledgeBaseItem   = (KnowledgeBaseItem)info.GetValue("k", typeof(KnowledgeBaseItem));
            this._knowledgeBaseInfo   = (KnowledgeBaseInfo)info.GetValue("kbi", typeof(KnowledgeBaseInfo));
            this._build               = info.GetInt32("b");
            this._random              = new Random();
            this._recentOutputsByRule = new Hashtable();

            //use a try/catch block around any new vales
            try
            {
                this._inputReplacements = (ArrayList)info.GetValue("ir", typeof(ArrayList));
            }
            catch
            {
                this._inputReplacements = new ArrayList();
            }

            this.InitializeCsToolbox();
            try
            {
                this._csToolbox.CodeModules = (ArrayList)info.GetValue("cm", typeof(ArrayList));
            }
            catch
            {
                this._csToolbox.CodeModules = new ArrayList();
            }
        }
예제 #2
0
 public KnowledgeBase()
 {
     Rules = new ArrayList();
     ResourceFiles = new ArrayList();
     Version = "1.0";
     Build = 0;
     Changed = false;
     Info = new KnowledgeBaseInfo();
 }
예제 #3
0
 public KnowledgeBaseItem()
 {
     Filename = "";
     Fullpath = "";
     Used     = false;
     Trusted  = false;
     Build    = -1;
     Info     = null;
 }
예제 #4
0
 protected KnowledgeBaseItem(SerializationInfo info, StreamingContext context)
 {
     Filename = info.GetString("fn");
     Fullpath = info.GetString("fp");
     Used     = info.GetBoolean("u");
     Trusted  = info.GetBoolean("t");
     Build    = info.GetInt32("b");
     Info     = null;
     //use a try/catch block around any new vales
 }
예제 #5
0
        [NonSerialized] public string Name; //This is just used for comparison when reloading

        public CompiledKnowledgeBase()
        {
            this.KbList             = new List <KnowledgeBase>();
            this._synonyms          = new Hashtable();
            this._replacements      = new ArrayList();
            this._inputReplacements = new ArrayList();
            this._inputs            = new Hashtable();
            this._outputs           = new Hashtable();
            this._knowledgeBaseItem = new KnowledgeBaseItem();
            this._knowledgeBaseInfo = new KnowledgeBaseInfo();
            this._build             = -1;
            this.Name    = "";
            this._random = new Random();
            this._recentOutputsByRule = new Hashtable();
            this.InitializeCsToolbox();
        }