Beispiel #1
0
        private static void TestVFS()
        {
            var vfs = FileEx.FindVfs(null);

            VirtualFileSystem.OPEN flagOut = 0;
            VirtualFile            file    = new VirtualFile();
            var rc = FileEx.OsOpen(vfs, @"Test", file, VirtualFileSystem.OPEN.CREATE, ref flagOut);
        }
Beispiel #2
0
        private static void TestPager()
        {
            var vfs   = FileEx.FindVfs(null);
            var pager = Open(vfs);

            if (pager == null)
            {
                throw new Exception();
            }
            var rc = pager.SharedLock();

            if (rc != RC.OK)
            {
                throw new Exception();
            }
            //
            PgHdr p = null;

            rc = pager.Get(1, ref p, 0);
            if (rc != RC.OK)
            {
                throw new Exception();
            }
            rc = pager.Begin(false, false);
            if (rc != RC.OK)
            {
                throw new Exception();
            }
            Array.Copy(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, p.Data, 10);
            Pager.Write(p);
            pager.CommitPhaseOne(null, false);
            pager.CommitPhaseTwo();
            //
            if (pager != null)
            {
                pager.Close();
            }
        }