private Parameter[] CreateParameterMapping(string[] header) { Parameter[] ret = new Parameter[header.Length]; for (int i = 0; i < ret.Length; i++) { var endOfMode = header[i].IndexOf('.'); string mode; if (endOfMode == -1) { continue; } else { mode = header[i].Substring(0, endOfMode); ParameterSetStructure coRespondingStructure = GetStructure(mode); if (coRespondingStructure == null) { continue; } FieldInfo field; PropertyInfo property; if (StoreProperty(coRespondingStructure.Mode, header[i].Substring(endOfMode + 1), out field, out property)) { if (coRespondingStructure.Parameters == null) { coRespondingStructure.Parameters = new Parameter[1]; } else { var temp = coRespondingStructure.Parameters; coRespondingStructure.Parameters = new Parameter[coRespondingStructure.Parameters.Length + 1]; Array.Copy(temp, coRespondingStructure.Parameters, temp.Length); } // store the new parameter in our return list and in the recursive structure ret[i] = coRespondingStructure.Parameters[coRespondingStructure.Parameters.Length - 1] = new Parameter() { Field = field, Property = property, Values = new List <object>() }; } } } return(ret); }
private ParameterSetStructure[] CreateStructure(List <IModeChoiceNode> modes) { // First create all of our children var children = new ParameterSetStructure[modes.Count]; for (int i = 0; i < children.Length; i++) { var mode = modes[i]; var cat = mode as IModeCategory; children[i] = new ParameterSetStructure(); children[i].Mode = mode; if (cat != null) { children[i].Children = CreateStructure(cat.Children); } } return(children); }
private static ParameterSetStructure GetStructure(string mode, ParameterSetStructure parameterSetStructure) { if (parameterSetStructure.Mode.ModeName == mode) { return(parameterSetStructure); } if (parameterSetStructure.Children != null) { for (int i = 0; i < parameterSetStructure.Children.Length; i++) { var res = GetStructure(mode, parameterSetStructure.Children[i]); if (res != null) { return(res); } } } return(null); }
private ParameterSetStructure[] CreateStructure(List<IModeChoiceNode> modes) { // First create all of our children var children = new ParameterSetStructure[modes.Count]; for ( int i = 0; i < children.Length; i++ ) { var mode = modes[i]; var cat = mode as IModeCategory; children[i] = new ParameterSetStructure(); children[i].Mode = mode; if ( cat != null ) { children[i].Children = CreateStructure( cat.Children ); } } return children; }
private static ParameterSetStructure GetStructure(string mode, ParameterSetStructure parameterSetStructure) { if ( parameterSetStructure.Mode.ModeName == mode ) { return parameterSetStructure; } if ( parameterSetStructure.Children != null ) { for ( int i = 0; i < parameterSetStructure.Children.Length; i++ ) { var res = GetStructure( mode, parameterSetStructure.Children[i] ); if ( res != null ) return res; } } return null; }