Example #1
0
        public void zapis(String zmienna, String wartosc)
        {
            string[] linia = new String[1000];
            string plik = "aiml/" + nazwa;
            int ilosc = 0;
            StreamReader sr = new StreamReader(plik);
            while ((linia[ilosc] = sr.ReadLine()) != null)
            {
                ilosc = ilosc + 1;
            }
            sr.Close();
            TextWriter zapis = new StreamWriter(plik);
            for (int i = 0; i < ilosc; i++)
            {
                if (linia[i].Contains("set name=\"" + zmienna))
                {
                    zapis.WriteLine(linia[i].Replace(linia[i].ToString(), "<template><set name=\"" + zmienna + "\">" + wartosc + "</set></template>"));
                }
                else
                {
                    zapis.WriteLine(linia[i]);
                }
            }

            zapis.Close();
            cAIMLLoader load = new cAIMLLoader(mybot.GraphMaster);
            load.loadAIML(@".\aiml\\");
            mybot = new cBot(false);
        }
Example #2
0
        /// <summary>
        /// Initialises the bot with the default (core brain) settings
        /// </summary>
        /// <param name="path">Path to AIML files</param>
        private void init(string path)
        {
            cGlobals.writeLog("Starting Bot initialization...");
            // load the default predicates
            loadPredicates(cGlobals.BOTPATH);

            // get the .aiml file-names in the default directory
            ArrayList alAimlFiles = getAIMLFileList(path);

            // check we have some files to load!
            if (alAimlFiles.Count == 0)
            {
                cGlobals.writeLog("No .aiml files were found in the directory: " + path);
                return;
            }

            // o.k. if we've got this far we should be able to populate the Graphmaster

            // load the aiml files into the GraphMaster
            cGlobals.writeLog("Starting to populate the graphmaster... (this may take some time)");
            cAIMLLoader loader = new cAIMLLoader(GraphMaster);

            cGlobals.writeLog(loader.loadAIML(cGlobals.AIMLPATH));

            size += loader.counter;

            cGlobals.writeLog("Default AIML file initialisation finished. Bot has processed " + Convert.ToString(size) + " categories.");

            // populate the substitutions Hashtable
            Substitutions = cGlobals.getSubstitutions();

            cGlobals.writeLog("Default substitutions initialised...");

            this.grabSplitters();
        }
Example #3
0
		/// <summary>
		/// Initialises the bot with the default (core brain) settings
		/// </summary>
		/// <param name="path">Path to AIML files</param>
		private void init(string path)
		{
			cGlobals.writeLog("Starting Bot initialization...");
			// load the default predicates
			loadPredicates(cGlobals.BOTPATH);

			// get the .aiml file-names in the default directory
			ArrayList alAimlFiles = getAIMLFileList(path);

			// check we have some files to load!
			if (alAimlFiles.Count==0)
			{
				cGlobals.writeLog("No .aiml files were found in the directory: "+path);
				return;
			}
			
			// o.k. if we've got this far we should be able to populate the Graphmaster

			// load the aiml files into the GraphMaster
			cGlobals.writeLog("Starting to populate the graphmaster... (this may take some time)");
			cAIMLLoader loader = new cAIMLLoader(GraphMaster);
			cGlobals.writeLog(loader.loadAIML(cGlobals.AIMLPATH));
			
			size+=loader.counter;

			cGlobals.writeLog("Default AIML file initialisation finished. Bot has processed "+Convert.ToString(size)+" categories.");
			
			// populate the substitutions Hashtable
			Substitutions=cGlobals.getSubstitutions();

			cGlobals.writeLog("Default substitutions initialised...");
			
			this.grabSplitters();
		}