void GetParamNames(Element elem, out List <string> parameterNames) { ParameterMap parameterMap = elem.ParametersMap; ParameterMapIterator itr = parameterMap.ForwardIterator(); parameterNames = new List <string>(); while (itr.MoveNext()) { parameterNames.Add(itr.Key); } parameterNames.Sort(); }
Parameter GetParameterFromParameterMap( Element elem, string paramName) { ParameterMap parameterMap = elem.ParametersMap; ParameterMapIterator itr = parameterMap.ForwardIterator(); while (itr.MoveNext()) { if (paramName == itr.Key) { return(parameterMap.get_Item(paramName)); } } return(null); }
void ConvertParameterMapToDictionary( Element elem, out SortedDictionary <string, Parameter> outDictionary) { ParameterMap parameterMap = elem.ParametersMap; ParameterMapIterator itr = parameterMap.ForwardIterator(); outDictionary = new SortedDictionary <string, Parameter>(); while (itr.MoveNext()) { string paramName = itr.Key; Parameter parameter = parameterMap.get_Item(paramName); outDictionary.Add(paramName, parameter); } }
void GetSortedParamsValues( Element elem, out SortedList <string, string> paramsValues) { ParameterMap parameterMap = elem.ParametersMap; ParameterMapIterator itr = parameterMap.ForwardIterator(); paramsValues = new SortedList <string, string>(); while (itr.MoveNext()) { string paramName = itr.Key; Parameter parameter = parameterMap.get_Item(paramName); paramsValues.Add(paramName, GetParamValueAsStr(parameter)); } }
static public bool ExportParameters(string objectName, string objectId, ParameterMap parameterMap, out string propertyFileName) { propertyFileName = string.Empty; if (parameterMap == null || parameterMap.Size == 0) { return(false); } if (curentPropertyJsObject.Count == MaxPropertiesPerSingleFile) { currentFileId = StringConverter.NewGuid(); curentPropertyJsObject = new JObject(); PropertyObjectDic.Add(currentFileId, curentPropertyJsObject); } Dictionary <string, List <string> > propertyCategoryDic = new Dictionary <string, List <string> >(); var itor = parameterMap.ForwardIterator(); while (itor.MoveNext()) { Parameter param = itor.Current as Parameter; Definition def = param.Definition; if (def == null) { continue; } string categoryName = LabelUtils.GetLabelFor(def.ParameterGroup); string paramName = def.Name; if (string.IsNullOrEmpty(paramName)) { continue; } string paramValue = ""; if (!string.IsNullOrEmpty(param.AsString())) { paramValue = param.AsString(); } else if (!string.IsNullOrEmpty(param.AsValueString())) { paramValue = param.AsValueString(); } if (propertyCategoryDic.ContainsKey(categoryName)) { propertyCategoryDic[categoryName].Add(paramName); propertyCategoryDic[categoryName].Add(paramValue); } else { propertyCategoryDic.Add(categoryName, new List <string> { paramName, paramValue }); } } JObject objectPropertyJObj = new JObject(); objectPropertyJObj.Add("name", objectName); JArray propertyCategoriesJArr = new JArray(); foreach (var propertyCategory in propertyCategoryDic) { JObject propertyCategoryJObj = new JObject(); JArray propertyJArr = new JArray(propertyCategory.Value); propertyCategoryJObj.Add(propertyCategory.Key, propertyJArr); propertyCategoriesJArr.Add(propertyCategoryJObj); } objectPropertyJObj.Add("PropertyCategories", propertyCategoriesJArr); curentPropertyJsObject.Add(objectId, objectPropertyJObj); propertyFileName = currentFileId + ".js.gz"; return(true); }