public void InitMainServerXmlDB() { try { DataRow dataRow_NewRecord = null; DataSet_ConnectingServiceDB.MainSettingsDataTable mainSettingsDataTable_obj = ConnectingServiceDB.MainSettings; ConnectingServiceDB.MainSettings.Clear(); dataRow_NewRecord = ConnectingServiceDB.MainSettings.NewRow(); dataRow_NewRecord.ItemArray.Initialize(); dataRow_NewRecord[mainSettingsDataTable_obj.IDColumn] = 0; dataRow_NewRecord[mainSettingsDataTable_obj.ServerPortColumn] = 5545; dataRow_NewRecord[mainSettingsDataTable_obj.AppVersionColumn] = "0.1.0"; dataRow_NewRecord[mainSettingsDataTable_obj.ShowToolTipsColumn] = true; dataRow_NewRecord[mainSettingsDataTable_obj.ShowAdvancedSettingsColumn] = false; dataRow_NewRecord[mainSettingsDataTable_obj.AutoRunColumn] = false; dataRow_NewRecord[mainSettingsDataTable_obj.StartServerAtRunColumn] = false; dataRow_NewRecord[mainSettingsDataTable_obj.MinimizeToNotifyAreaAtRunColumn] = false; dataRow_NewRecord[mainSettingsDataTable_obj.ShowIconInNotifyAreaColumn] = true; dataRow_NewRecord[mainSettingsDataTable_obj.MaxConnectionsColumn] = 255; dataRow_NewRecord[mainSettingsDataTable_obj.MaxConnectionPerAccountColumn] = 255; dataRow_NewRecord[mainSettingsDataTable_obj.PromptPasswordAfterUnHideColumn] = false; dataRow_NewRecord[mainSettingsDataTable_obj.IsClientAccessRestrictionRuleEnableColumn] = false; dataRow_NewRecord[mainSettingsDataTable_obj.IsServerAccessRestrictionRuleEnableColumn] = false; dataRow_NewRecord[mainSettingsDataTable_obj.CurrentAppLanguageColumn] = MainForm.CurrentLanguage; dataRow_NewRecord[mainSettingsDataTable_obj.ActivateHiddenModeAtStartUpColumn] = false; ConnectingServiceDB.MainSettings.Rows.Add(dataRow_NewRecord); } catch (Exception e) { if (File.Exists("ConnectingServiceDB")) { File.Delete("ConnectingServiceDB"); } MessageBox.Show(ServerStringFactory.GetString(127, MainForm.CurrentLanguage), ServerStringFactory.GetString(1, MainForm.CurrentLanguage)); return; } }
public void WriteServerSettingsData(string string_XMLFilePath) { try { DataRow dataRow_NewRecord = null; DataSet_ConnectingServiceDB.MainSettingsDataTable mainSettingsDataTable_obj = ConnectingServiceDB.MainSettings; dataRow_NewRecord = ConnectingServiceDB.MainSettings.Rows[0]; dataRow_NewRecord[mainSettingsDataTable_obj.ServerPortColumn] = CommonEnvironment.ServerPort; dataRow_NewRecord[mainSettingsDataTable_obj.AppVersionColumn] = CommonEnvironment.AppVersion; dataRow_NewRecord[mainSettingsDataTable_obj.ShowToolTipsColumn] = CommonEnvironment.ShowToolTips; dataRow_NewRecord[mainSettingsDataTable_obj.ShowAdvancedSettingsColumn] = CommonEnvironment.ShowAdvancedSettings; dataRow_NewRecord[mainSettingsDataTable_obj.AutoRunColumn] = CommonEnvironment.AutoRun; dataRow_NewRecord[mainSettingsDataTable_obj.StartServerAtRunColumn] = CommonEnvironment.StartServerAtRun; dataRow_NewRecord[mainSettingsDataTable_obj.MinimizeToNotifyAreaAtRunColumn] = CommonEnvironment.MinimizeToNotifyAreaAtRun; dataRow_NewRecord[mainSettingsDataTable_obj.ShowIconInNotifyAreaColumn] = CommonEnvironment.ShowIconInNotifyArea; dataRow_NewRecord[mainSettingsDataTable_obj.MaxConnectionsColumn] = CommonEnvironment.MaxConnections; dataRow_NewRecord[mainSettingsDataTable_obj.IsClientAccessRestrictionRuleEnableColumn] = CommonEnvironment.IsClientAccessRestrictionRuleEnable; dataRow_NewRecord[mainSettingsDataTable_obj.IsServerAccessRestrictionRuleEnableColumn] = CommonEnvironment.IsServerAccessRestrictionRuleEnable; dataRow_NewRecord[mainSettingsDataTable_obj.ActivateHiddenModeAtStartUpColumn] = CommonEnvironment.ActivateHiddenModeAtStartUp; dataRow_NewRecord[mainSettingsDataTable_obj.MaxConnectionPerAccountColumn] = CommonEnvironment.MaxConnectionsPerAccount; dataRow_NewRecord[mainSettingsDataTable_obj.CurrentAppLanguageColumn] = MainForm.CurrentLanguage; /////////////////////////////////////////////////////////////////////////////////////////////////////// DataSet_ConnectingServiceDB.SMTPSettingsDataTable smtpSettingsDataTable_obj = ConnectingServiceDB.SMTPSettings; if (smtpSettingsDataTable_obj.Rows.Count < 1) { InitSMTPSettingsXmlDB(); } dataRow_NewRecord = ConnectingServiceDB.SMTPSettings.Rows[0]; dataRow_NewRecord[smtpSettingsDataTable_obj.SMTP_ServerColumn] = CommonEnvironment.SMTPServer; dataRow_NewRecord[smtpSettingsDataTable_obj.SMTP_PortColumn] = CommonEnvironment.SMTPPort; dataRow_NewRecord[smtpSettingsDataTable_obj.SenderMailAddressColumn] = CommonEnvironment.SenderMailAddress; dataRow_NewRecord[smtpSettingsDataTable_obj.SMTP_LoginColumn] = CommonEnvironment.SMTPLogin; dataRow_NewRecord[smtpSettingsDataTable_obj.SMTP_PasswordColumn] = CommonEnvironment.SMTPPassword; /////////////////////////////////////////////////////////////////////////////////////////////////////// WriteXMLDataToFile(string_XMLFilePath); } catch (Exception) { if (File.Exists("ConnectingServiceDB")) { File.Delete("ConnectingServiceDB"); } MessageBox.Show(ServerStringFactory.GetString(481, MainForm.CurrentLanguage), ServerStringFactory.GetString(1, MainForm.CurrentLanguage)); return; } }
public void ApplyDBSettings() { if (ConnectingServiceDB.Tables["MainSettings"].Rows.Count < 1 || ConnectingServiceDB.Tables["SMTPSettings"].Rows.Count < 1) { InitMainServerXmlDB(); InitSMTPSettingsXmlDB(); ApplyDBSettings(); } if (ConnectingServiceDB.Tables["MainSettings"].Rows.Count < 1 || ConnectingServiceDB.Tables["SMTPSettings"].Rows.Count < 1) { return; } /////////////////////////////////////////////////////////////////////////////////////////////////////// DataSet_ConnectingServiceDB.MainSettingsDataTable mainSettingsDataTable_obj = ConnectingServiceDB.MainSettings; CommonEnvironment.ServerPort = (int)mainSettingsDataTable_obj.Rows[0][mainSettingsDataTable_obj.ServerPortColumn]; CommonEnvironment.AppVersion = (string)mainSettingsDataTable_obj.Rows[0][mainSettingsDataTable_obj.AppVersionColumn]; CommonEnvironment.ShowToolTips = (bool)mainSettingsDataTable_obj.Rows[0][mainSettingsDataTable_obj.ShowToolTipsColumn]; CommonEnvironment.ShowAdvancedSettings = (bool)mainSettingsDataTable_obj.Rows[0][mainSettingsDataTable_obj.ShowAdvancedSettingsColumn]; CommonEnvironment.AutoRun = (bool)mainSettingsDataTable_obj.Rows[0][mainSettingsDataTable_obj.AutoRunColumn]; CommonEnvironment.StartServerAtRun = (bool)mainSettingsDataTable_obj.Rows[0][mainSettingsDataTable_obj.StartServerAtRunColumn]; CommonEnvironment.MinimizeToNotifyAreaAtRun = (bool)mainSettingsDataTable_obj.Rows[0][mainSettingsDataTable_obj.MinimizeToNotifyAreaAtRunColumn]; CommonEnvironment.ShowIconInNotifyArea = (bool)mainSettingsDataTable_obj.Rows[0][mainSettingsDataTable_obj.ShowIconInNotifyAreaColumn]; CommonEnvironment.MaxConnections = (int)mainSettingsDataTable_obj.Rows[0][mainSettingsDataTable_obj.MaxConnectionsColumn]; CommonEnvironment.MaxConnectionsPerAccount = (int)mainSettingsDataTable_obj.Rows[0][mainSettingsDataTable_obj.MaxConnectionPerAccountColumn]; CommonEnvironment.IsServerAccessRestrictionRuleEnable = (bool)mainSettingsDataTable_obj.Rows[0][mainSettingsDataTable_obj.IsServerAccessRestrictionRuleEnableColumn]; CommonEnvironment.IsClientAccessRestrictionRuleEnable = (bool)mainSettingsDataTable_obj.Rows[0][mainSettingsDataTable_obj.IsClientAccessRestrictionRuleEnableColumn]; CommonEnvironment.ActivateHiddenModeAtStartUp = (bool)mainSettingsDataTable_obj.Rows[0][mainSettingsDataTable_obj.ActivateHiddenModeAtStartUpColumn]; MainForm.CurrentLanguage = (int)mainSettingsDataTable_obj.Rows[0][mainSettingsDataTable_obj.CurrentAppLanguageColumn]; /////////////////////////////////////////////////////////////////////////////////////////////////////// DataSet_ConnectingServiceDB.SMTPSettingsDataTable smtpSettingsDataTable_obj = ConnectingServiceDB.SMTPSettings; if (smtpSettingsDataTable_obj.Rows.Count < 1) { InitSMTPSettingsXmlDB(); } CommonEnvironment.SMTPLogin = (string)smtpSettingsDataTable_obj.Rows[0][smtpSettingsDataTable_obj.SMTP_LoginColumn]; CommonEnvironment.SMTPPassword = (string)smtpSettingsDataTable_obj.Rows[0][smtpSettingsDataTable_obj.SMTP_PasswordColumn]; CommonEnvironment.SMTPServer = (string)smtpSettingsDataTable_obj.Rows[0][smtpSettingsDataTable_obj.SMTP_ServerColumn]; CommonEnvironment.SenderMailAddress = (string)smtpSettingsDataTable_obj.Rows[0][smtpSettingsDataTable_obj.SenderMailAddressColumn]; CommonEnvironment.SMTPPort = (int)smtpSettingsDataTable_obj.Rows[0][smtpSettingsDataTable_obj.SMTP_PortColumn]; }