private static object LoadJObject(IArchiveFile importer)
        {
            var serializer = new JsonSerializer();

            using var file   = importer.OpenRead();
            using var sr     = new StreamReader(file);
            using var reader = new JsonTextReader(sr);

            var model = serializer.Deserialize <JObject>(reader);

            return(model);
        }
        private static TModel Load <TModel>(string identifier, IArchiveFile importer)
            where TModel : IResourceModel
        {
            var serializer = new JsonSerializer();

            using var file   = importer.OpenRead();
            using var sr     = new StreamReader(file);
            using var reader = new JsonTextReader(sr);

            var model = serializer.Deserialize <TModel>(reader);

            model.Identifier = identifier;
            return(model);
        }
Esempio n. 3
0
 public static T Load <T>(IArchiveFile file)
 {
     using (var stream = file.OpenRead()) {
         return(Read <T>(stream));
     }
 }