private void DoParseFile(string filename) { if (!File.Exists(filename)) { MessageBox.Show("The file to parse doesn't exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { // Get the package specification lastReadPLSQLSpec = PLSQLSupportedSpec.ParseSpecFile(filename); // Check that the file could be parsed at all. if (lastReadPLSQLSpec == null) { MessageBox.Show("The selected file is not a valid PLSQL Package Specification File.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { // Save to config as last imported file if not overriden if (!string.IsNullOrEmpty(tbParseFileName.Text)) { Config.Backend.LastImportPackageSpec = filename; Config.Save(); } PopulateParsedFileProcedures(lastReadPLSQLSpec); } } }
private void PopulateParsedFileProcedures(PLSQLSpec plSqlSpec) { if (plSqlSpec != null) { lvFoundProcedures.Items.Clear(); // Set packagename tbPackageName.Text = plSqlSpec.PackageName; // Fetch the existing package if there is one. GetExistingPackage(plSqlSpec.PackageName); foreach (PLSQLProcedure procedure in plSqlSpec.Procedures.OrderBy(p => p.Name)) { ListViewItem item = null; if (NewProcedureItem(ref item, procedure, false)) { if (myStoredProcedure.Id != Guid.Empty) { if (myStoredProcedure.ProcedureName == procedure.Name) { lvFoundProcedures.Items.Add(item); item.Selected = true; item.EnsureVisible(); procedureMissingInFileAndNoValidSelectionMade = false; } else if (!((ImportStoredProcedureWrapperClass)item.Tag).IsImported) { lvFoundProcedures.Items.Add(item); } } else { if (!((ImportStoredProcedureWrapperClass)item.Tag).IsImported) { lvFoundProcedures.Items.Add(item); } } } } } EnableDisableButtons(); }