internal protected override bool TryParse(JsonReader reader) { // read items if (base.TryParse(reader)) { return(true); } switch (reader.Path) { case "PrecipitationType": PrecipitationType = reader.AsEnum(PrecipitationType); break; case "PrecipitationDensity": Density = reader.AsFloat(Density); break; case "PrecipitationVariation": Variation = reader.AsFloat(Variation); break; case "PrecipitationRateOfChange": RateOfChange = reader.AsFloat(RateOfChange); break; case "PrecipitationProbability": Probability = reader.AsFloat(Probability); break; case "PrecipitationSpread": Spread = reader.AsFloat(Spread); break; case "PrecipitationVisibilityAtMinDensity": VisibilityAtMinDensity = reader.AsFloat(VisibilityAtMinDensity); break; case "PrecipitationVisibilityAtMaxDensity": VisibilityAtMaxDensity = reader.AsFloat(VisibilityAtMaxDensity); break; case "OvercastPrecipitationStart": OvercastPrecipitationStart = reader.AsFloat(OvercastPrecipitationStart); break; case "OvercastBuildUp": OvercastBuildUp = reader.AsFloat(OvercastBuildUp); break; case "PrecipitationStartPhase": PrecipitationStartPhase = reader.AsFloat(PrecipitationStartPhase); break; case "OvercastDispersion": OvercastDispersion = reader.AsFloat(OvercastDispersion); break; case "PrecipitationEndPhase": PrecipitationEndPhase = reader.AsFloat(PrecipitationEndPhase); break; case "Overcast": case "OvercastVariation": case "OvercastRateOfChange": case "OvercastVisibility": Overcast.TryParse(reader); break; default: return(false); } return(true); }
protected override bool TryParse(JsonReader item) { // read items if (base.TryParse(item)) { return(true); } switch (item.Path) { case "PrecipitationType": PrecipitationType = item.AsEnum(PrecipitationType); break; case "PrecipitationDensity": PrecipitationDensity = item.AsFloat(PrecipitationDensity); break; case "PrecipitationVariation": PrecipitationVariation = item.AsFloat(PrecipitationVariation); break; case "PrecipitationRateOfChange": PrecipitationRateOfChange = item.AsFloat(PrecipitationRateOfChange); break; case "PrecipitationProbability": PrecipitationProbability = item.AsFloat(PrecipitationProbability); break; case "PrecipitationSpread": PrecipitationSpread = item.AsFloat(PrecipitationSpread); break; case "PrecipitationVisibilityAtMinDensity": PrecipitationVisibilityAtMinDensityM = item.AsFloat(PrecipitationVisibilityAtMinDensityM); break; case "PrecipitationVisibilityAtMaxDensity": PrecipitationVisibilityAtMaxDensityM = item.AsFloat(PrecipitationVisibilityAtMaxDensityM); break; case "OvercastPrecipitationStart": OvercastPrecipitationStart = item.AsFloat(OvercastPrecipitationStart); break; case "OvercastBuildUp": OvercastBuildUp = item.AsFloat(OvercastBuildUp); break; case "PrecipitationStartPhase": PrecipitationStartPhaseS = item.AsFloat(PrecipitationStartPhaseS); break; case "OvercastDispersion": OvercastDispersion = item.AsFloat(OvercastDispersion); break; case "PrecipitationEndPhase": PrecipitationEndPhaseS = item.AsFloat(PrecipitationEndPhaseS); break; case "Overcast": Overcast = item.AsFloat(Overcast); break; case "OvercastVariation": OvercastVariation = item.AsFloat(OvercastVariation); break; case "OvercastRateOfChange": OvercastRateOfChange = item.AsFloat(OvercastRateOfChange); break; case "OvercastVisibility": OvercastVisibilityM = item.AsFloat(OvercastVisibilityM); break; default: return(false); } return(true); }
public static TreeNode ReadTreeNode(this JsonReader jr) { Debug.Assert(jr != null); string name = default; NodeKind kind = default; Sha1 sha1 = default; ReadOnlyMemory <byte>?data = null; jr.ReadObject(n => { switch (n) { case Name: name = (string)jr.Value; return(true); case Kind: kind = jr.AsEnum <NodeKind>(true); return(true); case NodeId: sha1 = jr.ReadSha1(); return(true); case Data: var base64 = (string)jr.Value; if (base64 != null) { data = Convert.FromBase64String(base64); } return(true); } return(false); }); return((name == null && kind == default && sha1 == default & data == null) ? default : new TreeNode(name, kind, sha1, data));