private static PhotoFingerPrintDatabase LoadDatabase(string path) { if (File.Exists(path) == false) { throw new ArgumentException(); } using (var memoryStream = new MemoryStream()) using (var reader = new BinaryReader(File.Open(path, FileMode.Open))) { var buffer = new byte[DefaultBufferSize]; int count = 0; while ((count = reader.Read(buffer, 0, buffer.Length)) != 0) { memoryStream.Write(buffer, 0, count); } return(PhotoFingerPrintDatabase.GetRootAsPhotoFingerPrintDatabase(new ByteBuffer(memoryStream.ToArray()))); } }
/// <summary> /// Load a FlatBuffer database of video fingerprints using raw bytes /// </summary> /// <param name="rawBytes">The raws bytes of the database</param> /// <returns>A loaded database</returns> public static PhotoFingerPrintDatabaseWrapper Load(byte[] rawBytes) { return(Convert(PhotoFingerPrintDatabase.GetRootAsPhotoFingerPrintDatabase(new ByteBuffer(rawBytes)))); }