public static void loadConfig(CQEventArgs e) { String iniFile = e.CQApi.AppDirectory + "config.ini"; if (!File.Exists(iniFile)) { File.Create(iniFile).Close(); IniConfig iniConfig = new IniConfig(iniFile); iniConfig.Object["Master"] = new ISection("Master") { { "MasterQQ", 0 } }; iniConfig.Save(); e.CQLog.Info("工会战排刀器", "生成了config.ini,请更新其中的信息。"); } else { IniConfig iniConfig = new IniConfig(iniFile); try { iniConfig.Load(); iniConfig.Object["Master"].TryGetValue("MasterQQ", out IValue value); e.CQLog.Info("Debug", value.ToString()); ConfigHandler.master_qq = value.ToInt64(); e.CQLog.Info("工会战排刀器", "配置已加载,master是" + master_qq.ToString()); } catch { e.CQLog.Error("工会战排刀器", "读取config.ini时发生错误"); } } }
public static void up(CQEventArgs e) { String dbFile = e.CQApi.AppDirectory + "com.metricv.pcrguild.db"; String dbURI = @"URI=file:" + e.CQApi.AppDirectory + @"com.metricv.pcrguild.db;UseAffectedRows=True"; if (!File.Exists(dbFile)) { SQLiteConnection.CreateFile(dbFile); } conn = new SQLiteConnection(dbURI); conn.OpenAsync(); var sql_cmd = new SQLiteCommand(conn); sql_cmd.CommandText = create_schema_battlerec; sql_cmd.ExecuteNonQuery(); sql_cmd.CommandText = create_schema_admintable; sql_cmd.ExecuteNonQuery(); sql_cmd.CommandText = create_schema_groupmember; sql_cmd.ExecuteNonQuery(); sql_cmd.CommandText = create_schema_groupsettings; sql_cmd.ExecuteNonQuery(); }
public static void down(CQEventArgs e) { conn.Close(); }