示例#1
0
            public ExtendedAttribute[] GetExtendedAttributes(string path)
            {
                List <ExtendedAttribute> result = new List <ExtendedAttribute>();

                File file = GetFile(path);

                foreach (var record in file.ExtendedAttributes)
                {
                    ImplementationUseExtendedAttributeRecord implRecord = record as ImplementationUseExtendedAttributeRecord;
                    if (implRecord != null)
                    {
                        result.Add(new ExtendedAttribute(implRecord.ImplementationIdentifier.Identifier, implRecord.ImplementationUseData));
                    }
                }

                return(result.ToArray());
            }
示例#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);
            }
        }