public SQLConnectForm() { // // Required for Windows Form Designer support // InitializeComponent(); packetSize = "4096"; security = "SSPI"; persistSecurity = "False"; dataSource = ""; initialCatalog = "MOG"; MOG_Ini config = new MOG_Ini(MOG_Main.GetExecutablePath() + "\\MOG.ini"); if (config.KeyExist("SQL", "ConnectionString")) { string connectionString = config.GetString("SQL", "ConnectionString"); string [] tokens; tokens = connectionString.Split(";".ToCharArray()); foreach (string token in tokens) { string [] values = token.Split("=".ToCharArray()); if (values != null && values.Length >= 2) { switch (values[0].ToLower()) { case "data source": dataSource = values[1]; break; case "initial catalog": initialCatalog = values[1]; break; } } } } // packet size=4096;integrated security=SSPI;data source="NEMESIS";persist security info=False;initial catalog=mog SQLServerComboBox.Text = dataSource; SQLDatabaseComboBox.Text = initialCatalog; mConnectString = ""; }
static public bool MOGGlobalSQLLogin() { // Attempt to get our SQL connection string string mConnectionString = ""; MOG_Ini config = new MOG_Ini(MOG_Main.GetExecutablePath() + "\\MOG.ini"); SQLConnectForm sql = new SQLConnectForm(); if (sql.ShowDialog() == DialogResult.OK) { mConnectionString = sql.mConnectString; config.PutString("SQL", "ConnectionString", mConnectionString); config.Save(); config = null; return(MOG_ControllerSystem.InitializeDatabase(mConnectionString, "", "")); } return(false); }
public void SaveMOGConfiguration() { string configFilename = MOG_Main.FindInstalledConfigFile(); MOG_Ini ini = new MOG_Ini(); if (ini.Load(configFilename)) { // Save repository ini.PutString("MOG", "SystemRepositoryPath", mRepositoryPath); ini.PutString("MOG", "SystemConfiguration", mConfigFile); ini.Close(); // If we are the installed MOG, update the loaders ini too if (DosUtils.FileExistFast(MOG_Main.GetExecutablePath() + "\\..\\Loader.ini")) { MOG_Ini LoaderIni = new MOG_Ini(MOG_Main.GetExecutablePath() + "\\..\\Loader.ini"); LoaderIni.PutString("LOADER", "SystemRepositoryPath", mRepositoryPath); LoaderIni.Save(); } } }