Esempio n. 1
0
        GameObject CreateEventMarker(AnnotationRecord rec, out bool shouldRotate)
        {
            if (rec == null)
            {
                shouldRotate = false;
                return(null);
            }

            Transform parentTransform = timeline.baseLine.transform;
            long      t1 = rec.timeStart / 1000;
            long      t2 = rec.timeEnd / 1000;

            if (t2 < minUTCTime)
            {
                shouldRotate = false;
                return(null);
            }
            long  fullRangeDiff = this.maxUTCTime - this.minUTCTime;
            long  eventDiff     = t2 - t1;
            long  offset        = ((t2 - this.minUTCTime) + (t1 - this.minUTCTime)) / 2;
            float scaleX        = ((float)eventDiff) / (float)fullRangeDiff;
            float offsetX       = (((float)offset) / (float)fullRangeDiff) - 0.5f;

            GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube);

            if (eventMaterial != null)
            {
                Renderer renderer = go.GetComponent <Renderer>();
                if (renderer != null)
                {
                    renderer.material = eventMaterial;
                }
            }
            go.transform.position = new Vector3(parentTransform.position.x + offsetX, parentTransform.position.y - 0.01f, parentTransform.position.z + 0.025f);
            if (scaleX <= 0)
            {
                go.transform.localScale = new Vector3(parentTransform.localScale.x * 0.01f, 0.01f, 0.05f);
            }
            else
            {
                go.transform.localScale = new Vector3(parentTransform.localScale.x * (float)scaleX, 0.01f, 0.05f);
            }


            bool foundOverlap = isOverlappingExistingMarker(go);
            int  loopEscape   = 0;

            while (foundOverlap && loopEscape < 6)
            {
                go.transform.Translate(0, -0.011f, 0, Space.World);
                foundOverlap = isOverlappingExistingMarker(go);
                loopEscape++;
            }
            go.transform.parent = parentTransform;

            shouldRotate = (scaleX <= 0);

            markers.Add(go);
            return(go);
        }
        string GetRecordText(AnnotationRecord rec)
        {
            string result = "";

            result += "<b>" + rec.aggregateEvent + "</b>";
            result += " (" + rec.when + ")\r\n";
            if (rec.eventDetail != null)
            {
                result += rec.eventDetail + "\r\n";
            }
            if (rec.dataSourceAndIndicator != null)
            {
                result += "<i><color=#DDDDDD>" + rec.dataSourceAndIndicator + "</color></i>\r\n";
            }

            if (showFullDetails)
            {
                result += ListToString(rec.sourceIPs, "Source IPs");
                result += ListToString(rec.targetHostnames, "Target Hostnames");
                result += ListToString(rec.targetIPInternals, "Target IPs (Internal)");
                result += ListToString(rec.targetIPExternals, "Target IPs (External)");
                result += ListToString(rec.ports, "Ports");
            }

            return(result);
        }
 private void SetBoundingBox(AnnotationRecord record)
 {
     if (record.W > 0 && record.H > 0)
     {
         _shapeTextBoxIsModifiedByUser = false;
         viewModel.X = record.X;
         viewModel.Y = record.Y;
         viewModel.W = record.W;
         viewModel.H = record.H;
         _shapeTextBoxIsModifiedByUser = true;
     }
     else
     {
         if (_currentIndex > 0)
         {
             var lastFrameRecord = _annotationRecordDataAccessor.Get(_currentIndex.Value - 1);
             if (lastFrameRecord.W > 0 && lastFrameRecord.H > 0)
             {
                 _shapeTextBoxIsModifiedByUser = false;
                 viewModel.X = lastFrameRecord.X;
                 viewModel.Y = lastFrameRecord.Y;
                 viewModel.W = lastFrameRecord.W;
                 viewModel.H = lastFrameRecord.H;
                 _shapeTextBoxIsModifiedByUser = true;
             }
         }
     }
 }
        private static (IList <AnnotationRecord>, IList <bool>) LoadRecordsFromMatFile(string matPath)
        {
            IList <AnnotationRecord> recordList         = new List <AnnotationRecord>();
            IList <bool>             recordValidityList = new List <bool>();

            try
            {
                using (AnnotationRecordOperator annotationRecordOperator
                           = new AnnotationRecordOperator(matPath, AnnotationRecordOperator.DesiredAccess.Read,
                                                          AnnotationRecordOperator.CreationDisposition.OpenAlways))
                {
                    var numberOfRecordsULong = annotationRecordOperator.Length();
                    if (numberOfRecordsULong >= int.MaxValue)
                    {
                        throw new Exception("Too many records");
                    }
                    int numberOfRecords = Convert.ToInt32(numberOfRecordsULong);

                    for (int index = 0; index < numberOfRecords; ++index)
                    {
                        AnnotationRecord record = null;
                        bool             isRecordValid;
                        try
                        {
                            (record, isRecordValid) = annotationRecordOperator.Get(Convert.ToUInt64(index));
                        }
                        catch (Exception)
                        {
                            isRecordValid = false;
                        }

                        if (record == null)
                        {
                            record = new AnnotationRecord(false, 0, 0, 0, 0, false, false, null);
                        }

                        recordList.Add(record);
                        recordValidityList.Add(isRecordValid);
                    }
                }
            }
            catch (Exception)
            {
                return(recordList, recordValidityList);
            }

            return(recordList, recordValidityList);
        }
        private static bool MergeAnnotationRecordsWithInitialRecords(IList <AnnotationRecord> records,
                                                                     IList <int[]> initialRecords, int maxLength, IDictionary <int, AnnotationRecordCache> cacheUpdateToDoList)
        {
            bool isMatFileUpdateRequired = false;

            int endIndex = Math.Min(initialRecords.Count, maxLength);

            for (int index = 0; index < endIndex; ++index)
            {
                bool             changesHappened = false;
                AnnotationRecord record          = records[index];
                int[]            initialRecord   = initialRecords[index];
                if (record.X != initialRecord[0])
                {
                    record.X        = initialRecord[0];
                    changesHappened = true;
                }
                if (record.Y != initialRecord[1])
                {
                    record.Y        = initialRecord[1];
                    changesHappened = true;
                }
                if (record.W != initialRecord[2])
                {
                    record.W        = initialRecord[2];
                    changesHappened = true;
                }
                if (record.H != initialRecord[3])
                {
                    record.H        = initialRecord[3];
                    changesHappened = true;
                }

                if (!record.IsLabeled)
                {
                    record.IsLabeled = true;
                    changesHappened  = true;
                }

                if (changesHappened)
                {
                    cacheUpdateToDoList[index] = ConvertAnnotationRecordToCache(record);
                    isMatFileUpdateRequired    = true;
                }
            }

            return(isMatFileUpdateRequired);
        }
Esempio n. 6
0
        public static List <XRITBaseHeader> GetHeaderData(byte[] data)
        {
            List <XRITBaseHeader> headers = new List <XRITBaseHeader>();
            int maxLength = data.Length; // Initial Guess
            int c         = 0;

            // Parse Primary Header for size
            int type = data[0];

            if (type != (int)HeaderType.PrimaryHeader)
            {
                UIConsole.Error($"Expected PrimaryHeader({(int)HeaderType.PrimaryHeader} got {type}. File is corrupt.");
                return(headers);
            }

            byte[] tmp = data.Skip(1).Take(2).ToArray();

            if (BitConverter.IsLittleEndian)
            {
                Array.Reverse(tmp);
            }

            int size = BitConverter.ToUInt16(tmp, 0);

            tmp = data.Take(size).ToArray();

            PrimaryRecord fh = LLTools.ByteArrayToStruct <PrimaryRecord>(tmp);

            fh        = LLTools.StructToSystemEndian(fh);
            maxLength = (int)fh.HeaderLength; // Set the correct size

            byte[] headerData = data.Take(maxLength).ToArray();
            data = data.Skip(maxLength).ToArray();

            // Parse Secondary Headers
            while (c < maxLength)
            {
                type = headerData[0];
                tmp  = headerData.Skip(1).Take(2).ToArray();

                if (BitConverter.IsLittleEndian)
                {
                    Array.Reverse(tmp);
                }

                size = BitConverter.ToUInt16(tmp, 0);
                tmp  = headerData.Take(size).ToArray();

                if (tmp.Length < size)
                {
                    UIConsole.Warn($"Not enough data for unpack header: Expected {size} got {tmp.Length} - Header Type: {type} - File might be corrupted.");
                    if (c + size > maxLength)
                    {
                        UIConsole.Debug($"c + size > maxLength: {c} + {size} > {maxLength}");
                        size = maxLength - c - 1;
                        c    = maxLength;
                    }
                }
                else
                {
                    c += size;
                }

                headerData = headerData.Skip(size).ToArray();

                XRITBaseHeader h;
                switch (type)
                {
                case (int)HeaderType.PrimaryHeader:
                    fh        = LLTools.ByteArrayToStruct <PrimaryRecord>(tmp);
                    fh        = LLTools.StructToSystemEndian(fh);
                    h         = new PrimaryHeader(fh);
                    maxLength = (int)fh.HeaderLength;     // Set the correct size
                    break;

                case (int)HeaderType.ImageStructureRecord:
                    ImageStructureRecord isr = LLTools.ByteArrayToStruct <ImageStructureRecord>(tmp);
                    isr = LLTools.StructToSystemEndian(isr);
                    h   = new ImageStructureHeader(isr);
                    break;

                case (int)HeaderType.ImageNavigationRecord:
                    ImageNavigationRecord inr = LLTools.ByteArrayToStruct <ImageNavigationRecord>(tmp);
                    inr = LLTools.StructToSystemEndian(inr);
                    h   = new ImageNavigationHeader(inr);
                    break;

                case (int)HeaderType.ImageDataFunctionRecord:
                    // Cannot marshable due variable length
                    //ImageDataFunctionRecord idfr = LLTools.ByteArrayToStruct<ImageDataFunctionRecord>(tmp);
                    //idfr = LLTools.StructToSystemEndian(idfr);
                    ImageDataFunctionRecord idfr = new ImageDataFunctionRecord();
                    idfr.Data = System.Text.Encoding.UTF8.GetString(tmp.Skip(3).ToArray());
                    h         = new ImageDataFunctionHeader(idfr);
                    break;

                case (int)HeaderType.AnnotationRecord:
                    // Cannot be marshalled due variable length
                    //AnnotationRecord ar = LLTools.ByteArrayToStruct<AnnotationRecord>(tmp);
                    //ar = LLTools.StructToSystemEndian(ar);
                    AnnotationRecord ar = new AnnotationRecord();
                    ar.Filename = System.Text.Encoding.UTF8.GetString(tmp.Skip(3).ToArray());
                    h           = new AnnotationHeader(ar);
                    break;

                case (int)HeaderType.TimestampRecord:
                    TimestampRecord tr = LLTools.ByteArrayToStruct <TimestampRecord>(tmp);
                    tr = LLTools.StructToSystemEndian(tr);
                    h  = new TimestampHeader(tr);
                    break;

                case (int)HeaderType.AncillaryTextRecord:
                    // Cannot be marshalled due variable length.
                    // AncillaryText at = LLTools.ByteArrayToStruct<AncillaryText>(tmp);
                    //at = LLTools.StructToSystemEndian(at);
                    AncillaryText at = new AncillaryText();
                    at.Data = System.Text.Encoding.UTF8.GetString(tmp.Skip(3).ToArray());
                    h       = new AncillaryHeader(at);
                    break;

                case (int)HeaderType.KeyRecord:
                    h = new XRITBaseHeader(HeaderType.KeyRecord, tmp);
                    break;

                case (int)HeaderType.SegmentIdentificationRecord:
                    SegmentIdentificationRecord sir = LLTools.ByteArrayToStruct <SegmentIdentificationRecord>(tmp);
                    sir = LLTools.StructToSystemEndian(sir);
                    h   = new SegmentIdentificationHeader(sir);
                    break;

                case (int)HeaderType.NOAASpecificHeader:
                    NOAASpecificRecord nsr = LLTools.ByteArrayToStruct <NOAASpecificRecord>(tmp);
                    nsr = LLTools.StructToSystemEndian(nsr);
                    h   = new NOAASpecificHeader(nsr);
                    break;

                case (int)HeaderType.HeaderStructuredRecord:
                    // Cannot be marshalled due variable length
                    //HeaderStructuredRecord hsr = LLTools.ByteArrayToStruct<HeaderStructuredRecord>(tmp);
                    //hsr = LLTools.StructToSystemEndian(hsr); // Header Structured Record doesn't have endianess dependant fields
                    HeaderStructuredRecord hsr = new HeaderStructuredRecord();
                    hsr.Data = System.Text.Encoding.UTF8.GetString(tmp.Skip(3).ToArray());
                    h        = new HeaderStructuredHeader(hsr);
                    break;

                case (int)HeaderType.RiceCompressionRecord:
                    RiceCompressionRecord rcr = LLTools.ByteArrayToStruct <RiceCompressionRecord>(tmp);
                    rcr = LLTools.StructToSystemEndian(rcr);
                    h   = new RiceCompressionHeader(rcr);
                    break;

                case (int)HeaderType.DCSFileNameRecord:
                    // Cannot be marshalled due variable length
                    //DCSFilenameRecord dfr = LLTools.ByteArrayToStruct<DCSFilenameRecord>(tmp);
                    //dfr = LLTools.StructToSystemEndian(dfr); // DCS Filename Record doesn't have endianess dependant fields
                    DCSFilenameRecord dfr = new DCSFilenameRecord();
                    dfr.Filename = System.Text.Encoding.UTF8.GetString(tmp.Skip(3).ToArray());
                    h            = new DCSFilenameHeader(dfr);
                    break;

                case (int)HeaderType.Head9:
                    Head9 h9 = new Head9();
                    h9.Data = tmp.Skip(3).ToArray();
                    h       = new Head9Header(h9);
                    ((Head9Header)h).FileName = $"buggy_file_{LLTools.TimestampMS()}.lrit";
                    tmp.Skip(3).ToArray().Separate(new byte[] { 0x00 }).ToList().ForEach((barr) => {
                        if (barr.Length > 0 && barr[0] == 0x1F)
                        {
                            ((Head9Header)h).FileName = System.Text.Encoding.UTF8.GetString(barr.Skip(1).ToArray());
                            ((Head9Header)h).FileName = LLTools.StripNonPrintable(((Head9Header)h).FileName);
                        }
                    });
                    UIConsole.Debug($"Got Head9 which may be a bug. Filename: {((Head9Header)h).FileName}");
                    break;

                default:
                    h      = new XRITBaseHeader();
                    h.Type = HeaderType.Unknown;
                    break;
                }

                h.RawData = tmp;
                headers.Add(h);
            }

            return(headers);
        }
Esempio n. 7
0
 public AnnotationHeader(AnnotationRecord data)
 {
     Type     = HeaderType.AnnotationRecord;
     Filename = data.Filename;
 }
 public void Update(int index, AnnotationRecord record)
 {
     _annotationRecords[index] = record.Clone();
 }
        MergeMatFileRecordsAndCacheRecords(IList <AnnotationRecord> matFileRecords, IList <bool> matFileRecordValidity,
                                           IList <AnnotationRecordCache> cacheRecords, IList <string> imageFileNameList)
        {
            bool matFileUpdateRequired = false;

            IList <AnnotationRecord> mergeResults = new List <AnnotationRecord>(imageFileNameList.Count);
            IDictionary <int, AnnotationRecordCache> cacheUpdateToDoList = new Dictionary <int, AnnotationRecordCache>();

            int maxRecordsLength = imageFileNameList.Count;

            if (matFileRecords.Count != maxRecordsLength)
            {
                matFileUpdateRequired = true;
            }

            // Trust chain: cache > mat file

            int firstPhaseEndIndex = Math.Min(Math.Min(maxRecordsLength, matFileRecords.Count), cacheRecords.Count);

            for (int index = 0; index < firstPhaseEndIndex; ++index)
            {
                AnnotationRecord mergedRecord = matFileRecords[index];

                var cacheResult = cacheRecords[index];

                bool isAnnotationRecordIdentityToCache = IsAnnotationRecordIdentityToCache(mergedRecord, cacheResult);
                bool isEmptyRecord = IsEmptyRecord(cacheResult);
                if (!isAnnotationRecordIdentityToCache && !isEmptyRecord)
                {
                    mergedRecord          = ConvertAnnotationRecordCacheToRecord(cacheResult);
                    matFileUpdateRequired = true;
                }
                else if (!isAnnotationRecordIdentityToCache && isEmptyRecord)
                {
                    mergedRecord = mergedRecord.Clone();
                    cacheUpdateToDoList.Add(index, ConvertAnnotationRecordToCache(mergedRecord));
                }
                else
                {
                    mergedRecord = mergedRecord.Clone();
                }

                string path = imageFileNameList[index];
                if (mergedRecord.Path != path)
                {
                    mergedRecord.Path     = path;
                    matFileUpdateRequired = true;
                }

                if (!matFileRecordValidity[index])
                {
                    matFileUpdateRequired = true;
                }

                mergeResults.Add(mergedRecord);
            }

            int  secondPhaseEndIndex      = Math.Min(Math.Max(matFileRecords.Count, cacheRecords.Count), maxRecordsLength);
            bool secondPhaseDoWithMatFile = matFileRecords.Count > cacheRecords.Count;

            if (secondPhaseDoWithMatFile)
            {
                for (int index = firstPhaseEndIndex; index < secondPhaseEndIndex; ++index)
                {
                    AnnotationRecord mergedRecord = matFileRecords[index].Clone();
                    cacheUpdateToDoList.Add(index, ConvertAnnotationRecordToCache(mergedRecord));

                    string path = imageFileNameList[index];
                    if (mergedRecord.Path != path)
                    {
                        mergedRecord.Path     = path;
                        matFileUpdateRequired = true;
                    }

                    if (!matFileRecordValidity[index])
                    {
                        matFileUpdateRequired = true;
                    }

                    mergeResults.Add(mergedRecord);
                }
            }
            else
            {
                for (int index = firstPhaseEndIndex; index < secondPhaseEndIndex; ++index)
                {
                    AnnotationRecord mergedRecord = ConvertAnnotationRecordCacheToRecord(cacheRecords[index]);
                    mergedRecord.Path     = imageFileNameList[index];
                    matFileUpdateRequired = true;

                    mergeResults.Add(mergedRecord);
                }
            }

            int thirdPhaseEndIndex = maxRecordsLength;

            for (int index = secondPhaseEndIndex; index < thirdPhaseEndIndex; ++index)
            {
                AnnotationRecord mergedRecord = CreateEmptyAnnotationRecord();
                mergedRecord.Path     = imageFileNameList[index];
                matFileUpdateRequired = true;
                cacheUpdateToDoList.Add(index, CreateEmptyAnnotationRecordCache());

                mergeResults.Add(mergedRecord);
            }

            return(mergeResults, cacheUpdateToDoList, matFileUpdateRequired);
        }
 private static bool IsEmptyRecord(AnnotationRecord record)
 {
     return(!record.IsLabeled && record.X == 0 && record.Y == 0 && record.W == 0 && record.H == 0 &&
            !record.IsFullyOccluded && !record.IsOutOfView);
 }
 private static AnnotationRecordCache ConvertAnnotationRecordToCache(AnnotationRecord record)
 {
     return(new AnnotationRecordCache(record.IsLabeled, record.X, record.Y, record.W, record.H, record.IsFullyOccluded, record.IsOutOfView));
 }
 private static bool IsAnnotationRecordIdentityToCache(AnnotationRecord left, AnnotationRecordCache right)
 {
     return(!((left.IsLabeled != right.IsLabeled) || (left.X != right.X) || (left.Y != right.Y) ||
              (left.W != right.W) || (left.H != right.H) || (left.IsFullyOccluded != right.IsFullyOccluded) ||
              (left.IsOutOfView != right.IsOutOfView)));
 }
Esempio n. 13
0
        public static List <XRITBaseHeader> GetHeaderData(byte[] data)
        {
            List <XRITBaseHeader> headers = new List <XRITBaseHeader>();
            int maxLength = data.Length; // Initial Guess
            int c         = 0;

            while (c < maxLength)
            {
                int    type = data[0];
                byte[] tmp  = data.Skip(1).Take(2).ToArray();

                if (BitConverter.IsLittleEndian)
                {
                    Array.Reverse(tmp);
                }

                int size = BitConverter.ToUInt16(tmp, 0);
                tmp = data.Take(size).ToArray();

                if (tmp.Length < size)
                {
                    Console.WriteLine("Not enough data for unpack header: Expected {0} got {1}", size, tmp.Length);
                    break;
                }

                XRITBaseHeader h;
                switch (type)
                {
                case (int)HeaderType.PrimaryHeader:
                    PrimaryRecord fh = LLTools.ByteArrayToStruct <PrimaryRecord>(tmp);
                    fh        = LLTools.StructToSystemEndian(fh);
                    h         = new PrimaryHeader(fh);
                    maxLength = (int)fh.HeaderLength;     // Set the correct size
                    break;

                case (int)HeaderType.ImageStructureRecord:
                    ImageStructureRecord isr = LLTools.ByteArrayToStruct <ImageStructureRecord>(tmp);
                    isr = LLTools.StructToSystemEndian(isr);
                    h   = new ImageStructureHeader(isr);
                    break;

                case (int)HeaderType.ImageNavigationRecord:
                    ImageNavigationRecord inr = LLTools.ByteArrayToStruct <ImageNavigationRecord>(tmp);
                    inr = LLTools.StructToSystemEndian(inr);
                    h   = new ImageNavigationHeader(inr);
                    break;

                case (int)HeaderType.ImageDataFunctionRecord:
                    // Cannot marshable due variable length
                    //ImageDataFunctionRecord idfr = LLTools.ByteArrayToStruct<ImageDataFunctionRecord>(tmp);
                    //idfr = LLTools.StructToSystemEndian(idfr);
                    ImageDataFunctionRecord idfr = new ImageDataFunctionRecord();
                    idfr.Data = System.Text.Encoding.UTF8.GetString(tmp.Skip(3).ToArray());
                    h         = new ImageDataFunctionHeader(idfr);
                    break;

                case (int)HeaderType.AnnotationRecord:
                    // Cannot be marshalled due variable length
                    //AnnotationRecord ar = LLTools.ByteArrayToStruct<AnnotationRecord>(tmp);
                    //ar = LLTools.StructToSystemEndian(ar);
                    AnnotationRecord ar = new AnnotationRecord();
                    ar.Filename = System.Text.Encoding.UTF8.GetString(tmp.Skip(3).ToArray());
                    h           = new AnnotationHeader(ar);
                    break;

                case (int)HeaderType.TimestampRecord:
                    TimestampRecord tr = LLTools.ByteArrayToStruct <TimestampRecord>(tmp);
                    tr = LLTools.StructToSystemEndian(tr);
                    h  = new TimestampHeader(tr);
                    break;

                case (int)HeaderType.AncillaryTextRecord:
                    // Cannot be marshalled due variable length.
                    // AncillaryText at = LLTools.ByteArrayToStruct<AncillaryText>(tmp);
                    //at = LLTools.StructToSystemEndian(at);
                    AncillaryText at = new AncillaryText();
                    at.Data = System.Text.Encoding.UTF8.GetString(tmp.Skip(3).ToArray());
                    h       = new AncillaryHeader(at);
                    break;

                case (int)HeaderType.KeyRecord:
                    h = new XRITBaseHeader(HeaderType.KeyRecord, tmp);
                    break;

                case (int)HeaderType.SegmentIdentificationRecord:
                    SegmentIdentificationRecord sir = LLTools.ByteArrayToStruct <SegmentIdentificationRecord>(tmp);
                    sir = LLTools.StructToSystemEndian(sir);
                    h   = new SegmentIdentificationHeader(sir);
                    break;

                case (int)HeaderType.NOAASpecificHeader:
                    NOAASpecificRecord nsr = LLTools.ByteArrayToStruct <NOAASpecificRecord>(tmp);
                    nsr = LLTools.StructToSystemEndian(nsr);
                    h   = new NOAASpecificHeader(nsr);
                    break;

                case (int)HeaderType.HeaderStructuredRecord:
                    // Cannot be marshalled due variable length
                    //HeaderStructuredRecord hsr = LLTools.ByteArrayToStruct<HeaderStructuredRecord>(tmp);
                    //hsr = LLTools.StructToSystemEndian(hsr); // Header Structured Record doesn't have endianess dependant fields
                    HeaderStructuredRecord hsr = new HeaderStructuredRecord();
                    hsr.Data = System.Text.Encoding.UTF8.GetString(tmp.Skip(3).ToArray());
                    h        = new HeaderStructuredHeader(hsr);
                    break;

                case (int)HeaderType.RiceCompressionRecord:
                    RiceCompressionRecord rcr = LLTools.ByteArrayToStruct <RiceCompressionRecord>(tmp);
                    rcr = LLTools.StructToSystemEndian(rcr);
                    h   = new RiceCompressionHeader(rcr);
                    break;

                case (int)HeaderType.DCSFileNameRecord:
                    // Cannot be marshalled due variable length
                    //DCSFilenameRecord dfr = LLTools.ByteArrayToStruct<DCSFilenameRecord>(tmp);
                    //dfr = LLTools.StructToSystemEndian(dfr); // DCS Filename Record doesn't have endianess dependant fields
                    DCSFilenameRecord dfr = new DCSFilenameRecord();
                    dfr.Filename = System.Text.Encoding.UTF8.GetString(tmp.Skip(3).ToArray());
                    h            = new DCSFilenameHeader(dfr);
                    break;

                default:
                    h      = new XRITBaseHeader();
                    h.Type = HeaderType.Unknown;
                    break;
                }

                h.RawData = tmp;
                headers.Add(h);
                c   += size;
                data = data.Skip(size).ToArray();
            }

            return(headers);
        }