I have the below 2 functions for reading data from existing SQLite DB and it works correct, but my questions is how can I read from the existing Protected SQLite DB with Password?
private string GetSQLiteDBPath()
{
return Path.Combine(DB_PATH, DB_NAME);
}
public override SQLiteDatabase WritableDatabase
{
get
{
return CreateSQLiteDB();
}
}
private SQLiteDatabase CreateSQLiteDB()
{
SQLiteDatabase sqliteDB = null;
string path = GetSQLiteDBPath();
Stream streamSQLite = null;
FileStream streamWriter = null;
Boolean isSQLiteInit = false;
try
{
if (File.Exists(path))
isSQLiteInit = true;
else
{
streamSQLite = context.Resources.OpenRawResource(Resource.Raw.DBStore);
streamWriter = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write);
if (streamSQLite != null && streamWriter != null)
{
if (CopySQLiteDB(streamSQLite, streamWriter))
isSQLiteInit = true;
}
}
if (isSQLiteInit)
sqliteDB = SQLiteDatabase.OpenDatabase(path, null, DatabaseOpenFlags.OpenReadonly);
}
catch { }
return sqliteDB;
}