public D1BDHeader(object commonInfoFor1BD, object qualityCheckInfoFor1BD, object scaleInfoFor1BD, object radiantionConvertArgsInfoFor1BD, object geographEnvelopeInfoFor1BD, object simluateRemoteMeasureMeasureInfoFor1BD, object nomalHeaderInfo, bool isBigEndian) { _commonInfoFor1BD = (CommonInfoFor1BD)commonInfoFor1BD; _qualityCheckInfoFor1BD = (QualityCheckInfoFor1BD)qualityCheckInfoFor1BD; _sacleInfoFor1BD = (ScaleInfoFor1BD)scaleInfoFor1BD; _radiantionConvertArgsInfoFor1BD = (RadiantionConvertArgsInfoFor1BD)radiantionConvertArgsInfoFor1BD; _geographLocationInfoFor1BD = (GeographLocationInfoFor1BD)geographEnvelopeInfoFor1BD; _simluateRemoteMeasureInfoFor1BD = (SimluateRemoteMeasureInfoFor1BD)simluateRemoteMeasureMeasureInfoFor1BD; _nomalHeaderInfo = (NomalHeaderInfo)nomalHeaderInfo; _isBigEndian = isBigEndian; }
public override object Create(Stream fileStream, BinaryReader binaryReader, int offset, int endOffset) { CommonInfoFor1BD commInfo = new CommonInfoFor1BD(); fileStream.Seek(offset, SeekOrigin.Begin); if (_isBigEndian) { commInfo.FileGenPlace = ToLocalEndian_Core.ReadString(binaryReader.ReadChars(3)); commInfo.ASCIIBank = binaryReader.ReadChar(); commInfo.Version = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); commInfo.VersionYear = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); commInfo.VersionDay = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); commInfo.LogicalRecordLen = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); commInfo.RecordBlockLen = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); commInfo.HeaderRecordCount = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); commInfo.FillFlag17_22 = new UInt16[] { ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)), ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)), ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)) }; commInfo.DatasetName = ToLocalEndian_Core.ReadString2(binaryReader.ReadChars(42)); commInfo.HandleBlockFlag = ToLocalEndian_Core.ReadString2(binaryReader.ReadChars(8)); commInfo.SatelliteIdentify = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); commInfo.SensorIdentify = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); commInfo.DataType = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); commInfo.TIPCode = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); commInfo.BeginDayFrom1950 = ToLocalEndian_Core.ToUInt32FromBig(binaryReader.ReadBytes(4)); commInfo.DataBeginYear = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); commInfo.DataBeginDayOfYear = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); commInfo.DataBeginUTC = ToLocalEndian_Core.ToUInt32FromBig(binaryReader.ReadBytes(4)); commInfo.EndDayFrom1950 = ToLocalEndian_Core.ToUInt32FromBig(binaryReader.ReadBytes(4)); commInfo.DataEndYear = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); commInfo.DataEndDayOfYear = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); commInfo.DataEndUTC = ToLocalEndian_Core.ToUInt32FromBig(binaryReader.ReadBytes(4)); binaryReader.ReadBytes(21924); UInt16 is3A_int = ToLocalEndian_Core.ToUInt16FromBig(binaryReader.ReadBytes(2)); string is3A_str = Convert.ToString(is3A_int, 2).PadLeft(16, '0'); commInfo.Current3A = is3A_str[0] == '0' ? true : false; commInfo.CurrentRise = is3A_str[15] == '0' ? true : false; commInfo.SatelliteName = commInfo.SatelliteIdentify == 3 ? "NOAA16" : commInfo.SatelliteIdentify == 11 ? "NOAA17" : (commInfo.SatelliteIdentify == 13 || commInfo.SatelliteIdentify == 7) ? "NOAA18" : ""; commInfo.SensorName = commInfo.SensorIdentify == 0 ? "AVHRR" : ""; commInfo.FullRecordCount = new FileInfo((fileStream as FileStream).Name).Length / _cstRecordBlockLen - 1; commInfo.OrbitBeginTime = DateTime.Parse(commInfo.DataBeginYear.ToString() + "-01-01").AddDays(commInfo.DataBeginDayOfYear - 1).AddMilliseconds(commInfo.DataBeginUTC); } else { commInfo.FileGenPlace = ToLocalEndian_Core.ReadString(binaryReader.ReadChars(3)); commInfo.ASCIIBank = binaryReader.ReadChar(); commInfo.Version = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); commInfo.VersionYear = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); commInfo.VersionDay = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); commInfo.LogicalRecordLen = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); commInfo.RecordBlockLen = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); commInfo.HeaderRecordCount = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); commInfo.FillFlag17_22 = new UInt16[] { ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)), ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)), ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)) }; commInfo.DatasetName = ToLocalEndian_Core.ReadString2(binaryReader.ReadChars(42)); commInfo.HandleBlockFlag = ToLocalEndian_Core.ReadString2(binaryReader.ReadChars(8)); commInfo.SatelliteIdentify = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); commInfo.SensorIdentify = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); commInfo.DataType = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); commInfo.TIPCode = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); commInfo.BeginDayFrom1950 = ToLocalEndian_Core.ToUInt32FromLittle(binaryReader.ReadBytes(4)); commInfo.DataBeginYear = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); commInfo.DataBeginDayOfYear = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); commInfo.DataBeginUTC = ToLocalEndian_Core.ToUInt32FromLittle(binaryReader.ReadBytes(4)); commInfo.EndDayFrom1950 = ToLocalEndian_Core.ToUInt32FromLittle(binaryReader.ReadBytes(4)); commInfo.DataEndYear = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); commInfo.DataEndDayOfYear = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); commInfo.DataEndUTC = ToLocalEndian_Core.ToUInt32FromLittle(binaryReader.ReadBytes(4)); binaryReader.ReadBytes(21924); UInt16 is3A_int = ToLocalEndian_Core.ToUInt16FromLittle(binaryReader.ReadBytes(2)); string is3A_str = Convert.ToString(is3A_int, 2).PadLeft(16, '0'); commInfo.Current3A = is3A_str[0] == '0' ? true : false; commInfo.CurrentRise = is3A_str[15] == '0' ? true : false; commInfo.SatelliteName = commInfo.SatelliteIdentify == 3 ? "NOAA16" : commInfo.SatelliteIdentify == 11 ? "NOAA17" : (commInfo.SatelliteIdentify == 13 || commInfo.SatelliteIdentify == 7) ? "NOAA18" : ""; commInfo.SensorName = commInfo.SensorIdentify == 0 ? "AVHRR" : ""; commInfo.FullRecordCount = new FileInfo((fileStream as FileStream).Name).Length / _cstRecordBlockLen - 1; commInfo.OrbitBeginTime = DateTime.Parse(commInfo.DataBeginYear.ToString() + "-01-01").AddDays(commInfo.DataBeginDayOfYear - 1).AddMilliseconds(commInfo.DataBeginUTC); } base.Create(fileStream, binaryReader, offset, endOffset); return(commInfo); }