public static AbstractTraitGroup fromJson(object jsonObject)
{
if (jsonObject as string == "BasicInfoTraitGroup")
return new BasicInfoTraitGroup();
if (jsonObject is Dictionary<string, object>)
{
var dict = (Dictionary<string, object>)jsonObject;
if (dict.ContainsKey("orientation"))
{
string title = null;
try { title = (string)dict["title"]; }
catch (KeyNotFoundException) { }
return new TraitContainer(title, (Orientation)dict["orientation"], (from o in (List<object>)dict["members"] select fromJson(o)).ToArray());
}
if (dict.ContainsKey("names"))
{
string title = null;
try { title = (string)dict["title"]; }
catch (KeyNotFoundException) { }
TraitTypeFilter filter = TraitTypeFilter.Locked;
try { filter = (TraitTypeFilter)dict["filter"]; }
catch (KeyNotFoundException) { }
return new TraitList(title, filter, (from name in (List<object>)dict["names"] select (string)name).ToArray());
}
}
throw null;
}