void Open() { const int BUFFER_SIZE = 4096; System.Diagnostics.Debug.WriteLine("Ouverture du fichier {0}.", m_filePath); m_dataFile = new System.IO.FileStream(m_filePath, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite, System.IO.FileShare.Read, BUFFER_SIZE, System.IO.FileOptions.RandomAccess); var tr = new TableReader(m_dataFile); try { Header.Load(tr); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); m_dataFile.Dispose(); m_dataFile = null; throw new CorruptedFileException(m_filePath, innerException: ex); } m_reader = new TableReader(m_dataFile); m_writer = new TableWriter(m_dataFile); }
//private: void Create() { const int BUFFER_SIZE = 4096; System.Diagnostics.Debug.WriteLine("Création de fichier {0}.", m_filePath); m_dataFile = new System.IO.FileStream(m_filePath, System.IO.FileMode.CreateNew, System.IO.FileAccess.ReadWrite, System.IO.FileShare.Read, BUFFER_SIZE, System.IO.FileOptions.RandomAccess); Header.Reset(); var tw = new TableWriter(m_dataFile); Header.Store(tw); m_reader = new TableReader(m_dataFile); m_writer = new TableWriter(m_dataFile); }
//public: public FramedTable(uint id, string name, string filePath) : base(id, name, filePath) { m_insertBuffer = new byte[FrameSize]; m_insertWriter = new TableWriter(new MemoryStream(m_insertBuffer)); }