public void addCharacter(Character c) { foreach (Character ch in chars) { if (c.charx == ch.charx) return; } chars.Add(c); }
public Character MatchCharacter(int charid) { conn = new System.Data.SQLite.SQLiteConnection(@"Data Source=CoreInkLib.dll"); conn.Open(); SQLiteCommand sqc = new SQLiteCommand("SELECT * FROM character WHERE char_id = " + charid+ ";", conn); SQLiteDataReader sqr = sqc.ExecuteReader(); sqr.Read(); Character c = new Character(); c.lang = Convert.ToInt32(sqr[2]); c.charx = sqr[1].ToString(); conn.Close(); return c; }
public void LoadData() { chars = new List<Character>(); conn = new System.Data.SQLite.SQLiteConnection(@"Data Source=CoreInkLib.dll"); conn.Open(); SQLiteCommand sqc = new SQLiteCommand("SELECT * FROM character ORDER BY charx", conn); SQLiteDataReader sqr = sqc.ExecuteReader(); while (sqr.Read()) { Character c = new Character(); c.charx = sqr[1].ToString(); SQLiteCommand sqc2 = new SQLiteCommand("SELECT * FROM variant WHERE char_id = " + sqr[0].ToString(), conn); SQLiteDataReader sqr2 = sqc2.ExecuteReader(); while (sqr2.Read()) { Variant v = new Variant(); SQLiteCommand sqc3 = new SQLiteCommand("SELECT * FROM strokes WHERE vid = " + sqr2[0].ToString(), conn); SQLiteDataReader sqr3 = sqc3.ExecuteReader(); while (sqr3.Read()) { Stroke s = Int2Stroke(sqr3[3].ToString()); s.quadrant = sqr3[4].ToString(); v.Strokes.Add(s); } c.variants.Add(v); } chars.Add(c); } conn.Close(); }
public void removeCharacter(Character c) { chars.Remove(c); }