@@ -41,8 +41,7 @@ public static List<AttributeRecord> GetAssembledAttributes(List<FileRecordSegmen
4141
4242 if ( ! additionalFragment && fragments . Count > 0 )
4343 {
44- NonResidentAttributeRecord assembledAttribute = AssembleFragments ( fragments , segments [ 0 ] . NextAttributeInstance ) ;
45- segments [ 0 ] . NextAttributeInstance ++ ;
44+ NonResidentAttributeRecord assembledAttribute = AssembleFragments ( fragments ) ;
4645 result . Add ( assembledAttribute ) ;
4746 fragments . Clear ( ) ;
4847 }
@@ -65,15 +64,14 @@ public static List<AttributeRecord> GetAssembledAttributes(List<FileRecordSegmen
6564
6665 if ( fragments . Count > 0 )
6766 {
68- NonResidentAttributeRecord assembledAttribute = AssembleFragments ( fragments , segments [ 0 ] . NextAttributeInstance ) ;
69- segments [ 0 ] . NextAttributeInstance ++ ;
67+ NonResidentAttributeRecord assembledAttribute = AssembleFragments ( fragments ) ;
7068 result . Add ( assembledAttribute ) ;
7169 }
7270
7371 return result ;
7472 }
7573
76- private static NonResidentAttributeRecord AssembleFragments ( List < NonResidentAttributeRecord > attributeFragments , ushort nextAttributeInstance )
74+ private static NonResidentAttributeRecord AssembleFragments ( List < NonResidentAttributeRecord > attributeFragments )
7775 {
7876 // Attribute fragments are written to disk sorted by LowestVCN
7977 NonResidentAttributeRecord firstFragment = attributeFragments [ 0 ] ;
@@ -84,7 +82,6 @@ private static NonResidentAttributeRecord AssembleFragments(List<NonResidentAttr
8482 }
8583
8684 NonResidentAttributeRecord attribute = NonResidentAttributeRecord . Create ( firstFragment . AttributeType , firstFragment . Name ) ;
87- attribute . Instance = nextAttributeInstance ;
8885 attribute . Flags = firstFragment . Flags ;
8986 attribute . LowestVCN = 0 ;
9087 attribute . HighestVCN = - 1 ;
@@ -130,12 +127,12 @@ public static void SliceAttributes(List<FileRecordSegment> segments, List<Attrib
130127 if ( attribute . AttributeType == AttributeType . StandardInformation ||
131128 attribute . AttributeType == AttributeType . FileName )
132129 {
133- baseFileRecordSegment . ImmediateAttributes . Add ( attribute ) ;
130+ baseFileRecordSegment . AddAttributeRecord ( attribute ) ;
134131 }
135132 else if ( isMftFileRecord && attribute . AttributeType == AttributeType . Data )
136133 {
137134 List < NonResidentAttributeRecord > slices = SliceAttributeRecord ( ( NonResidentAttributeRecord ) attribute , bytesPerFileRecordSegment / 2 , bytesAvailableInSegment ) ;
138- baseFileRecordSegment . ImmediateAttributes . Add ( slices [ 0 ] ) ;
135+ baseFileRecordSegment . AddAttributeRecord ( slices [ 0 ] ) ;
139136 slices . RemoveAt ( 0 ) ;
140137 foreach ( NonResidentAttributeRecord slice in slices )
141138 {
@@ -166,13 +163,8 @@ public static void SliceAttributes(List<FileRecordSegment> segments, List<Attrib
166163 if ( attribute . RecordLength <= remainingLengthInCurrentSegment )
167164 {
168165 remainingLengthInCurrentSegment -= ( int ) attribute . RecordLength ;
169- segments [ segmentIndex ] . ImmediateAttributes . Add ( attribute ) ;
166+ segments [ segmentIndex ] . AddAttributeRecord ( attribute ) ;
170167 remainingAttributes . RemoveFirst ( ) ;
171- // Instead of renumbering each attribute slice in the new FileRecordSegment, we use the original Instance number.
172- if ( segments [ segmentIndex ] . NextAttributeInstance <= attribute . Instance )
173- {
174- segments [ segmentIndex ] . NextAttributeInstance = ( ushort ) ( attribute . Instance + 1 ) ;
175- }
176168 }
177169 else
178170 {
@@ -219,9 +211,7 @@ private static NonResidentAttributeRecord FitMaxNumberOfRuns(NonResidentAttribut
219211 {
220212 // Each attribute record is aligned to 8-byte boundary, we must have enough room for padding
221213 availableLength = ( int ) Math . Floor ( ( double ) availableLength / 8 ) * 8 ;
222- // Note that we're using the original record Instance instead of using the FileRecordSegment.NextAttributeInstance
223214 NonResidentAttributeRecord slice = new NonResidentAttributeRecord ( record . AttributeType , record . Name ) ;
224- slice . Instance = record . Instance ;
225215 DataRunSequence dataRuns = record . DataRunSequence ;
226216 long clusterCount = 0 ;
227217 for ( int index = 0 ; index < runIndex ; index ++ )
0 commit comments