internal static int GetObjInstanceList(ObjInstanceElementsCollector ObjInst_, string strElementName, EA.Element eaElement, XElement Xel) { if (eaElement.Type == "Object") { bool bFound = false; if (ObjInst_.GetUseObjClassNameForLookup()) { if (eaElement.Name.StartsWith(ObjInst_.GetUMLObjClassName())) { bFound = true; } } else { bFound = true; } if (ObjInst_.GetBaseType() != 0) { if (eaElement.ClassifierID == ObjInst_.GetBaseType()) { bFound = true; } else { bFound = false; } } if (bFound) { Hashtable hTaggedValues = EAExporter.ParseRunStateString(eaElement.RunState); if (strElementName != null) { XElement XParent = new XElement(strElementName); int iErr = ObjInst_.GetElements(hTaggedValues, XParent, eaElement); Xel.Add(XParent); } else { int iErr = ObjInst_.GetElements(hTaggedValues, Xel, eaElement); } } } return(0); }
public int GetElements(Hashtable hTaggedValues, XElement Xel, EA.Element eaEl) { foreach (Object objFldInfo in m_OrderedFieldList) { FieldInfo fldInfo = (FieldInfo)objFldInfo; string objElName = fldInfo.m_strFldName; string strValue = ""; if ((string)objElName == m_FieldNameFromObjName) { strValue = eaEl.Name; } else if ((string)objElName == m_FieldNameFromNotes) { strValue = eaEl.Notes; } else if (fldInfo.m_bIsArray) { // find all array elements int iCnt = 0; foreach (DictionaryEntry deFieldIndo in hTaggedValues) { string strName = deFieldIndo.Key.ToString(); if (strName.StartsWith(objElName)) { iCnt++; } } if (iCnt == 1) { if ((string)hTaggedValues[(string)objElName] != null) { strValue = (string)hTaggedValues[(string)objElName]; } while (strValue.Contains("\r\n")) { strValue = strValue.Replace("\r\n", " "); } if (m_stripPrefix) { strValue = strValue.Replace(GetUMLObjClassName() + "_", ""); } if (strValue != "") { // check for embedded image int iRes = EAExporter.CheckForAndReplaceLinks(ref strValue); Xel.Add(new XElement((string)objElName, strValue)); } } else { for (int i = 0; i < iCnt; i++) { strValue = (string)hTaggedValues[(string)objElName + "[" + i.ToString("0") + "]"]; // replace new paragrpahs while (strValue.Contains("\r\n")) { strValue = strValue.Replace("\r\n", " "); } if (m_stripPrefix) { strValue = strValue.Replace(GetUMLObjClassName() + "_", ""); } if (strValue != "") { // check for embedded image int iRes = EAExporter.CheckForAndReplaceLinks(ref strValue); Xel.Add(new XElement((string)objElName, strValue)); } } } } else { if ((string)hTaggedValues[(string)objElName] != null) { strValue = (string)hTaggedValues[(string)objElName]; } } if (!fldInfo.m_bIsArray) { // replace new paragrpahs while (strValue.Contains("\r\n")) { strValue = strValue.Replace("\r\n", " "); } if (m_stripPrefix) { strValue = strValue.Replace(GetUMLObjClassName() + "_", ""); } if (strValue != "") { // check for embedded image int iRes = EAExporter.CheckForAndReplaceLinks(ref strValue); Xel.Add(new XElement((string)objElName, strValue)); } } } return(0); }