public MysqlDatabase(DatabaseConfig config) { Connected = false; Connection = null; DatabaseLock = new ReaderWriterLockSlim(); Connect(config); }
public GitConfig() { Enabled = true; Host = string.Empty; AccessToken = string.Empty; SourceId = 1; Database = new DatabaseConfig(); }
public void SetDefaults() { DevEnvironment = false; Migrate = false; UseCdn = false; Title = string.Empty; Description = string.Empty; Author = string.Empty; Host = string.Empty; SupportEmail = string.Empty; NoReplyEmail = string.Empty; BitcoinAddress = string.Empty; Salt1 = string.Empty; Salt2 = string.Empty; CdnHost = string.Empty; UserConfig = new UserConfig(); EmailConfig = new EmailConfig(); ContactConfig = new ContactConfig(); GitConfig = new GitConfig(); BlogConfig = new BlogConfig(); UploadConfig = new UploadConfig(); PasteConfig = new PasteConfig(); ApiConfig = new ApiConfig(); PodcastConfig = new PodcastConfig(); StreamConfig = new StreamConfig(); ShortenerConfig = new ShortenerConfig(); TransparencyConfig = new TransparencyConfig(); DatabaseConfig = new DatabaseConfig(); PiwikConfig = new PiwikConfig(); }
private void Connect(DatabaseConfig config) { if (Connection == null) { if (config.Server != string.Empty && config.Database != string.Empty && config.Username != string.Empty && config.Password != string.Empty) { string strCon = string.Format("Server={0}; database={1}; user={2}; password={3}; port={4}; charset=utf8; Allow Zero Datetime=true;", config.Server, config.Database, config.Username, config.Password, config.Port); Connection = new MySqlConnection(strCon); try { Connection.Open(); Connected = true; } catch (MySqlException ex) { Connected = false; } } } }