protected override void SetupVariant(int options)
        {
            _encrypted = options == 1;
            C4EncryptionKey  crypto     = new C4EncryptionKey();
            C4EncryptionKey *encryption = null;

            if (_encrypted)
            {
                WriteLine("        ...encrypted");
                crypto.algorithm = C4EncryptionAlgorithm.AES256;
                for (int i = 0; i < 32; i++)
                {
                    crypto.bytes[i] = 0xcc;
                }

                encryption = &crypto;
            }

            _store = (C4BlobStore *)LiteCoreBridge.Check(err => Native.c4blob_openStore(Path.Combine(
                                                                                            Test.TestDir, $"cbl_blob_test{Path.DirectorySeparatorChar}"), C4DatabaseFlags.Create, encryption, err));
            var bogusKey = _bogusKey;

            for (int i = 0; i < C4BlobKey.Size; i++)
            {
                bogusKey.bytes[i] = 0x55;
            }
        }
 public static bool c4blob_create(C4BlobStore *store, byte[] contents, C4BlobKey *expectedKey, C4BlobKey *outKey, C4Error *error)
 {
     fixed(byte *contents_ = contents)
     {
         return(NativeRaw.c4blob_create(store, new C4Slice(contents_, contents == null ? 0 : (ulong)contents.Length), expectedKey, outKey, error));
     }
 }
Ejemplo n.º 3
0
        public static bool c4blob_create(C4BlobStore *store, byte[] content, C4BlobKey *outKey, C4Error *outError)
        {
            fixed(byte *p = content)
            {
                var c4Slice = new C4Slice(p, (ulong)content.Length);

                return(NativeRaw.c4blob_create(store, c4Slice, outKey, outError));
            }
        }
 public C4ReadStream *c4blob_openReadStream(C4BlobStore *store, C4BlobKey key, C4Error *outError) => Native.c4blob_openReadStream(store, key, outError);
 public C4WriteStream *c4blob_openWriteStream(C4BlobStore *store, C4Error *outError) => Native.c4blob_openWriteStream(store, outError);
 public static string c4blob_getFilePath(C4BlobStore *store, C4BlobKey key, C4Error *outError)
 {
     using (var retVal = NativeRaw.c4blob_getFilePath(store, key, outError)) {
         return(((C4Slice)retVal).CreateString());
     }
 }
 public static bool c4blob_create(C4BlobStore *store, FLSlice contents, C4BlobKey *expectedKey, C4BlobKey *outKey, C4Error *error) => Impl.c4blob_create(store, contents, expectedKey, outKey, error);
 public static extern bool c4blob_create(C4BlobStore *store, C4Slice contents, C4BlobKey *expectedKey, C4BlobKey *outKey, C4Error *error);
 public static extern long c4blob_getSize(C4BlobStore *store, C4BlobKey key);
Ejemplo n.º 10
0
 public void c4blob_freeStore(C4BlobStore *store) => Native.c4blob_freeStore(store);
 public static extern C4SliceResult c4blob_getContents(C4BlobStore *store, C4BlobKey key, C4Error *outError);
Ejemplo n.º 12
0
 public C4SliceResult c4blob_getContents(C4BlobStore *store, C4BlobKey key, C4Error *outError) => NativeRaw.c4blob_getContents(store, key, outError);
Ejemplo n.º 13
0
 public C4SliceResult c4blob_getFilePath(C4BlobStore *store, C4BlobKey key, C4Error *outError) => NativeRaw.c4blob_getFilePath(store, key, outError);
 public static C4WriteStream *c4blob_openWriteStream(C4BlobStore *store, C4Error *outError) => Impl.c4blob_openWriteStream(store, outError);
 public static bool c4blob_delete(C4BlobStore *store, C4BlobKey key, C4Error *outError) => Impl.c4blob_delete(store, key, outError);
 public static long c4blob_getSize(C4BlobStore *store, C4BlobKey key) => Impl.c4blob_getSize(store, key);
 public static FLSliceResult c4blob_getContents(C4BlobStore *store, C4BlobKey key, C4Error *outError) => Impl.c4blob_getContents(store, key, outError);
Ejemplo n.º 18
0
 public long c4blob_getSize(C4BlobStore *store, C4BlobKey key) => Native.c4blob_getSize(store, key);
 public static extern C4WriteStream *c4blob_openWriteStream(C4BlobStore *store, C4Error *outError);
Ejemplo n.º 20
0
 public byte[] c4blob_getContents(C4BlobStore *store, C4BlobKey key, C4Error *outError) => Native.c4blob_getContents(store, key, outError);
 public static extern C4SliceResult c4blob_getFilePath(C4BlobStore *store, C4BlobKey key, C4Error *outError);
Ejemplo n.º 22
0
 public string c4blob_getFilePath(C4BlobStore *store, C4BlobKey key, C4Error *outError) => Native.c4blob_getFilePath(store, key, outError);
 public static extern void c4blob_freeStore(C4BlobStore *store);
 public static extern bool c4blob_delete(C4BlobStore *store, C4BlobKey key, C4Error *outError);
 public static byte[] c4blob_getContents(C4BlobStore *store, C4BlobKey key, C4Error *outError)
 {
     using (var retVal = NativeRaw.c4blob_getContents(store, key, outError)) {
         return(((C4Slice)retVal).ToArrayFast());
     }
 }
 public static void c4blob_freeStore(C4BlobStore *store) => Impl.c4blob_freeStore(store);
Ejemplo n.º 27
0
 public bool c4blob_create(C4BlobStore *store, byte[] contents, C4BlobKey *expectedKey, C4BlobKey *outKey, C4Error *error) => Native.c4blob_create(store, contents, expectedKey, outKey, error);
 public static FLSliceResult c4blob_getFilePath(C4BlobStore *store, C4BlobKey key, C4Error *outError) => Impl.c4blob_getFilePath(store, key, outError);
 public static extern C4ReadStream *c4blob_openReadStream(C4BlobStore *store, C4BlobKey key, C4Error *outError);
Ejemplo n.º 30
0
 public bool c4blob_delete(C4BlobStore *store, C4BlobKey key, C4Error *outError) => Native.c4blob_delete(store, key, outError);