public void Deserialize(Stream stream, string mediaType, ErrorLogger log = null) { if (mediaType == null || mediaType == ContentTypes.Text.Plain || mediaType == ContentTypes.Application.Octet) { mediaType = SectorFileParser.SniffType(stream); } SectorFileParser parser = SectorFileParser.ForType(mediaType); parser.Parse(stream, this, log); if (log != null && !log.Empty) { log.Prepend(ErrorLogger.Severity.Hint, $"Parsing as: {parser.Name}"); } }
public void Deserialize(Stream stream, string mediaType, ErrorLogger errors = null) { if (mediaType == null || mediaType == MediaTypeNames.Text.Plain || mediaType == MediaTypeNames.Application.Octet) { mediaType = SectorFileParser.SniffType(stream); } SectorFileParser parser = SectorFileParser.ForType(mediaType); parser.Parse(stream, this, errors); if (errors != null && !errors.Empty) { errors.Prepend(ErrorLogger.Severity.Warning, string.Format("Parsing as: {0}", parser.Name)); } }