Example #1
0
        protected static List <ExtendedAttributeRecord> ReadExtendedAttributes(byte[] eaData)
        {
            if (eaData != null && eaData.Length != 0)
            {
                DescriptorTag eaTag = new DescriptorTag();
                eaTag.ReadFrom(eaData, 0);

                int implAttrLocation = Utilities.ToInt32LittleEndian(eaData, 16);
                int appAttrLocation  = Utilities.ToInt32LittleEndian(eaData, 20);

                List <ExtendedAttributeRecord> extendedAttrs = new List <ExtendedAttributeRecord>();
                int pos = 24;
                while (pos < eaData.Length)
                {
                    ExtendedAttributeRecord ea;

                    if (pos >= implAttrLocation)
                    {
                        ea = new ImplementationUseExtendedAttributeRecord();
                    }
                    else
                    {
                        ea = new ExtendedAttributeRecord();
                    }

                    int numRead = ea.ReadFrom(eaData, pos);
                    extendedAttrs.Add(ea);

                    pos += numRead;
                }

                return(extendedAttrs);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        protected static List<ExtendedAttributeRecord> ReadExtendedAttributes(byte[] eaData)
        {
            if (eaData != null && eaData.Length != 0)
            {
                DescriptorTag eaTag = new DescriptorTag();
                eaTag.ReadFrom(eaData, 0);

                int implAttrLocation = Utilities.ToInt32LittleEndian(eaData, 16);
                int appAttrLocation = Utilities.ToInt32LittleEndian(eaData, 20);

                List<ExtendedAttributeRecord> extendedAttrs = new List<ExtendedAttributeRecord>();
                int pos = 24;
                while (pos < eaData.Length)
                {
                    ExtendedAttributeRecord ea;

                    if (pos >= implAttrLocation)
                    {
                        ea = new ImplementationUseExtendedAttributeRecord();
                    }
                    else
                    {
                        ea = new ExtendedAttributeRecord();
                    }

                    int numRead = ea.ReadFrom(eaData, pos);
                    extendedAttrs.Add(ea);

                    pos += numRead;
                }

                return extendedAttrs;
            }
            else
            {
                return null;
            }
        }