public async Task <String> DownloadSearchDatabaseAsync() { String dbTargetFile = FilePaths.GetFtsDbFilePath(_config.collectionIdentifier); IonCollection ampCollection = await _ampPages.getCollectionAsync().ConfigureAwait(false); // Load fts db from server and save data to file using (MemoryStream responseStream = await _dataClient.performRequestAsync(ampCollection.fts_db).ConfigureAwait(false)) { await FileUtils.WriteToFile(responseStream, dbTargetFile).ConfigureAwait(false); } return(dbTargetFile); }
public IonFtsImpl(IIonPages ampPages, IIonFiles ampFiles, IonConfig config) { this._ampPages = ampPages; this._ampFiles = ampFiles; this._config = config; // Init the data client _dataClient = new DataClient(config); _ftsQuery = new ResourceLoader("Amp/Resources").GetString("ftsQuery"); String dbFilePath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, FilePaths.GetFtsDbFilePath(_config.collectionIdentifier)); _connection = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), new SQLiteConnectionString(dbFilePath, false, openFlags: SQLite.Net.Interop.SQLiteOpenFlags.ReadOnly))); }