public ParseFileResult ParseFile(Stream fileStream, IFieldDataResultsAppender appender, ILog logger) { var channel = QRevSerializer.DeserializeNoThrow(fileStream, logger); if (channel == null) { return(ParseFileResult.CannotParse()); } var locationIdentifier = channel.SiteInformation?.SiteID?.Value; if (string.IsNullOrWhiteSpace(locationIdentifier)) { logger.Error("File can be parsed but there is no SiteID specified."); return(ParseFileResult.SuccessfullyParsedButDataInvalid("Missing <Channel/SiteInformation/SiteID>")); } try { var trimmedLocationIdentifier = locationIdentifier.Trim(); var location = appender.GetLocationByIdentifier(trimmedLocationIdentifier); return(ParseXmlRootNoThrow(location, channel, appender, logger)); } catch (Exception exception) { logger.Error($"Cannot find location with identifier '{locationIdentifier}'."); return(ParseFileResult.CannotParse(exception)); } }
public ParseFileResult ParseFile(Stream fileStream, LocationInfo targetLocation, IFieldDataResultsAppender appender, ILog logger) { var xmlRoot = QRevSerializer.DeserializeNoThrow(fileStream, logger); return(xmlRoot == null ? ParseFileResult.CannotParse() : ParseXmlRootNoThrow(targetLocation, xmlRoot, appender, logger)); }