public async Task LoadCache() { OpenConnection(); try { if (!Directory.Exists(@"Cache")) { Directory.CreateDirectory(@"Cache"); } var sql = "SELECT * FROM Cache"; var command = new SQLiteCommand(sql, Connection); var reader = command.ExecuteReaderAsync(); while (reader.Result.Read()) { var filename = (string)reader.Result["filename"]; var filecontent = (string)ByteConverters.ByteArrayToObject((byte[])reader.Result["file"]); using (var sw = new StreamWriter(filename)) { await sw.WriteAsync(filecontent); } } } catch (Exception e) { LoggingService.Log(e); } CloseConnection(); }