예제 #1
0
 protected void NewVersion(bool clearFixed = false, bool clearAll = false)
 {
     if (_data == null)
     {
         Allocate(_descriptor.InitialSize, true);
         MemoryAllocator.SetTypeIdentifierOf(_data, _descriptor.TypeIdentifier);
         if (!clearAll && clearFixed)
         {
             MemoryHelper.Fill(_data, 0x00, _descriptor.FixedPartLenght);
         }
         else if (clearAll)
         {
             MemoryHelper.Fill(_data, 0x00, MemoryAllocator.SizeOf(_data));
         }
         for (int i = 0; i < _descriptor.VariablePartCount; i++)
         {
             ArrayRecords[i] = new InBlockArrayRecord()
             {
                 Lenght = 0, Offset = _descriptor.InitialSize
             }
         }
         ;
     }
     else
     {
         var header = ((BlockHeader *)(_data - BlockHeader.SIZE));
         if (header->ReferenceCount > 1)
         {
             var tmp = MemoryHelper.Clone(_data, false);
             Force(tmp);
         }
     }
 }