Пример #1
0
        private void LoadAttributeLists(FileRecord record)
        {
            if (record.ExternalAttributes.Count > 0)
            {
                return;
            }

            var completedFiles = new List <FileReference>();

            foreach (var att in record.Attributes)
            {
                if (!(att is AttributeList listAttr))
                {
                    continue;
                }

                if (listAttr.NonResidentFlag == ResidentFlag.NonResident)
                {
                    listAttr.ParseAttributeNonResidentBody(this);
                }

                foreach (var listItem in listAttr.Items)
                {
                    if (listItem.BaseFile.Equals(record.FileReference) || completedFiles.Contains(listItem.BaseFile))
                    {
                        continue;
                    }
                    completedFiles.Add(listItem.BaseFile);

                    var otherRecord = ReadMftRecord(listItem.BaseFile.FileId);
                    record.ParseExternalAttributes(otherRecord);
                }
            }
        }
Пример #2
0
        internal void ParseAttributeLists(FileRecord record)
        {
            if (record.ExternalAttributes.Count > 0)
            {
                // Already parsed
                return;
            }

            Dictionary <FileReference, FileRecord> externalRecords = new Dictionary <FileReference, FileRecord>();

            foreach (AttributeList listAttr in record.Attributes.OfType <AttributeList>())
            {
                if (listAttr.NonResidentFlag == ResidentFlag.NonResident)
                {
                    if (Provider.MftFileOnly)
                    {
                        // Nothing to do about this
                        return;
                    }

                    // Get data
                    listAttr.ParseAttributeNonResidentBody(this);
                }

                foreach (AttributeListItem item in listAttr.Items)
                {
                    if (item.BaseFile.Equals(record.FileReference))
                    {
                        // Skip own attributes
                        continue;
                    }

                    if (externalRecords.ContainsKey(item.BaseFile))
                    {
                        continue;
                    }

                    FileRecord otherRecord = ReadMFTRecord(item.BaseFile.FileId);
                    externalRecords[item.BaseFile] = otherRecord;

                    Debug.Assert(otherRecord.FileReference.Equals(item.BaseFile));
                }
            }

            // Add all records to the record in question
            foreach (FileRecord externalRecord in externalRecords.Values)
            {
                record.ParseExternalAttributes(externalRecord);
            }
        }