0

私はC#でAIMLbot.dllを使用しています。私は2つの関数saveToBinaryFileとを見ましたloadFromBinaryFile。これらの機能は、ボットの頭脳にある現在のコンテンツをファイルに保存するためのものだと思います。しかし、それは機能していないようです!つまり、自分の名前を覚えて、その内容をGraphMaster.datファイルに保存すると言う場合。次回、同じファイルのコンテンツをロードし、自分の名前を尋ねると、間違った答えが返されます。私のクラスは以下の通りです。

class AIBot
    {
        private Bot myBot;
        private User myUser;

        public AIBot()
        {
            myBot = new Bot();
            myUser = new User("UnknownUser", myBot);
        }

        public void Initialize()
        {
            myBot.loadSettings();
            myBot.isAcceptingUserInput = false;
            myBot.loadAIMLFromFiles();
            myBot.isAcceptingUserInput = true;
        }

        public void Load()
        {
            if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Graphmaster.dat"))
                myBot.loadFromBinaryFile(AppDomain.CurrentDomain.BaseDirectory + @"\Graphmaster.dat");
        }

        public string GetResponse(string input)
        {
            Request r = new Request(input, myUser, myBot);
            Result res = myBot.Chat(r);
            return (res.Output);
        }

        public void Save()
        {
            myBot.saveToBinaryFile(AppDomain.CurrentDomain.BaseDirectory + @"\Graphmaster.dat");
        }
    }

誰かが問題を指摘するのを手伝ってもらえますか?

4

1 に答える 1

2

私はその問題の解決策を得た。それが他の人を助けることを願っています。

  1. 次のようなユーザーセッションを保存します

    this.myUser.Predicates.DictionaryAsXML.Save(saveFileDialogDump.FileName);
    
  2. 次回、保存されたセッションをロードします。

    this.myUser.Predicates.loadSettings(openFileDialogDump.FileName);
    
于 2012-06-25T07:37:42.163 に答える