public bool savePersistantConfig()
{
if (this.persistant != null) {
this.persistant["effects"] = JsonConvert.SerializeObject(this.effects);
this.persistant["filters"] = Convert.ToString(this.browser.Document.InvokeScript("getJsonFilters"));
if (this.screensaver.action != Screensaver.Actions.Config) {
for (int i = 0; i < this.screensaver.monitors.Length; i++) {
this.persistant["historyM" + Convert.ToString(i)] = JsonConvert.SerializeObject(this.screensaver.monitors[i].historyLastEntries(Convert.ToInt32(this.getPersistant("rememberLast"))));
this.persistant["historyOffsetM" + Convert.ToString(i)] = Convert.ToString(this.screensaver.monitors[i].offset);
}
}
this.connectToDB();
SQLiteTransaction transaction = null;
try {
transaction = this.dbConnector.connection.BeginTransaction(true);
} catch (System.Data.SQLite.SQLiteException se) {
this.screensaver.showInfoOnMonitors("Error: " + se.Message, true);
return false;
}
foreach (var p in this.persistant) {
SQLiteCommand insertSQL = new SQLiteCommand("INSERT OR REPLACE INTO Setting (key, value) VALUES (@key, @value);", this.dbConnector.connection);
insertSQL.Parameters.AddWithValue("@key", p.Key);
insertSQL.Parameters.AddWithValue("@value", p.Value);
insertSQL.ExecuteNonQuery();
}
transaction.Commit();
}
return true;
}