public void Initialize(Logger log, string password) { // get log instance to disk _log = log; // if stream are empty, create header page and save to stream if (_stream.Length == 0) { _log.Write(Logger.DISK, "initialize new datafile"); // create datafile UltraLiteEngine.CreateDatabase(_stream, password); } }
public void Initialize(Logger log, string password) { // get log instance to disk _log = log; _log.Write(Logger.DISK, "open datafile '{0}'", Path.GetFileName(_filename)); // open/create file using read only/exclusive options _stream = this.CreateFileStream(_filename, System.IO.FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); // if file is new, initialize if (_stream.Length == 0) { _log.Write(Logger.DISK, "initialize new datafile"); // create datafile UltraLiteEngine.CreateDatabase(_stream, password, _options.InitialSize); } }