private Parameter CreateParameter(int id, JObject json) { Parameter p = new Parameter(); p.Values = new List<ParameterValue>(); p.Id = id; p.Name = json["0"]["name"].ToString(); p.Children = (json["0"]["children"] != null); p.Units = json["0"]["units"].ToString(); string t = json["0"]["type"].ToString(); /*if(t == "s") p.Type = ParameterType.Select; else if(t=="c") p.Type = ParameterType.Text;*/ switch (t) { case "s": p.Type = ParameterType.Select; break; case "c": p.Type = ParameterType.Text; break; case "i": p.Type = ParameterType.IntegerM; break; case "n": p.Type = ParameterType.IntegerS; break; default: p.Type = ParameterType.Select; break; } foreach (KeyValuePair<string, JToken> x in json) { if (x.Key[0] != '_') continue; ParameterValue pv = new ParameterValue(); pv.Id = Int32.Parse(x.Key.Substring(1)); if (x.Value.Type == JTokenType.Object) { pv.Name = x.Value["0"].ToString(); pv.SubParameters = new List<Parameter>(); foreach (KeyValuePair<string, JToken> y in (JObject)x.Value) if (y.Key[0] == '_') pv.SubParameters.Add(CreateParameter(Int32.Parse(y.Key.Substring(1)), toJObject(y.Value))); } else pv.Name = x.Value[0].ToString(); p.Values.Add(pv); } return p; }