public ETSClassConfiguration GetMethod(string methodName) { ETSClassConfiguration methodClass = etsClassConfigurations[0]; foreach (ETSClassConfiguration configuration in etsClassConfigurations) { if (configuration.ClassName == methodName) { methodClass = configuration; break; } } return(methodClass); }
/* Main Workhorse loop * * */ public static void LoadDictionary(ETSClassConfiguration classConfiguration, string classMappingName) { string interimClassName = ""; //Used for adjusting the tab name when necessary. See special cases comment for config file interimClassName = classMappingName; if (Program.m_ExExcelFile) { workbook = excel_app.Workbooks.Open( excelFilename, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); if (!FSheet) //Actually start on the very first worksheet that is created by default when workbook is created { sheet = (Excel.Worksheet)workbook.Sheets.Add( Type.Missing, workbook.Sheets[workbook.Sheets.Count], 1, Excel.XlSheetType.xlWorksheet); } else { sheet = excelFirstSheet; FSheet = false; } } /* Two special cases * The worksheet needed to have the AEP_ stipped off * This was the quick way to do it * * */ if (classMappingName.Equals("AEP_CBType")) { interimClassName = "CBType"; } if (classMappingName.Equals("AEP_LoadType")) { interimClassName = "LoadType"; } /* Special case * May need to be removed at some point * * */ if (classMappingName.Equals("ConformLoad")) { interimClassName = "EquipmentLoad"; } if (Program.m_ExExcelFile) { sheet.Name = interimClassName; } if (Program.m_ExTextFile) { EOF.WriteLine("Class Mapping Name: " + interimClassName); //Flag the Class } /* Peel them out of the object we were passed * * */ foreach (Extension extension in classConfiguration.Extensions) { if (className.Equals(classMappingName)) //Determine when we've changed classes aka tabs in the worksheet { classNameChange = false; } else { classNameChange = true; className = classMappingName; } /* This just filters per tab/class, not for the entire config file * * */ try { defAndDetails.Add(extension.Definition, extension.Details); //Filter out duplicates } catch (ArgumentException) { Utils.WriteTimeToConsoleAndLog("Duplicate Extension Found: " + extension.Definition); } Utils.WriteTimeToConsoleAndLog(""); Utils.WriteTimeToConsoleAndLog("Class Mapping Name: " + interimClassName); //Strip out any multiple spaces from the attribute string cString = CollapseSpaces.CSpaces(extension.Definition); string[] elemnt = cString.Split(' '); if (elemnt.Length.Equals(1)) { dataType = "association"; // If the attribute doesn't have a dataType assume an association } else { dataType = elemnt[1]; } if (Program.m_ExExcelFile) { sheet.Rows[row].Cells[col].Value = elemnt[0].ToString(); } if (dataType.Equals("association")) //Just some adjusting to alter how both extension output files display the association entries { if (extension.Details.Length < 13) { if (Program.m_ExTextFile) { EOF.Write(" " + elemnt[0] + " dataType: " + dataType); } if (Program.m_ExExcelFile) { sheet.Rows[row].Cells[col + 1].Value = dataType.ToString(); } } else { if (Program.m_ExTextFile) { EOF.Write(" " + elemnt[0] + " "); } } } else { if (Program.m_ExTextFile) { EOF.Write(" " + elemnt[0] + " dataType: " + dataType); } if (Program.m_ExExcelFile) { sheet.Rows[row].Cells[col + 1].Value = dataType.ToString(); } } if (Program.m_ExExcelFile) { sheet.Rows[row].Cells[col + 2].Value = extension.Details.ToString(); } /*Toss the current object and info to the SQL output file builder * * */ if (Program.m_CsqlFile) { SQLOutput.BuildOutTable(elemnt[0].ToString(), dataType.ToString(), extension.Details.ToString(), classNameChange, classMappingName); } if (Program.m_ExExcelFile) { row++; } if (Program.m_ExTextFile) { //Strip off the leading '&' if present if (extension.Details.Contains("&")) { holder = extension.Details.ToString().Split('&').Last().Trim(); } else { holder = extension.Details.ToString(); } EOF.WriteLine(" " + holder); //Spit out as-is for right now EOF.WriteLine(); //Line spacer } Utils.WriteTimeToConsoleAndLog(" Extension: " + extension.Definition); Utils.WriteTimeToConsoleAndLog(" Details: " + extension.Details); } if (Program.m_ExTextFile) { EOF.WriteLine("\n\n"); //Spacer lines } if (Program.m_ExExcelFile) { row = 1; //reset for the next tab in the output workbook } }