Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Fruffi.Db;
- using Fruffi.Db.BrainTableAdapters;
- using System.Data;
- using System.Data.SqlServerCe;
- namespace Fruffi.Bot
- {
- class Connection
- {
- private SqlCeConnection connection;
- private Db.BrainTableAdapters.remTableAdapter adapter;
- private string dbfile;
- public Connection()
- {
- Fruffi.say("Connect to brain.sdf in the program folder");
- this.dbfile = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName + "\\Db\\Brain.sdf";
- Fruffi.sayInit(dbfile);
- this.connection = new SqlCeConnection("datasource=" + dbfile);
- Fruffi.sayInit(connection);
- this.adapter = new Db.BrainTableAdapters.remTableAdapter();
- Fruffi.sayInit(adapter);
- Fruffi.say(this.remember("bar"));
- Fruffi.say(this.remember("foo"));
- }
- public string remember(string rememberTo)
- {
- Brain.remDataTable table = adapter.remember(rememberTo);
- Fruffi.sayInit(table);
- int summary = table.Rows.Count;
- string result = "";
- Random rand = new Random();
- int say = rand.Next(0, summary);
- int current = 0;
- foreach (DataRow row in table.Rows)
- {
- if(say == current)
- foreach (DataColumn column in table.Columns)
- if (column.Caption == "say")
- result = row[column].ToString();
- current++;
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement