Пример #1
0
        public static DatabaseFile LoadFile(string path)
        {
            //Open and create
            FileStream   file   = new FileStream(path, FileMode.Open);
            DatabaseFile dbFile = new DatabaseFile(file);

            //Read header
            dbFile.ReadHeader();

            return(dbFile);
        }
Пример #2
0
        public static DatabaseFile CreateFile(string path, int pageSize = 512)
        {
            //Open and create
            FileStream   file   = new FileStream(path, FileMode.Create);
            DatabaseFile dbFile = new DatabaseFile(file);

            //Write header
            dbFile.WriteInt32ToStream(FILE_SIN);
            dbFile.WriteInt32ToStream(1);
            dbFile.WriteInt32ToStream(pageSize);
            dbFile.WriteInt32ToStream(dbFile.GetCurrentUtcEpoch());
            dbFile.WriteInt64ToStream(0);

            //Open to fully generate
            dbFile.ReadHeader();

            return(dbFile);
        }