public T ToObject <T>() { if (Utilities.IsYamlFile(_fullpath)) { using (var textReader = new StreamReader(_fullpath)) { var obj = YamlPocoSerializer.Read <T>(textReader); return(obj); } } else { var str = File.ReadAllText(_fullpath); return(JsonSerializer.Deserialize <T>(str, Utilities._jsonOpts)); } }
private static T ToObject <T>(ZipArchiveEntry entry) { if (entry.Name.EndsWith(".yaml", StringComparison.OrdinalIgnoreCase)) { using (var stream = entry.Open()) using (var textReader = new StreamReader(stream)) { var obj = YamlPocoSerializer.Read <T>(textReader); return(obj); } } else { var je = entry.ToJson(); return(je.ToObject <T>()); } }