示例#1
0
 private void SaveMetaInfStorage(MetaInfDataStorage meta)
 {
     _fileStream.Seek(-GetCalculateMetaInfDataStorageSize(), SeekOrigin.End);
     ZeroFormatterSerializer.Serialize(_fileStream, meta);
     metaInfDataStorage = LoadMetaInfStorage();
     writeCount++;
 }
示例#2
0
        public TableFileManager(FileStream fs_, Table table, int blockSize)
        {
            _fileStream         = fs_;
            using var memStream = new MemoryStream();
            ZeroFormatterSerializer.Serialize(memStream, table.TableMetaInf);
            var metaInfStorage = new MetaInfDataStorage {
                TableMetaInfSize = (int)memStream.Length, RowRecordSize = CalculateRowRecordSize(table), DataBlockSize = blockSize, HeadDataBlockList = 0, HeadFreeBlockList = 0
            };

            memStream.WriteTo(_fileStream);
            CreateMetaInfInEnd(metaInfStorage);
            metaInfDataStorage = LoadMetaInfStorage();
        }
示例#3
0
        private static int GetCalculateMetaInfDataStorageSize()
        {
            using var memStream = new MemoryStream();

            var dataBlock = new MetaInfDataStorage
            {
                DataBlockSize     = int.MaxValue,
                RowRecordSize     = int.MaxValue,
                HeadDataBlockList = int.MaxValue,
                HeadFreeBlockList = int.MaxValue,
                TableMetaInfSize  = int.MaxValue
            };

            ZeroFormatterSerializer.Serialize(memStream, dataBlock);

            return((int)memStream.Length);
        }
示例#4
0
 private void CreateMetaInfInEnd(MetaInfDataStorage meta)
 {
     _fileStream.Seek(0, SeekOrigin.End);
     ZeroFormatterSerializer.Serialize(_fileStream, meta);
     metaInfDataStorage = LoadMetaInfStorage();
 }
示例#5
0
 public TableFileManager(FileStream fileStream)
 {
     _fileStream        = fileStream;
     metaInfDataStorage = LoadMetaInfStorage();
 }