private List <RuntimeTargetEntryStub> ReadTargetLibraryRuntimeTargets(ref Utf8JsonReader reader) { var runtimeTargets = new List <RuntimeTargetEntryStub>(); reader.ReadStartObject(); while (reader.Read() && reader.IsTokenTypeProperty()) { string?runtimePath = reader.GetString(); if (string.IsNullOrEmpty(runtimePath)) { throw new FormatException(SR.Format(SR.RequiredFieldNotSpecified, nameof(runtimePath))); } var runtimeTarget = new RuntimeTargetEntryStub { Path = runtimePath }; reader.ReadStartObject(); while (reader.TryReadStringProperty(out string?propertyName, out string?propertyValue)) { switch (propertyName) { case DependencyContextStrings.RidPropertyName: runtimeTarget.Rid = Pool(propertyValue); break; case DependencyContextStrings.AssetTypePropertyName: runtimeTarget.Type = Pool(propertyValue); break; case DependencyContextStrings.AssemblyVersionPropertyName: runtimeTarget.AssemblyVersion = propertyValue; break; case DependencyContextStrings.FileVersionPropertyName: runtimeTarget.FileVersion = propertyValue; break; } } reader.CheckEndObject(); runtimeTargets.Add(runtimeTarget); } reader.CheckEndObject(); return(runtimeTargets); }
private List <RuntimeTargetEntryStub> ReadTargetLibraryRuntimeTargets(ref Utf8JsonReader reader) { var runtimeTargets = new List <RuntimeTargetEntryStub>(); reader.ReadStartObject(); while (reader.Read() && reader.IsTokenTypeProperty()) { var runtimeTarget = new RuntimeTargetEntryStub { Path = reader.GetString() }; reader.ReadStartObject(); while (reader.TryReadStringProperty(out string propertyName, out string propertyValue)) { switch (propertyName) { case DependencyContextStrings.RidPropertyName: runtimeTarget.Rid = Pool(propertyValue); break; case DependencyContextStrings.AssetTypePropertyName: runtimeTarget.Type = Pool(propertyValue); break; case DependencyContextStrings.AssemblyVersionPropertyName: runtimeTarget.AssemblyVersion = propertyValue; break; case DependencyContextStrings.FileVersionPropertyName: runtimeTarget.FileVersion = propertyValue; break; } } reader.CheckEndObject(); runtimeTargets.Add(runtimeTarget); } reader.CheckEndObject(); return(runtimeTargets); }
private List <RuntimeTargetEntryStub> ReadTargetLibraryRuntimeTargets(JsonTextReader reader) { var runtimeTargets = new List <RuntimeTargetEntryStub>(); reader.ReadStartObject(); while (reader.Read() && reader.TokenType == JsonToken.PropertyName) { var runtimeTarget = new RuntimeTargetEntryStub(); runtimeTarget.Path = (string)reader.Value; reader.ReadStartObject(); string propertyName; string propertyValue; while (reader.TryReadStringProperty(out propertyName, out propertyValue)) { switch (propertyName) { case DependencyContextStrings.RidPropertyName: runtimeTarget.Rid = Pool(propertyValue); break; case DependencyContextStrings.AssetTypePropertyName: runtimeTarget.Type = Pool(propertyValue); break; default: throw new FormatException($"Unknown property name '{propertyName}'"); } } reader.CheckEndObject(); runtimeTargets.Add(runtimeTarget); } reader.CheckEndObject(); return(runtimeTargets); }