private void btnConnectIniPath_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Connect file (*.ini) | *.ini"; openFileDialog.InitialDirectory = @"C:\"; openFileDialog.Title = @"Выберите путь к файлу connect.ini"; if (openFileDialog.ShowDialog() == DialogResult.OK) { tbConnectIniPath.Text = openFileDialog.FileName; IniParser parser = new IniParser(tbConnectIniPath.Text); String[] connectParameters = parser.EnumSection("CONNECT"); cbConnectSectionName.Items.Clear(); cbConnectSectionName.Items.AddRange(connectParameters); cbConnectSectionName.SelectedIndex = 0; } Repository.Flush(); }
private Repository() { try { currentState = null; //посмотреть, есть ли это свойство, есть ли файлик if (string.IsNullOrEmpty(Furniture.Helpers.LocalAccounts.connectIniPath)) { currentState = "Не указан путь к файлу connect.ini"; return; } if (!File.Exists(Furniture.Helpers.LocalAccounts.connectIniPath)) { currentState = string.Format("Файл connect.ini по пути {0} не существует!", Furniture.Helpers.LocalAccounts.connectIniPath); return; } if (string.IsNullOrEmpty(Properties.Settings.Default.OraDbLogin)) { currentState = "Не указан логин для связи с БД"; return; } if (string.IsNullOrEmpty(Properties.Settings.Default.OraDbPassword)) { currentState = "Не указан пароль для связи с БД"; return; } //распарсить файлик IniParser parser = new IniParser(Furniture.Helpers.LocalAccounts.connectIniPath); string test76 = parser.GetSetting("CONNECT", Properties.Settings.Default.ConnectParameterName); if (string.IsNullOrEmpty(test76)) { currentState = "В ini файле нет строки CONNECT: " + Properties.Settings.Default.ConnectParameterName; return; } string[] arr = test76.Split(':'); ConnectionString = string.Format("Data Source=(DESCRIPTION=" + "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1})))" + "(CONNECT_DATA=(sid={2})));" + "User Id={3};Password={4};", arr[0], arr[1], arr[2], Properties.Settings.Default.OraDbLogin, Properties.Settings.Default.OraDbPassword); } catch (Exception e) { Logging.Log.Instance.Debug(e.Message); } }
private void FrmOptionsLoad(object sender, EventArgs e) { label1.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString(); CreateTextForLabelTest(); if (Furniture.Helpers.SaveLoadSettings.ReadAppSettings("DBPath") == string.Empty) { txtDBPath.Text = Properties.Settings.Default.DBPath; Furniture.Helpers.SaveLoadSettings.AddOrUpdateAppSettings("DBPath", Properties.Settings.Default.DBPath); } else txtDBPath.Text = Furniture.Helpers.SaveLoadSettings.ReadAppSettings("DBPath"); if (Furniture.Helpers.SaveLoadSettings.ReadAppSettings("DrwPath") == string.Empty) { txtDrwPath.Text = Properties.Settings.Default.DrwPath; Furniture.Helpers.SaveLoadSettings.AddOrUpdateAppSettings("DrwPath", Properties.Settings.Default.DrwPath); } else txtDrwPath.Text = Furniture.Helpers.SaveLoadSettings.ReadAppSettings("DrwPath"); if (Furniture.Helpers.SaveLoadSettings.ReadAppSettings("ModelPath") == string.Empty) { txtModelPath.Text = Properties.Settings.Default.ModelPath; Furniture.Helpers.SaveLoadSettings.AddOrUpdateAppSettings("ModelPath", Properties.Settings.Default.ModelPath); } else txtModelPath.Text = Furniture.Helpers.SaveLoadSettings.ReadAppSettings("ModelPath"); if (Furniture.Helpers.SaveLoadSettings.ReadAppSettings("DecorPath") == string.Empty) { txtDecorPath.Text = Properties.Settings.Default.DecorPath; Furniture.Helpers.SaveLoadSettings.AddOrUpdateAppSettings("DecorPath", Properties.Settings.Default.DecorPath); } else txtDecorPath.Text = Furniture.Helpers.SaveLoadSettings.ReadAppSettings("DecorPath"); txtDesigner.Text = Properties.Settings.Default.Designer; //lblFtpPath.Text += @" " + Properties.Settings.Default.FtpPath; lblFtpPath.Text += @" " + ftpResult; lblPatchVersion.Text += @" " + Properties.Settings.Default.PatchVersion; chkAutoSaveComponents.Checked = Properties.Settings.Default.AutoSaveComponents; chkAutoSaveDrawings.Checked = Properties.Settings.Default.AutoSaveDrawings; chkAutoShowSetParameters.Checked = Properties.Settings.Default.AutoShowSetParameters; chkAutoCutOff.Checked = Properties.Settings.Default.AutoCutOff; chBxCvtCrss.Checked = Properties.Settings.Default.CheckCavitiesCross; chBxPrmLmts.Checked = Properties.Settings.Default.CheckParamLimits; chckBxUpdateLib.Checked = Properties.Settings.Default.CheckUpdateLib; btnIpdateLib.Enabled = Properties.Settings.Default.CheckUpdateLib; chckBxConvertDwgPdf.Checked = Properties.Settings.Default.ConvertToDwgPdf; if (Properties.Settings.Default.CashModeOn) { Properties.Settings.Default.ImmediatelyDetachModel = false; chckBxDetachModel.Checked = Properties.Settings.Default.ImmediatelyDetachModel; chckBxDetachModel.Enabled = false; } else { chckBxDetachModel.Checked = Properties.Settings.Default.ImmediatelyDetachModel; chckBxDetachModel.Enabled = true; } chckDefaultRPDView.Checked = Properties.Settings.Default.DefaultRPDView; chckBxReloadComps.Checked = Properties.Settings.Default.ReloadComponents; chckBxAutoScale.Checked = Properties.Settings.Default.ScaleWhenDimen; deleteBeforeDim.Checked = Properties.Settings.Default.DeleteBeforeDim; chbViewBeforeDim.Checked = Properties.Settings.Default.ViewsBeforeDimen; chbDeleteDrawIfStandart.Checked = Properties.Settings.Default.DeleteDraftIfStandart; chkAutoRecalculateOnAdd.Checked = Properties.Settings.Default.AutoRecalculateOnAdd; chkColorNotUniq.Checked = Properties.Settings.Default.SetDecorsFromFirstElement; chkShowRPDBeforeEnd.Checked = Properties.Settings.Default.ShowRPDBefore; chckBxAutoArrangeDimension.Checked = Properties.Settings.Default.AutoArrangeDimension; chckSetParent.Checked = Properties.Settings.Default.SetParentWindow; chckBxCreatePacketHoles.CheckedChanged -= PacketHolesCheckedChanged; chckBxCreatePacketHoles.Checked = Properties.Settings.Default.CreatePacketHoles; chckBxCreatePacketHoles.CheckedChanged += PacketHolesCheckedChanged; if (Furniture.Helpers.SaveLoadSettings.ReadAppSettings("ConnectIniPath") == string.Empty) { tbConnectIniPath.Text = Properties.Settings.Default.ConnectIniPath; //Furniture.Helpers.SaveLoadSettings.AddOrUpdateAppSettings("ConnectIniPath", Properties.Settings.Default.ConnectIniPath); } else tbConnectIniPath.Text = Furniture.Helpers.SaveLoadSettings.ReadAppSettings("ConnectIniPath"); if (!String.IsNullOrEmpty(Furniture.Helpers.LocalAccounts.connectIniPath) && File.Exists(Furniture.Helpers.LocalAccounts.connectIniPath)) { IniParser parser = new IniParser(Furniture.Helpers.LocalAccounts.connectIniPath); String[] connectParameters = parser.EnumSection("CONNECT"); cbConnectSectionName.Items.Clear(); cbConnectSectionName.Items.AddRange(connectParameters); cbConnectSectionName.SelectedItem = Properties.Settings.Default.ConnectParameterName; } tbOraDbLogin.Text = Properties.Settings.Default.OraDbLogin; tbOraDbPassword.Text = Properties.Settings.Default.OraDbPassword; ChkAutoSaveComponentsCheckedChanged(chkAutoSaveComponents, null); }