Version 4.12.2 Added SQLiteCache

This commit is contained in:
ClemensF 2019-07-18 23:08:10 +02:00
parent 85287118a5
commit 0c023abbcf
11 changed files with 755 additions and 8 deletions

View file

@ -49,11 +49,6 @@ namespace MapControl.MBTiles
return tileData;
}
public void Close()
{
connection.Close();
}
public void Dispose()
{
connection.Dispose();

View file

@ -53,7 +53,7 @@
<EmbeddedResource Include="Properties\MBTiles.UWP.rd.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.SQLite">
<PackageReference Include="Microsoft.Data.Sqlite">
<Version>2.2.6</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">

View file

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2036
# Visual Studio Version 16
VisualStudioVersion = 16.0.29102.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MapControl", "MapControl", "{52AECE49-F314-4F76-98F2-FA800F07824B}"
EndProject
@ -39,14 +39,22 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapImages.WPF", "MapImages\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapImages.UWP", "MapImages\UWP\MapImages.UWP.csproj", "{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SQLiteCache", "SQLiteCache", "{96FD1258-1597-48A2-8D64-1ADAE13E886A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLiteCache.UWP", "SQLiteCache\UWP\SQLiteCache.UWP.csproj", "{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLiteCache.WPF", "SQLiteCache\WPF\SQLiteCache.WPF.csproj", "{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
@ -55,6 +63,8 @@ Global
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|ARM.ActiveCfg = Debug|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|ARM.Build.0 = Debug|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|ARM64.Build.0 = Debug|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|x64.ActiveCfg = Debug|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|x64.Build.0 = Debug|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -63,6 +73,8 @@ Global
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|Any CPU.Build.0 = Release|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|ARM.ActiveCfg = Release|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|ARM.Build.0 = Release|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|ARM64.ActiveCfg = Release|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|ARM64.Build.0 = Release|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|x64.ActiveCfg = Release|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|x64.Build.0 = Release|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|x86.ActiveCfg = Release|Any CPU
@ -73,6 +85,7 @@ Global
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|ARM.ActiveCfg = Debug|ARM
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|ARM.Build.0 = Debug|ARM
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|ARM.Deploy.0 = Debug|ARM
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|ARM64.ActiveCfg = Debug|x86
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x64.ActiveCfg = Debug|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x64.Build.0 = Debug|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x64.Deploy.0 = Debug|x64
@ -85,6 +98,7 @@ Global
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|ARM.ActiveCfg = Release|ARM
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|ARM.Build.0 = Release|ARM
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|ARM.Deploy.0 = Release|ARM
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|ARM64.ActiveCfg = Release|x86
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x64.ActiveCfg = Release|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x64.Build.0 = Release|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x64.Deploy.0 = Release|x64
@ -95,6 +109,8 @@ Global
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Debug|ARM.ActiveCfg = Debug|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Debug|ARM.Build.0 = Debug|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Debug|ARM64.Build.0 = Debug|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Debug|x64.ActiveCfg = Debug|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Debug|x64.Build.0 = Debug|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -103,6 +119,8 @@ Global
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Release|Any CPU.Build.0 = Release|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Release|ARM.ActiveCfg = Release|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Release|ARM.Build.0 = Release|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Release|ARM64.ActiveCfg = Release|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Release|ARM64.Build.0 = Release|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Release|x64.ActiveCfg = Release|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Release|x64.Build.0 = Release|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Release|x86.ActiveCfg = Release|Any CPU
@ -111,6 +129,8 @@ Global
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|ARM.ActiveCfg = Debug|Any CPU
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|ARM.Build.0 = Debug|Any CPU
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|ARM64.Build.0 = Debug|Any CPU
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|x64.ActiveCfg = Debug|Any CPU
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|x64.Build.0 = Debug|Any CPU
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -119,6 +139,8 @@ Global
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|Any CPU.Build.0 = Release|Any CPU
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|ARM.ActiveCfg = Release|Any CPU
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|ARM.Build.0 = Release|Any CPU
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|ARM64.ActiveCfg = Release|Any CPU
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|ARM64.Build.0 = Release|Any CPU
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|x64.ActiveCfg = Release|Any CPU
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|x64.Build.0 = Release|Any CPU
{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|x86.ActiveCfg = Release|Any CPU
@ -127,6 +149,8 @@ Global
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Debug|ARM.ActiveCfg = Debug|Any CPU
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Debug|ARM.Build.0 = Debug|Any CPU
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Debug|ARM64.Build.0 = Debug|Any CPU
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Debug|x64.ActiveCfg = Debug|Any CPU
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Debug|x64.Build.0 = Debug|Any CPU
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -135,6 +159,8 @@ Global
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Release|Any CPU.Build.0 = Release|Any CPU
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Release|ARM.ActiveCfg = Release|Any CPU
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Release|ARM.Build.0 = Release|Any CPU
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Release|ARM64.ActiveCfg = Release|Any CPU
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Release|ARM64.Build.0 = Release|Any CPU
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Release|x64.ActiveCfg = Release|Any CPU
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Release|x64.Build.0 = Release|Any CPU
{BEEB142A-5FA3-468D-810A-32A4A5BD6D5D}.Release|x86.ActiveCfg = Release|Any CPU
@ -143,6 +169,8 @@ Global
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|ARM.ActiveCfg = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|ARM.Build.0 = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|ARM64.Build.0 = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|x64.ActiveCfg = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|x64.Build.0 = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -151,6 +179,8 @@ Global
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|Any CPU.Build.0 = Release|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|ARM.ActiveCfg = Release|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|ARM.Build.0 = Release|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|ARM64.ActiveCfg = Release|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|ARM64.Build.0 = Release|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|x64.ActiveCfg = Release|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|x64.Build.0 = Release|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|x86.ActiveCfg = Release|Any CPU
@ -159,6 +189,8 @@ Global
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Debug|ARM.ActiveCfg = Debug|Any CPU
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Debug|ARM.Build.0 = Debug|Any CPU
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Debug|ARM64.Build.0 = Debug|Any CPU
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Debug|x64.ActiveCfg = Debug|Any CPU
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Debug|x64.Build.0 = Debug|Any CPU
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -167,6 +199,8 @@ Global
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Release|Any CPU.Build.0 = Release|Any CPU
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Release|ARM.ActiveCfg = Release|Any CPU
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Release|ARM.Build.0 = Release|Any CPU
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Release|ARM64.ActiveCfg = Release|Any CPU
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Release|ARM64.Build.0 = Release|Any CPU
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Release|x64.ActiveCfg = Release|Any CPU
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Release|x64.Build.0 = Release|Any CPU
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}.Release|x86.ActiveCfg = Release|Any CPU
@ -175,6 +209,8 @@ Global
{426C21C0-5F14-491F-BCD1-6D2993510420}.Debug|Any CPU.Build.0 = Debug|Any CPU
{426C21C0-5F14-491F-BCD1-6D2993510420}.Debug|ARM.ActiveCfg = Debug|Any CPU
{426C21C0-5F14-491F-BCD1-6D2993510420}.Debug|ARM.Build.0 = Debug|Any CPU
{426C21C0-5F14-491F-BCD1-6D2993510420}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{426C21C0-5F14-491F-BCD1-6D2993510420}.Debug|ARM64.Build.0 = Debug|Any CPU
{426C21C0-5F14-491F-BCD1-6D2993510420}.Debug|x64.ActiveCfg = Debug|Any CPU
{426C21C0-5F14-491F-BCD1-6D2993510420}.Debug|x64.Build.0 = Debug|Any CPU
{426C21C0-5F14-491F-BCD1-6D2993510420}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -183,6 +219,8 @@ Global
{426C21C0-5F14-491F-BCD1-6D2993510420}.Release|Any CPU.Build.0 = Release|Any CPU
{426C21C0-5F14-491F-BCD1-6D2993510420}.Release|ARM.ActiveCfg = Release|Any CPU
{426C21C0-5F14-491F-BCD1-6D2993510420}.Release|ARM.Build.0 = Release|Any CPU
{426C21C0-5F14-491F-BCD1-6D2993510420}.Release|ARM64.ActiveCfg = Release|Any CPU
{426C21C0-5F14-491F-BCD1-6D2993510420}.Release|ARM64.Build.0 = Release|Any CPU
{426C21C0-5F14-491F-BCD1-6D2993510420}.Release|x64.ActiveCfg = Release|Any CPU
{426C21C0-5F14-491F-BCD1-6D2993510420}.Release|x64.Build.0 = Release|Any CPU
{426C21C0-5F14-491F-BCD1-6D2993510420}.Release|x86.ActiveCfg = Release|Any CPU
@ -191,6 +229,8 @@ Global
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|ARM.ActiveCfg = Debug|Any CPU
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|ARM.Build.0 = Debug|Any CPU
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|ARM64.Build.0 = Debug|Any CPU
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|x64.ActiveCfg = Debug|Any CPU
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|x64.Build.0 = Debug|Any CPU
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -199,6 +239,8 @@ Global
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|Any CPU.Build.0 = Release|Any CPU
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|ARM.ActiveCfg = Release|Any CPU
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|ARM.Build.0 = Release|Any CPU
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|ARM64.ActiveCfg = Release|Any CPU
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|ARM64.Build.0 = Release|Any CPU
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|x64.ActiveCfg = Release|Any CPU
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|x64.Build.0 = Release|Any CPU
{F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|x86.ActiveCfg = Release|Any CPU
@ -207,6 +249,8 @@ Global
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Debug|ARM.ActiveCfg = Debug|Any CPU
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Debug|ARM.Build.0 = Debug|Any CPU
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Debug|ARM64.Build.0 = Debug|Any CPU
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Debug|x64.ActiveCfg = Debug|Any CPU
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Debug|x64.Build.0 = Debug|Any CPU
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -215,6 +259,8 @@ Global
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Release|Any CPU.Build.0 = Release|Any CPU
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Release|ARM.ActiveCfg = Release|Any CPU
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Release|ARM.Build.0 = Release|Any CPU
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Release|ARM64.ActiveCfg = Release|Any CPU
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Release|ARM64.Build.0 = Release|Any CPU
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Release|x64.ActiveCfg = Release|Any CPU
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Release|x64.Build.0 = Release|Any CPU
{9EE69591-5EDC-45E3-893E-2F9A4B82D538}.Release|x86.ActiveCfg = Release|Any CPU
@ -223,6 +269,8 @@ Global
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Debug|ARM.ActiveCfg = Debug|Any CPU
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Debug|ARM.Build.0 = Debug|Any CPU
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Debug|ARM64.Build.0 = Debug|Any CPU
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Debug|x64.ActiveCfg = Debug|Any CPU
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Debug|x64.Build.0 = Debug|Any CPU
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -231,6 +279,8 @@ Global
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Release|Any CPU.Build.0 = Release|Any CPU
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Release|ARM.ActiveCfg = Release|Any CPU
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Release|ARM.Build.0 = Release|Any CPU
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Release|ARM64.ActiveCfg = Release|Any CPU
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Release|ARM64.Build.0 = Release|Any CPU
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Release|x64.ActiveCfg = Release|Any CPU
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Release|x64.Build.0 = Release|Any CPU
{52042F63-563A-45BB-9A08-A8635AAAB84C}.Release|x86.ActiveCfg = Release|Any CPU
@ -239,6 +289,8 @@ Global
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Debug|ARM.ActiveCfg = Debug|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Debug|ARM.Build.0 = Debug|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Debug|ARM64.Build.0 = Debug|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Debug|x64.ActiveCfg = Debug|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Debug|x64.Build.0 = Debug|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -247,10 +299,52 @@ Global
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Release|Any CPU.Build.0 = Release|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Release|ARM.ActiveCfg = Release|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Release|ARM.Build.0 = Release|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Release|ARM64.ActiveCfg = Release|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Release|ARM64.Build.0 = Release|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Release|x64.ActiveCfg = Release|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Release|x64.Build.0 = Release|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Release|x86.ActiveCfg = Release|Any CPU
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372}.Release|x86.Build.0 = Release|Any CPU
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Debug|ARM.ActiveCfg = Debug|ARM
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Debug|ARM.Build.0 = Debug|ARM
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Debug|ARM64.ActiveCfg = Debug|ARM64
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Debug|ARM64.Build.0 = Debug|ARM64
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Debug|x64.ActiveCfg = Debug|x64
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Debug|x64.Build.0 = Debug|x64
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Debug|x86.ActiveCfg = Debug|x86
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Debug|x86.Build.0 = Debug|x86
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Release|Any CPU.Build.0 = Release|Any CPU
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Release|ARM.ActiveCfg = Release|ARM
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Release|ARM.Build.0 = Release|ARM
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Release|ARM64.ActiveCfg = Release|ARM64
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Release|ARM64.Build.0 = Release|ARM64
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Release|x64.ActiveCfg = Release|x64
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Release|x64.Build.0 = Release|x64
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Release|x86.ActiveCfg = Release|x86
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}.Release|x86.Build.0 = Release|x86
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Debug|ARM.ActiveCfg = Debug|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Debug|ARM.Build.0 = Debug|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Debug|ARM64.Build.0 = Debug|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Debug|x64.ActiveCfg = Debug|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Debug|x64.Build.0 = Debug|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Debug|x86.ActiveCfg = Debug|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Debug|x86.Build.0 = Debug|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Release|Any CPU.Build.0 = Release|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Release|ARM.ActiveCfg = Release|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Release|ARM.Build.0 = Release|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Release|ARM64.ActiveCfg = Release|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Release|ARM64.Build.0 = Release|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Release|x64.ActiveCfg = Release|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Release|x64.Build.0 = Release|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Release|x86.ActiveCfg = Release|Any CPU
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -268,6 +362,8 @@ Global
{9EE69591-5EDC-45E3-893E-2F9A4B82D538} = {7BC11E28-8D3B-4C5B-AC08-AB249CC95F6D}
{52042F63-563A-45BB-9A08-A8635AAAB84C} = {2FDC8B91-FB95-4C57-8183-63587FBFE180}
{BE08B7BC-8C89-4837-BCE7-EDDDABEAB372} = {2FDC8B91-FB95-4C57-8183-63587FBFE180}
{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1} = {96FD1258-1597-48A2-8D64-1ADAE13E886A}
{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349} = {96FD1258-1597-48A2-8D64-1ADAE13E886A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {458346DD-B23F-4FDC-8F9D-A10F1882A4DB}

View file

@ -0,0 +1,14 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("XAML Map Control SQLiteCache (UWP)")]
[assembly: AssemblyDescription("IImageCache implementation based on SQLite")]
[assembly: AssemblyProduct("XAML Map Control")]
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2019 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("4.12.2")]
[assembly: AssemblyFileVersion("4.12.2")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains Runtime Directives, specifications about types your application accesses
through reflection and other dynamic code patterns. Runtime Directives are used to control the
.NET Native optimizer and ensure that it does not remove code accessed by your library. If your
library does not do any reflection, then you generally do not need to edit this file. However,
if your library reflects over types, especially types passed to it or derived from its types,
then you should write Runtime Directives.
The most common use of reflection in libraries is to discover information about types passed
to the library. Runtime Directives have three ways to express requirements on types passed to
your library.
1. Parameter, GenericParameter, TypeParameter, TypeEnumerableParameter
Use these directives to reflect over types passed as a parameter.
2. SubTypes
Use a SubTypes directive to reflect over types derived from another type.
3. AttributeImplies
Use an AttributeImplies directive to indicate that your library needs to reflect over
types or methods decorated with an attribute.
For more information on writing Runtime Directives for libraries, please visit
https://go.microsoft.com/fwlink/?LinkID=391919
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Library Name="SQLiteCache.UWP">
<!-- add directives for your library here -->
</Library>
</Directives>

View file

@ -0,0 +1,163 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{56DFA7CF-F31D-45CE-9C36-DA8DBB8413B1}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MapControl.Caching</RootNamespace>
<AssemblyName>SQLiteCache.UWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<PlatformTarget>ARM</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<PlatformTarget>ARM</PlatformTarget>
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
<PlatformTarget>ARM64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
<PlatformTarget>ARM64</PlatformTarget>
<OutputPath>bin\ARM64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SQLiteCache.cs" />
<EmbeddedResource Include="Properties\SQLiteCache.UWP.rd.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite">
<Version>2.2.6</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.8</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\MapControl.snk">
<Link>MapControl.snk</Link>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MapControl\UWP\MapControl.UWP.csproj">
<Project>{9545f73c-9c35-4cf6-baae-19a0baebd344}</Project>
<Name>MapControl.UWP</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\MapControl.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,95 @@
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// © 2019 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using Microsoft.Data.Sqlite;
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using Windows.Storage;
using Windows.Storage.Streams;
namespace MapControl.Caching
{
/// <summary>
/// IImageCache implementation based on SqLite.
/// </summary>
public sealed class SQLiteCache : IImageCache, IDisposable
{
private readonly SqliteConnection connection;
public SQLiteCache(StorageFolder folder, string fileName = "TileCache.sqlite")
{
if (folder == null)
{
throw new ArgumentNullException("The parameter folder must not be null.");
}
if (string.IsNullOrEmpty(fileName))
{
throw new ArgumentNullException("The parameter fileName must not be null.");
}
connection = new SqliteConnection("Data Source=" + Path.Combine(folder.Path, fileName));
connection.Open();
using (var command = new SqliteCommand("create table if not exists items (key text, expiration integer, buffer blob)", connection))
{
command.ExecuteNonQuery();
}
}
public void Dispose()
{
connection.Dispose();
}
public async Task<ImageCacheItem> GetAsync(string key)
{
try
{
using (var command = new SqliteCommand("select expiration, buffer from items where key=@key", connection))
{
command.Parameters.AddWithValue("@key", key);
var reader = await command.ExecuteReaderAsync();
if (reader.Read())
{
return new ImageCacheItem
{
Expiration = new DateTime((long)reader["expiration"]),
Buffer = ((byte[])reader["buffer"]).AsBuffer()
};
}
}
}
catch (Exception ex)
{
Debug.WriteLine("SqLiteCache: GetAsync(\"{0}\"): {1}", key, ex.Message);
}
return null;
}
public async Task SetAsync(string key, IBuffer buffer, DateTime expiration)
{
try
{
using (var command = new SqliteCommand("insert or replace into items (key, expiration, buffer) values (@key, @exp, @buf)", connection))
{
command.Parameters.AddWithValue("@key", key);
command.Parameters.AddWithValue("@exp", expiration.Ticks);
command.Parameters.AddWithValue("@buf", buffer.ToArray());
await command.ExecuteNonQueryAsync();
}
}
catch (Exception ex)
{
Debug.WriteLine("SqLiteCache: SetAsync(\"{0}\"): {1}", key, ex.Message);
}
}
}
}

View file

@ -0,0 +1,14 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("XAML Map Control SQLiteCache (WPF)")]
[assembly: AssemblyDescription("ObjectCache implementation based on SQLite")]
[assembly: AssemblyProduct("XAML Map Control")]
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2019 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("4.12.2")]
[assembly: AssemblyFileVersion("4.12.2")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

View file

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0109C2F0-BA2C-420F-B2CA-DB5B29B1A349}</ProjectGuid>
<OutputType>library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MapControl.Caching</RootNamespace>
<AssemblyName>SQLiteCache.WPF</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\MapControl.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.SQLite, Version=1.0.111.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Data.SQLite.Core.1.0.111.0\lib\net46\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Caching" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<AppDesigner Include="Properties\" />
<Compile Include="SQLiteCache.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\MapControl.snk">
<Link>MapControl.snk</Link>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MapControl\WPF\MapControl.WPF.csproj">
<Project>{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}</Project>
<Name>MapControl.WPF</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\System.Data.SQLite.Core.1.0.111.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\..\packages\System.Data.SQLite.Core.1.0.111.0\build\net46\System.Data.SQLite.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\System.Data.SQLite.Core.1.0.111.0\build\net46\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\System.Data.SQLite.Core.1.0.111.0\build\net46\System.Data.SQLite.Core.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,248 @@
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// © 2019 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.Caching;
namespace MapControl.Caching
{
/// <summary>
/// ObjectCache implementation based on SqLite.
/// </summary>
public sealed class SQLiteCache : ObjectCache, IDisposable
{
private readonly SQLiteConnection connection;
public SQLiteCache(string path)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentException("The parameter path must not be null or empty.");
}
if (string.IsNullOrEmpty(Path.GetExtension(path)))
{
path = Path.Combine(path, "TileCache.sqlite");
}
connection = new SQLiteConnection("Data Source=" + Path.GetFullPath(path));
connection.Open();
using (var command = new SQLiteCommand("create table if not exists items (key text, expiration integer, buffer blob)", connection))
{
command.ExecuteNonQuery();
}
}
public override string Name
{
get { return string.Empty; }
}
public override DefaultCacheCapabilities DefaultCacheCapabilities
{
get { return DefaultCacheCapabilities.AbsoluteExpirations | DefaultCacheCapabilities.SlidingExpirations; }
}
public override object this[string key]
{
get { return Get(key); }
set { Set(key, value, null); }
}
protected override IEnumerator<KeyValuePair<string, object>> GetEnumerator()
{
throw new NotSupportedException("SqLiteCache does not support the ability to enumerate items.");
}
public override CacheEntryChangeMonitor CreateCacheEntryChangeMonitor(IEnumerable<string> keys, string regionName = null)
{
throw new NotSupportedException("SqLiteCache does not support the ability to create change monitors.");
}
public override long GetCount(string regionName = null)
{
if (regionName != null)
{
throw new NotSupportedException("The parameter regionName must be null.");
}
try
{
using (var command = new SQLiteCommand("select count(*) from items", connection))
{
return (long)command.ExecuteScalar();
}
}
catch (Exception ex)
{
Debug.WriteLine("SqLiteCache: GetCount(): {0}", ex.Message);
}
return 0;
}
public override bool Contains(string key, string regionName = null)
{
if (key == null)
{
throw new ArgumentNullException("The parameter key must not be null.");
}
if (regionName != null)
{
throw new NotSupportedException("The parameter regionName must be null.");
}
try
{
using (var command = new SQLiteCommand("select expiration, buffer from items where key=@key", connection))
{
command.Parameters.AddWithValue("@key", key);
return command.ExecuteReader().Read();
}
}
catch (Exception ex)
{
Debug.WriteLine("SqLiteCache: Get(\"{0}\"): {1}", key, ex.Message);
}
return false;
}
public override object Get(string key, string regionName = null)
{
if (key == null)
{
throw new ArgumentNullException("The parameter key must not be null.");
}
if (regionName != null)
{
throw new NotSupportedException("The parameter regionName must be null.");
}
try
{
using (var command = new SQLiteCommand("select expiration, buffer from items where key=@key", connection))
{
command.Parameters.AddWithValue("@key", key);
var reader = command.ExecuteReader();
if (reader.Read())
{
return new ImageCacheItem
{
Expiration = new DateTime((long)reader["expiration"]),
Buffer = (byte[])reader["buffer"]
};
}
}
}
catch (Exception ex)
{
Debug.WriteLine("SqLiteCache: Get(\"{0}\"): {1}", key, ex.Message);
}
return null;
}
public override CacheItem GetCacheItem(string key, string regionName = null)
{
var value = Get(key, regionName);
return value != null ? new CacheItem(key, value) : null;
}
public override IDictionary<string, object> GetValues(IEnumerable<string> keys, string regionName = null)
{
return keys.ToDictionary(key => key, key => Get(key, regionName));
}
public override void Set(string key, object value, CacheItemPolicy policy, string regionName = null)
{
if (key == null)
{
throw new ArgumentNullException("The parameter key must not be null.");
}
if (regionName != null)
{
throw new NotSupportedException("The parameter regionName must be null.");
}
var imageCacheItem = value as ImageCacheItem;
if (imageCacheItem == null || imageCacheItem.Buffer == null || imageCacheItem.Buffer.Length == 0)
{
throw new NotSupportedException("The parameter value must be an ImageCacheItem with a non-empty Buffer.");
}
try
{
using (var command = new SQLiteCommand("insert or replace into items (key, expiration, buffer) values (@key, @exp, @buf)", connection))
{
command.Parameters.AddWithValue("@key", key);
command.Parameters.AddWithValue("@exp", imageCacheItem.Expiration.Ticks);
command.Parameters.AddWithValue("@buf", imageCacheItem.Buffer);
command.ExecuteNonQuery();
}
}
catch (Exception ex)
{
Debug.WriteLine("SqLiteCache: Set(\"{0}\"): {1}", key, ex.Message);
}
}
public override void Set(string key, object value, DateTimeOffset absoluteExpiration, string regionName = null)
{
Set(key, value, new CacheItemPolicy { AbsoluteExpiration = absoluteExpiration }, regionName);
}
public override void Set(CacheItem item, CacheItemPolicy policy)
{
Set(item.Key, item.Value, policy, item.RegionName);
}
public override object AddOrGetExisting(string key, object value, CacheItemPolicy policy, string regionName = null)
{
var oldValue = Get(key, regionName);
Set(key, value, policy);
return oldValue;
}
public override object AddOrGetExisting(string key, object value, DateTimeOffset absoluteExpiration, string regionName = null)
{
return AddOrGetExisting(key, value, new CacheItemPolicy { AbsoluteExpiration = absoluteExpiration }, regionName);
}
public override CacheItem AddOrGetExisting(CacheItem item, CacheItemPolicy policy)
{
var oldItem = GetCacheItem(item.Key, item.RegionName);
Set(item, policy);
return oldItem;
}
public override object Remove(string key, string regionName = null)
{
throw new NotImplementedException();
}
public void Dispose()
{
connection.Dispose();
}
}
}

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.Data.SQLite.Core" version="1.0.111.0" targetFramework="net48" />
</packages>