private void BtSetFolder_Click(object sender, EventArgs e) { using (var fbd = new FolderBrowserDialog()) { fbd.SelectedPath = IniUtils.GetConfig("Directories", "FixpackDir"); DialogResult result; try { result = fbd.ShowDialog(); } catch (Exception exc) { fbd.SelectedPath = ""; result = fbd.ShowDialog(); } if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath)) { IniUtils.SetConfig("Directories", "FixpackDir", fbd.SelectedPath); folder = fbd.SelectedPath; LbSetFolder.Text = "Папка: " + fbd.SelectedPath; (new ToolTip()).SetToolTip(LbSetFolder, LbSetFolder.Text); subfolders = Directory.GetDirectories(folder); MessageBox.Show("Найдено: " + subfolders.Length.ToString() + " патчей", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); BtCreateFileScFromSc.Enabled = true; BtCreateFileScFromFiles.Enabled = true; BtRNCheck.Enabled = true; BtCheckFp.Enabled = true; } } }
private void TsChangeVSSDatabase_Click(object sender, EventArgs e) { SetAttrDialog sad = new SetAttrDialog("База VSS"); sad.ShowDialog(); if (sad.Set) { IniUtils.SetConfig("Credentials", "Base", sad.Attr); } Connect(); }
private void TsSetCVSType_Click(object sender, EventArgs e) { SetAttrDialog sad = new SetAttrDialog("Тип системы контроля версий"); sad.Attr = "VSS"; sad.ShowDialog(); if (sad.Set) { IniUtils.SetConfig("CVS", "CVSType", sad.Attr); Connect(); } }
private void TsChangeLoggingBase_Click(object sender, EventArgs e) { SetAttrDialog sad = new SetAttrDialog("TNS для базы, где ведется логирование"); sad.Attr = Properties.Settings.Default.OraTNS; sad.ShowDialog(); if (sad.Set) { IniUtils.SetConfig("Credentials", "CustomTNS", sad.Attr); Connect(); } }
private void DownloadVSSDestFolder() { using (FolderBrowserDialog fbd = new FolderBrowserDialog()) { if (fbd.ShowDialog() == DialogResult.OK) { IniUtils.SetConfig("Directories", "WorkingFolder", fbd.SelectedPath); string localFolder = fbd.SelectedPath + "\\" + new DirectoryInfo(TbDestFolder.Text).Name; Directory.CreateDirectory(localFolder); DownloadVSSDestFolder(localFolder); } } }
private void TsLoadOrder_Click(object sender, EventArgs e) { Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); string folder; using (var ofd = new OpenFileDialog()) { ofd.DefaultExt = "xls"; ofd.Filter = "Файл Excel(*.XLS;*.XLSX)|*.XLS;*.XLSX|Все файлы (*.*)|*.*"; ofd.InitialDirectory = IniUtils.GetConfig("Directories", "ExcelDir"); DialogResult result; try { result = ofd.ShowDialog(); } catch (Exception exc) { ofd.InitialDirectory = ""; result = ofd.ShowDialog(); } if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(ofd.FileName)) { TbFolders.Text = ""; IniUtils.SetConfig("Directories", "ExcelDir", Path.GetDirectoryName(ofd.FileName)); folder = ofd.FileName; Microsoft.Office.Interop.Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(folder); Microsoft.Office.Interop.Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1]; Microsoft.Office.Interop.Excel.Range xlRange = xlWorksheet.UsedRange; int rowCount = xlRange.Rows.Count; int colCount = xlRange.Columns.Count; int patchColumn = 2; int firstPatchRow = 2; for (int i = firstPatchRow; i <= rowCount; i++) { //write the value to the console if (xlRange.Cells[i, patchColumn] != null && xlRange.Cells[i, patchColumn].Value2 != null) { TbFolders.Text += xlRange.Cells[i, patchColumn].Value2.ToString() + Environment.NewLine; } } ExcelCleanup(xlRange, xlWorksheet, xlWorkbook, xlApp); } } }
private void BtMove_Click(object sender, EventArgs e) { IniUtils.SetConfig("Folders", "Source", TbSourceFolder.Text); IniUtils.SetConfig("Folders", "Dest", TbDestFolder.Text); string[] folders = TbFolders.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); threadsAmount = folders.Length; threadsSucceded = 0; try { cvs.Move(TbSourceFolder.Text, TbDestFolder.Text, folders); } catch (Exception exc) { MessageBox.Show(exc.Message); } }