void DeserializeResources(JObject jobj, Type resourceType, JsonSerializer serializer, DotvvmResourceRepository repo) { foreach (var resObj in jobj) { var resource = serializer.Deserialize(resObj.Value.CreateReader(), resourceType) as ResourceBase; repo.Register(resObj.Key, resource); } }
void DeserializeResources(JObject jobj, Type resourceType, JsonSerializer serializer, DotvvmResourceRepository repo) { foreach (var resObj in jobj) { var resource = serializer.Deserialize(resObj.Value.CreateReader(), resourceType) as ResourceBase; repo.Register(resObj.Key, resource); } }
void DeserializeResources(JObject jobj, Type resourceType, JsonSerializer serializer, DotvvmResourceRepository repo) { foreach (var resObj in jobj) { try { var resource = serializer.Deserialize(resObj.Value.CreateReader(), resourceType) as IResource; if (resource is LinkResourceBase linkResource) { if (linkResource.Location == null) { linkResource.Location = new UnknownResourceLocation(); } } repo.Register(resObj.Key, resource); } catch (Exception ex) { repo.Register(resObj.Key, new DeserializationErrorResource(ex, resObj.Value)); } } }