private Ja2Data.SlfFile.Record DownloadUnstreucturedRecord(SlfRecord aUnstructuredRec) { Ja2Data.SlfFile.Record.Header _header = this.DownloadSlfRecordHeader(aUnstructuredRec.SlfRecordHeader); Ja2Data.SlfFile.Record _rec = new Ja2Data.SlfFile.Record(_header); _rec.Data = aUnstructuredRec.UnstructuredData.Data; return(_rec); }
private Ja2Data.SlfFile.Record DownloadTxtRecord(SlfRecordText aTxtRecord) { Ja2Data.SlfFile.Record.Header _header = this.DownloadSlfRecordHeader(aTxtRecord.SlfRecordHeader); Ja2Data.SlfFile.Record _rec = new Ja2Data.SlfFile.Record(_header); _rec.Data = Ja2Data.Common.StringToByteArray(aTxtRecord.TextData, (int)_header.uiLength); return(_rec); }
private Ja2Data.SlfFile.Record.Header DownloadSlfRecordHeader(SlfRecordHeader aSlfRecordHeader) { Ja2Data.SlfFile.Record.Header _header = new Ja2Data.SlfFile.Record.Header(); _header.FileName = aSlfRecordHeader.FileName; _header.FileTime = aSlfRecordHeader.FileTime; _header.ubReserved = aSlfRecordHeader.Reserved; _header.ubState = aSlfRecordHeader.State; _header.uiLength = (uint)aSlfRecordHeader.Length; _header.uiOffset = (uint)aSlfRecordHeader.Offset; _header.usReserved2 = (ushort)aSlfRecordHeader.Reserved2; return(_header); }
private Ja2Data.SlfFile.Record DownloadStiRecord(SlfRecordStci aStciRecord) { Ja2Data.SlfFile.Record.Header _header = this.DownloadSlfRecordHeader(aStciRecord.SlfRecordHeader); Ja2Data.SlfFile.Record _rec = new Ja2Data.SlfFile.Record(_header); if (aStciRecord.StciIndexed.Count != 0) { _rec.Data = this.DownloadStiIndexed(aStciRecord, (int)_header.uiLength); } else if (aStciRecord.StciRgb.Count != 0) { _rec.Data = this.DownloadStciRgb(aStciRecord, (int)_header.uiLength); } return(_rec); }
private Ja2Data.SlfFile.Record DownloadJsdRecord(SlfRecordJsd aJsdRecord) { this.FJsdCells = new List <JsdCell>(100 * aJsdRecord.NumberOfStructuresStored); string _queryString = @"Select T.JsdTileId, C.RowNumber, C.CellNumber, Value from JsdTileCell C inner join JsdTile T on C.JsdTileId = T.JsdTileId inner join JsdStructure S on S.JsdStructureId = T.JsdStructureId inner join SlfRecordJsd SRJ on SRJ.SlfRecordJsdId = S.SlfRecordJsdId where SRJ.SlfRecordJsdId = @JsdFileId" ; DbRawSqlQuery _query = this.FContext.Database.SqlQuery(typeof(JsdCell), _queryString, new SqlParameter("@JsdFileId", aJsdRecord.SlfRecordJsdId)); var _enum = _query.GetEnumerator(); while (_enum.MoveNext()) { this.FJsdCells.Add(((JsdCell)_enum.Current)); } Ja2Data.SlfFile.Record.Header _header = this.DownloadSlfRecordHeader(aJsdRecord.SlfRecordHeader); Ja2Data.SlfFile.Record _jsdRec = new Ja2Data.SlfFile.Record(_header); _jsdRec.Data = new byte[_header.uiLength]; int _flags = 0; foreach (JsdRecordHeaderFlag _flag in aJsdRecord.JsdRecordHeaderFlag) { _flags |= _flag.JsdHeaderFlags.Mask.Value; } Ja2Data.JsdFile.Header _jsdHeader = new Ja2Data.JsdFile.Header( aJsdRecord.ID, (ushort)aJsdRecord.NumberOfStructuresAndOrImages, (ushort)aJsdRecord.NumberOfStructuresStored, (ushort)aJsdRecord.StructureDataSize, (byte)_flags, aJsdRecord.Unused, (ushort)aJsdRecord.NumberOfImageTileLocsStored ); Ja2Data.JsdFile _jsdFile = new Ja2Data.JsdFile(_jsdHeader); if (aJsdRecord.JsdAuxData.Count > 0) { JsdAuxData _jsdAuxData = aJsdRecord.JsdAuxData.First(); if (aJsdRecord.NumberOfImageTileLocsStored > 0) { Array.Copy(_jsdAuxData.TileLocationData, _jsdFile.TileLocData, _jsdFile.TileLocData.Length); } int i = 0; foreach (AuxDataJsdAux _aux in _jsdAuxData.AuxDataJsdAux) { _jsdFile.Auxilarity[i] = this.DownloadAuxObjectData(_aux.AuxObjectData); i++; } } if (aJsdRecord.JsdStructure.Count > 0) { int i = 0; foreach (JsdStructure _struct in aJsdRecord.JsdStructure) { _jsdFile.Structs[i] = this.DownloadJsdStructure(_struct, _jsdFile.IsHighDefenition); i++; } } using (MemoryStream _ms = new MemoryStream(_jsdRec.Data)) { _jsdFile.Save(_ms); } return(_jsdRec); }