/// <summary> /// Database를 모두 저장합니다. /// </summary> public void saveAll(Profile prof) { con.Open(); if (!(prof.Name == null || prof.Id == null || prof.Pwd == null)) { string cmds = "select * from profile"; bool flag = true; SQLiteCommand cmd = new SQLiteCommand(cmds, con); SQLiteDataReader read = cmd.ExecuteReader(); while (read.Read()) { exeCommandWithoutOpen("update profile set name=\'" + prof.Name + "\', id=\'" + Secure.AES256Encrypt(prof.Id) + "\', password=\'" + Secure.AES256Encrypt(prof.Pwd) + "\' where key=" + read["key"]); exeCommandWithoutOpen("update browser set usr_agent=\'" + WebControl.usr_agent + "\', fake_plugin=" + WebControl.fake_plugin + ", use_window=" + WebControl.use_win + ", gpu_acc=" + WebControl.gpu_acc + ", lang=\'" + WebControl.lang + "\' where key=" + read["key"]); flag = false; } read.Close(); if (flag) { exeCommandWithoutOpen("insert into profile (name, id, password) values (\'" + prof.Name + "\', \'" + Secure.AES256Encrypt(prof.Id) + "\', \'" + Secure.AES256Encrypt(prof.Pwd) + "\')"); exeCommandWithoutOpen("update browser set usr_agent=\'" + WebControl.usr_agent + "\', fake_plugin=" + WebControl.fake_plugin + ", use_window=" + WebControl.use_win + ", gpu_acc=" + WebControl.gpu_acc + ", lang=\'" + WebControl.lang + "\' where key=1"); } } con.Close(); Setting.save(); }
/// <summary> /// Database를 모두 로딩해서 적용합니다. /// </summary> public void loadAll() { Secure.Nop = 0; con.Open(); string cmds = "select * from profile"; SQLiteCommand cmd = new SQLiteCommand(cmds, con); SQLiteDataReader dat = cmd.ExecuteReader(); while (dat.Read()) { Secure.setProfile(dat["name"].ToString(), Secure.AES256Decrypt(dat["id"].ToString()), Secure.AES256Decrypt(dat["password"].ToString())); } Setting.load(); dat.Close(); cmds = "select * from browser"; cmd = new SQLiteCommand(cmds, con); SQLiteDataReader dat2 = cmd.ExecuteReader(); while (dat2.Read()) { WebControl.usr_agent = dat2["usr_agent"].ToString(); WebControl.fake_plugin = (bool)dat2["fake_plugin"]; WebControl.gpu_acc = (bool)dat2["gpu_acc"]; WebControl.lang = dat2["lang"].ToString(); WebControl.use_win = (bool)dat2["use_window"]; } dat2.Close(); con.Close(); }