예제 #1
0
 private void fromAIMLToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         folderBrowserDialogAIML.RootFolder   = Environment.SpecialFolder.MyComputer;
         folderBrowserDialogAIML.SelectedPath = this.myBot.PathToAIML;
         DialogResult dr = folderBrowserDialogAIML.ShowDialog(this);
         if (dr == DialogResult.OK)
         {
             AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(this.myBot);
             this.myBot.isAcceptingUserInput = false;
             if (folderBrowserDialogAIML.SelectedPath.Length > 0)
             {
                 loader.loadAIML(folderBrowserDialogAIML.SelectedPath);
             }
             else
             {
                 loader.loadAIML(this.myBot.PathToAIML);
             }
             this.myBot.isAcceptingUserInput = true;
         }
     }
     catch (Exception ex)
     {
         this.richTextBoxOutput.Text += ex.Message + Environment.NewLine;
     }
 }
예제 #2
0
파일: aimlForm.cs 프로젝트: minnkyaw/tartar
 private void fromAIMLToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         folderBrowserDialogAIML.RootFolder = Environment.SpecialFolder.MyComputer;
         folderBrowserDialogAIML.SelectedPath = this.myBot.PathToAIML;
         DialogResult dr = folderBrowserDialogAIML.ShowDialog(this);
         if (dr == DialogResult.OK)
         {
             AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(this.myBot);
             this.myBot.isAcceptingUserInput = false;
             if (folderBrowserDialogAIML.SelectedPath.Length > 0)
             {
                 loader.loadAIML(folderBrowserDialogAIML.SelectedPath);
             }
             else
             {
                 loader.loadAIML(this.myBot.PathToAIML);
             }
             this.myBot.isAcceptingUserInput = true;
         }
     }
     catch (Exception ex)
     {
         this.richTextBoxOutput.Text += ex.Message + Environment.NewLine;
     }
 }
예제 #3
0
파일: iBOT.cs 프로젝트: abhishek-kumar/AIGA
        //methods
        public bool initialize_iBOT()
        {
            //initialize bot
            bot = new Bot();
            bot.loadSettings(); //TODO: change settings.xml in config

            //user settings
            user = new User("DefaultUser", this.bot);

            //Log writer event setting
            bot.WrittenToLog += new Bot.LogMessageDelegate(bot_Log);

            //Initialize the bot's Mind
            try
            {
                AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(this.bot);
                this.bot.isAcceptingUserInput = false;
                loader.loadAIML(AIMLSourcePath);
                this.bot.isAcceptingUserInput = true;
            }
            catch (Exception ex)
            {
                ExceptionMsgs += DateTime.Now.ToString() + ">> " + ex.Message + Environment.NewLine;
                return false;
            }
            //the bot is ready to serve!
            initialized = true;
            return true;
        }
예제 #4
0
        //methods
        public bool initialize_iBOT()
        {
            //initialize bot
            bot = new Bot();
            bot.loadSettings(); //TODO: change settings.xml in config

            //user settings
            user = new User("DefaultUser", this.bot);

            //Log writer event setting
            bot.WrittenToLog += new Bot.LogMessageDelegate(bot_Log);

            //Initialize the bot's Mind
            try
            {
                AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(this.bot);
                this.bot.isAcceptingUserInput = false;
                loader.loadAIML(AIMLSourcePath);
                this.bot.isAcceptingUserInput = true;
            }
            catch (Exception ex)
            {
                ExceptionMsgs += DateTime.Now.ToString() + ">> " + ex.Message + Environment.NewLine;
                return(false);
            }
            //the bot is ready to serve!
            initialized = true;
            return(true);
        }
예제 #5
0
 public void testWithValidData()
 {
     XmlNode testNode = StaticHelpers.getNode("<size/>");
     this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.size(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, this.mockResult, testNode);
     Assert.AreEqual("0", this.mockBotTagHandler.Transform());
     AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(this.mockBot);
     loader.loadAIML();
     Assert.AreEqual(Convert.ToString(sizeTagTests.Size), this.mockBotTagHandler.Transform());
 }
예제 #6
0
        public void testWithValidData()
        {
            XmlNode testNode = StaticHelpers.getNode("<size/>");

            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.size(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, this.mockResult, testNode);
            Assert.AreEqual("0", this.mockBotTagHandler.Transform());
            AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(this.mockBot);
            loader.loadAIML();
            Assert.AreEqual(Convert.ToString(sizeTagTests.Size), this.mockBotTagHandler.Transform());
        }
        public MainWindow()
        {
            bot = new Bot();
            user = new User("DefaultUser", bot);
            bot.loadSettings();
            AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(bot);
            bot.isAcceptingUserInput = false;
            loader.loadAIML(bot.PathToAIML);
            bot.isAcceptingUserInput = true;

            InitializeComponent();
        }
예제 #8
0
 private void fromDefaultToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(this.myBot);
         this.myBot.isAcceptingUserInput = false;
         loader.loadAIML(this.myBot.PathToAIML);
         this.myBot.isAcceptingUserInput = true;
     }
     catch (Exception ex)
     {
         this.richTextBoxOutput.Text += ex.Message + Environment.NewLine;
     }
 }
예제 #9
0
        public string Ask(string name, string question)
        {
            var sharpBot = new Bot();
            sharpBot.loadSettings(SettingsPath);
            var loader = new AIMLbot.Utils.AIMLLoader(sharpBot);
            loader.loadAIML(aimlPath);
            sharpBot.isAcceptingUserInput = false;
            sharpBot.isAcceptingUserInput = true;

            var patient = new User(name, sharpBot);
            var request = new Request(question, patient, sharpBot);
            var answer = sharpBot.Chat(request);
            return answer.Output;
        }
 public void Initialize()
 {
     myBot.loadSettings();
     AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(myBot);
     if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"/App_Data/Graphmaster.dat"))
         myBot.loadFromBinaryFile(AppDomain.CurrentDomain.BaseDirectory + @"/App_Data/Graphmaster.dat");
     if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"/App_Data/Missy.db"))
         myBot.loadFromBinaryFile(AppDomain.CurrentDomain.BaseDirectory + @"/App_Data/Missy.db");
     if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"/reasoner-3.3.2/reasoner-3.3.2/bin/su.dat"))
         myBot.loadFromBinaryFile(AppDomain.CurrentDomain.BaseDirectory + @"/reasoner-3.3.2/reasoner-3.3.2/bin/su.dat");
     myBot.isAcceptingUserInput = false;
     loader.loadAIML(myBot.PathToAIML);
     myBot.isAcceptingUserInput = true;
 }
예제 #11
0
 public ChatRobotOperator(string userName)
 {
     bot = new Bot();
     bot.loadSettings();
     user = new User(userName, bot);
     //try
     //{
         AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(bot);
         bot.isAcceptingUserInput = false;
         loader.loadAIML(bot.PathToAIML);
         bot.isAcceptingUserInput = true;
     //}
     //catch (Exception ex)
     //{
     //    //this.outputRichTextBox.AppendText(ex.Message + Environment.NewLine);
     //}
 }
예제 #12
0
파일: chat.cs 프로젝트: uncled1023/IRCBot
        public chat()
        {
            chat_time.AutoReset = false;
            chat_time.Elapsed  += stop_chat;
            chat_time.Enabled   = false;

            still_chatting = false;
            chatting_nick  = new List <string>();
            myBot          = new AIMLbot.Bot();
            myBot.loadSettings(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "modules" + Path.DirectorySeparatorChar + "chat" + Path.DirectorySeparatorChar + "Settings.xml");
            myUser = new User("chat_nick", myBot);

            AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(myBot);
            myBot.isAcceptingUserInput = false;
            loader.loadAIML(myBot.PathToAIML);
            myBot.isAcceptingUserInput = true;
        }
예제 #13
0
파일: chat.cs 프로젝트: Zanthas/IRCBot
        public chat()
        {
            chat_time.AutoReset = false;
            chat_time.Elapsed += stop_chat;
            chat_time.Enabled = false;

            still_chatting = false;
            chatting_nick = new List<string>();
            myBot = new Bot();
            myBot.loadSettings();
            myUser = new User("chat_nick", myBot);

            AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(myBot);
            myBot.isAcceptingUserInput = false;
            loader.loadAIML(myBot.PathToAIML);
            myBot.isAcceptingUserInput = true;
        }
예제 #14
0
파일: chat.cs 프로젝트: Zanthas/IRCBot
        public chat()
        {
            chat_time.AutoReset = false;
            chat_time.Elapsed  += stop_chat;
            chat_time.Enabled   = false;

            still_chatting = false;
            chatting_nick  = new List <string>();
            myBot          = new Bot();
            myBot.loadSettings();
            myUser = new User("chat_nick", myBot);

            AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(myBot);
            myBot.isAcceptingUserInput = false;
            loader.loadAIML(myBot.PathToAIML);
            myBot.isAcceptingUserInput = true;
        }
예제 #15
0
 private bool LoadALICE()
 {
     try
     {
         Alice = new AIMLbot.Bot();
         Alice.isAcceptingUserInput = false;
         Alice.loadSettings();
         AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(Alice);
         Alice.isAcceptingUserInput = false;
         loader.loadAIML(Alice.PathToAIML);
         Alice.isAcceptingUserInput = true;
         return(true);
     }
     catch (Exception ex)
     {
         System.Console.WriteLine("Failed loading ALICE: " + ex.Message);
         return(false);
     }
 }
예제 #16
0
        public Form2()
        {
            InitializeComponent();
            this.inputTextBox.Focus();
            myBot = new Bot();
            myBot.loadSettings();
            myUser = new User("DefaultUser", this.myBot);
            myBot.WrittenToLog += new Bot.LogMessageDelegate(myBot_WrittenToLog);

            try
            {
                AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(this.myBot);
                this.myBot.isAcceptingUserInput = false;
                loader.loadAIML(this.myBot.PathToAIML);
                this.myBot.isAcceptingUserInput = true;
            }
            catch (Exception ex)
            {
                this.outputRichTextBox.AppendText(ex.Message + Environment.NewLine);
            }
        }
예제 #17
0
 private bool LoadALICE()
 {
     try
     {
         Alice = new Bot
         {
             isAcceptingUserInput = false
         };
         string configFile = Path.Combine(
             Directory.GetCurrentDirectory(),
             "aiml_config", "Settings.xml");
         Alice.loadSettings(configFile);
         var loader = new AIMLbot.Utils.AIMLLoader(Alice);
         Alice.isAcceptingUserInput = false;
         loader.loadAIML(Alice.PathToAIML);
         Alice.isAcceptingUserInput = true;
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Failed loading ALICE: " + ex.Message);
         return(false);
     }
 }
예제 #18
0
파일: Alice.cs 프로젝트: Nuriat/radegast
 private void LoadALICE()
 {
     try
     {
         Alice = new AIMLbot.Bot();
         Alice.isAcceptingUserInput = false;
         Alice.loadSettings();
         AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(Alice);
         Alice.isAcceptingUserInput = false;
         loader.loadAIML(Alice.PathToAIML);
         Alice.isAcceptingUserInput = true;
     }
     catch (Exception ex)
     {
         System.Console.WriteLine("Failed loading ALICE: " + ex.Message);
     }
 }
예제 #19
0
파일: aimlForm.cs 프로젝트: minnkyaw/tartar
 private void fromDefaultToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(this.myBot);
         this.myBot.isAcceptingUserInput = false;
         loader.loadAIML(this.myBot.PathToAIML);
         this.myBot.isAcceptingUserInput = true;
     }
     catch (Exception ex)
     {
         this.richTextBoxOutput.Text += ex.Message + Environment.NewLine;
     }
 }