public static CalibriationAnnotation Parse([NotNull] FileInfo fileInfo, [CanBeNull] Checksum checkSum) { Guard.NotNullAndValidFileSystemInfo(fileInfo, nameof(fileInfo)); var calibrationAnnotation = new CalibriationAnnotation { File = fileInfo, Checksum = checkSum, CalibrationVectors = new List <CalibrationVector>() }; using (var fileStream = new FileStream(fileInfo.FullName, FileMode.Open)) { var document = new XmlDocument(); document.Load(fileStream); var calibrationNode = document.SelectSingleNodeThrowIfNull("calibration"); calibrationAnnotation.RawXml = document.InnerXml; calibrationAnnotation.AdsHeader = AdsHeaderParser.Parse(calibrationNode.SelectSingleNodeThrowIfNull("adsHeader")); calibrationAnnotation.AbsoluteCalibrationConstant = double.Parse(calibrationNode.SelectSingleNodeThrowIfNull("calibrationInformation/absoluteCalibrationConstant").InnerText); calibrationAnnotation.CalibrationVectors = CalibrationVectorParser.Parse(calibrationNode.SelectSingleNodeThrowIfNull("calibrationVectorList")); } return(calibrationAnnotation); }
public static ProductAnnotation Parse([NotNull] FileInfo fileInfo, [CanBeNull] Checksum checkSum) { Guard.NotNullAndValidFileSystemInfo(fileInfo, nameof(fileInfo)); var productAnnotation = new ProductAnnotation { File = fileInfo, Checksum = checkSum }; using (var fileStream = new FileStream(fileInfo.FullName, FileMode.Open)) { var document = new XmlDocument(); document.Load(fileStream); productAnnotation.RawXml = document.InnerXml; var productNode = document.SelectSingleNodeThrowIfNull("product"); productAnnotation.AdsHeader = AdsHeaderParser.Parse(productNode.SelectSingleNodeThrowIfNull("adsHeader")); productAnnotation.QualityInformation = QualityInformationParser.Parse(productNode.SelectSingleNodeThrowIfNull("qualityInformation")); productAnnotation.GeneralAnnotation = GeneralAnnotationParser.Parse(productNode.SelectSingleNodeThrowIfNull("generalAnnotation")); } return(productAnnotation); }
public static NoiseAnnotation Parse([NotNull] FileInfo fileInfo, [CanBeNull] Checksum checkSum) { Guard.NotNullAndValidFileSystemInfo(fileInfo, nameof(fileInfo)); var noiseAnnotation = new NoiseAnnotation { File = fileInfo, Checksum = checkSum, NoiseRangeVectors = new List <NoiseRangeVector>(), NoiseAzimuthVectors = new List <NoiseAzimuthVector>() }; using (var fileStream = new FileStream(fileInfo.FullName, FileMode.Open)) { var document = new XmlDocument(); document.Load(fileStream); noiseAnnotation.RawXml = document.InnerXml; var noiseNode = document.SelectSingleNodeThrowIfNull("noise"); noiseAnnotation.AdsHeader = AdsHeaderParser.Parse(noiseNode.SelectSingleNodeThrowIfNull("adsHeader")); noiseAnnotation.NoiseRangeVectors = NoiseRangeVectorParser.Parse(noiseNode.SelectSingleNodeThrowIfNull("noiseRangeVectorList")); noiseAnnotation.NoiseAzimuthVectors = NoiseAzimuthVectorParser.Parse(noiseNode.SelectSingleNodeThrowIfNull("noiseAzimuthVectorList")); } return(noiseAnnotation); }