public ConfigManager() { try { using (MySqlConnection mySqlConnection = SQLjec.getInstance().conn()) { MySqlCommand mySqlCommand = mySqlConnection.CreateCommand(); mySqlConnection.Open(); mySqlCommand.CommandText = "SELECT * FROM configs"; mySqlCommand.CommandType = CommandType.Text; MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader(); while (mySqlDataReader.Read()) { ConfigP item = new ConfigP { ownerid = mySqlDataReader.GetInt32("owner_id"), ownername = mySqlDataReader.GetString("owner_name"), config = mySqlDataReader.GetInt32("config"), mira = mySqlDataReader.GetInt32("mira"), mao = mySqlDataReader.GetInt32("mao"), sangue = mySqlDataReader.GetInt32("sangue"), audio1 = mySqlDataReader.GetInt32("audio1"), audio2 = mySqlDataReader.GetInt32("audio2"), sensibilidade = mySqlDataReader.GetInt32("sensibilidade"), visao = mySqlDataReader.GetInt32("visao"), audio_enable = mySqlDataReader.GetInt32("audio_enable") }; this._accounts.Add(item); this.id++; } CLogger.getInstance().extra_info("[Config] Loaded: " + this._accounts.Count + " configs."); } } catch (Exception ex) { this.dbstatus = -100; CLogger.getInstance().error("[Config] database not found"); CLogger.getInstance().error("[Config] " + ex.ToString()); } }
public ConfigManager() { try { using (MySqlConnection mySqlConnection = SQLjec.getInstance().conn()) { MySqlCommand command = mySqlConnection.CreateCommand(); mySqlConnection.Open(); command.CommandText = "SELECT * FROM configs"; command.CommandType = CommandType.Text; MySqlDataReader mySqlDataReader = command.ExecuteReader(); while (mySqlDataReader.Read()) { ConfigP account = new ConfigP(); account.ownerid = mySqlDataReader.GetInt32("owner_id"); account.ownername = mySqlDataReader.GetString("owner_name"); account.mira = mySqlDataReader.GetInt32("mira"); account.mao = mySqlDataReader.GetInt32("mao"); account.sangue = mySqlDataReader.GetInt32("sangue"); account.audio1 = mySqlDataReader.GetInt32("audio1"); account.audio2 = mySqlDataReader.GetInt32("audio2"); account.sensibilidade = mySqlDataReader.GetInt32("sensibilidade"); account.visao = mySqlDataReader.GetInt32("visao"); account.audio_enable = mySqlDataReader.GetInt32("audio_enable"); this._accounts.Add(account); ++this.id; } CLogger.getInstance().extra_info("|[CFM]| Foram encontradas " + this._accounts.Count + " configurações."); } } catch (Exception ex) { this.dbstatus = -100; CLogger.getInstance().error("|[CFM]| Nenhuma configuração foi encontrada."); CLogger.getInstance().error("|[CFM]| " + ((object)ex).ToString()); } }
public void setPlayerId(int id) { this.player_id = id; this._inventory = new DaoManager(this._connection).getInventory(this.player_id); this._team = -1; this._mission = new Mission[3]; bool flag = TitleManager.getInstance().getTitle(id) == null; if (flag) { TitleManager.getInstance().AddTitleDb(id); Title acc = new Title { owner_id = id }; TitleManager.getInstance().AddTitle(acc); this.title = TitleManager.getInstance().getTitle(id); } else { this.title = TitleManager.getInstance().getTitle(id); } bool flag2 = ConfigManager.getInstance().getInfoItem(id) == null; if (flag2) { ConfigP configP = new ConfigP(); configP.setOwnerId(id); configP.setOwnerName(this.player_name); configP.setMira(1); configP.setSensibilidade(50); configP.setSangue(1); configP.setVisao(70); configP.setAudio1(100); configP.setAudio2(100); configP.config = 55; ConfigManager.getInstance().AddConfig(configP); ConfigManager.getInstance().AddConfigDb(id, 100, 100, 50, 70, 1, 0, this.player_name, 0, 7, 55); this._config = ConfigManager.getInstance().getInfoItem(id); this.audio1 = this.getConfig().getAudio1(); this.audio2 = this.getConfig().getAudio2(); this.sensibilidade = this.getConfig().getSensibilidade(); this.visao = this.getConfig().getVisao(); this.mira = this.getConfig().getMira(); this.mao = this.getConfig().getMao(); this.sangue = this.getConfig().getSangue(); this.audio_enable = this.getConfig().getAudioEnable(); this.config = this.getConfig().config; } else { this._config = ConfigManager.getInstance().getInfoItem(id); this.audio1 = this.getConfig().getAudio1(); this.audio2 = this.getConfig().getAudio2(); this.sensibilidade = this.getConfig().getSensibilidade(); this.visao = this.getConfig().getVisao(); this.mira = this.getConfig().getMira(); this.mao = this.getConfig().getMao(); this.sangue = this.getConfig().getSangue(); this.audio_enable = this.getConfig().getAudioEnable(); this.config = this.getConfig().config; } }
public void AddConfig(ConfigP acc) { this._accounts.Add(acc); }