예제 #1
0
 public void Dispose()
 {
     DbDescriptorFileUtility.Write(_descriptorFileStream, _descriptor);
     _descriptorFileStream.Close();
     _indexFileStream.Close();
     _dataFileStream.Close();
     _descriptor = null;
 }
예제 #2
0
        private void InitDescriptor()
        {
            var  descriptorFilePath = string.Join("\\", _directoryPath, "db.descriptor");
            bool exists             = File.Exists(descriptorFilePath);

            _descriptorFileStream = new FileStream(descriptorFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read);
            if (exists)
            {
                _descriptor = DbDescriptorFileUtility.Read(_descriptorFileStream);
            }
            else
            {
                _descriptor = new DbDescriptor();
            }
        }