public static UnionOfCoordOrEntityFilter FromJsonToken(JToken token) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) if ((int)token.get_Type() != 1) { Debug.LogWarning((object)("Malformed token : type Object expected, but " + token.get_Type() + " found")); return(null); } JObject jsonObject = Extensions.Value <JObject>((IEnumerable <JToken>)token); UnionOfCoordOrEntityFilter unionOfCoordOrEntityFilter = new UnionOfCoordOrEntityFilter(); unionOfCoordOrEntityFilter.PopulateFromJson(jsonObject); return(unionOfCoordOrEntityFilter); }
public static IUnionTargetsFilter FromJsonToken(JToken token) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) if ((int)token.get_Type() != 1) { Debug.LogWarning((object)("Malformed token : type Object expected, but " + token.get_Type() + " found")); return(null); } JObject val = Extensions.Value <JObject>((IEnumerable <JToken>)token); JToken val2 = default(JToken); if (!val.TryGetValue("type", ref val2)) { Debug.LogWarning((object)"Malformed json: no 'type' property in object of class IUnionTargetsFilter"); return(null); } string text = Extensions.Value <string>((IEnumerable <JToken>)val2); IUnionTargetsFilter unionTargetsFilter; switch (text) { case "UnionOfEntityFilter": unionTargetsFilter = new UnionOfEntityFilter(); break; case "UnionOfCoordFilter": unionTargetsFilter = new UnionOfCoordFilter(); break; case "UnionOfCoordOrEntityFilter": unionTargetsFilter = new UnionOfCoordOrEntityFilter(); break; default: Debug.LogWarning((object)("Unknown type: " + text)); return(null); } unionTargetsFilter.PopulateFromJson(val); return(unionTargetsFilter); }