private void readCustomControls(GH_IReader reader, IEnumerable <GHControl> customControls, string path) { foreach (GHControl control in customControls) { string name = (path.Length > 0) ? (path + "." + control.Name) : control.Name; if (control is GHParameter) { if (reader.FindItem(name) == null) { continue; } GHParameter param = (GHParameter)control; switch (param.DataType) { case GH_Types.gh_bool: param.CurrentValue = reader.GetBoolean(name); break; case GH_Types.gh_double: param.CurrentValue = reader.GetDouble(name); break; case GH_Types.gh_int32: param.CurrentValue = reader.GetInt32(name); break; case GH_Types.gh_decimal: param.CurrentValue = (float)reader.GetDecimal(name); break; } } if (control is IGHPanel) { readCustomControls(reader, ((IGHPanel)control).Items, name); } } }