Commit bab10d75 authored by Kirill's avatar Kirill

System.Data.SQLite 1.0.109.2

parent bd519fc6
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
</system.data></configuration>
\ No newline at end of file
...@@ -7,6 +7,9 @@ namespace TourDataManager { ...@@ -7,6 +7,9 @@ namespace TourDataManager {
public class Authenticator : IAuthenticator { public class Authenticator : IAuthenticator {
private readonly Uri authUri = new Uri("https://biganto.com/users/login/?client=desktopplayer&client_version=3.0&v=2.0"); private readonly Uri authUri = new Uri("https://biganto.com/users/login/?client=desktopplayer&client_version=3.0&v=2.0");
// HttpClient создан с ссылкой на HttpClientHandler,
// который в свою очередь использует CookieContainer от CookieStorage.
// Таким образом Authenticator предоставляет куки системе.
[Inject] public HttpClient HttpClient{ get; set; } [Inject] public HttpClient HttpClient{ get; set; }
public async void Login(string email, string password, Action<bool, string> continuation = null){ public async void Login(string email, string password, Action<bool, string> continuation = null){
......
using System;
using System.Data.SQLite;
using System.IO;
namespace TourDataManager {
public class DbTest {
public DbTest(string databasePath){
if(!File.Exists(databasePath)) SQLiteConnection.CreateFile(databasePath);
SQLiteConnection m_dbConnection;
try{
m_dbConnection = new SQLiteConnection($"Data Source={databasePath};Version=3;");
m_dbConnection.Open();
} catch (Exception e){
Console.WriteLine(e);
throw;
}
string sql = "create table highscores (name varchar(20), score int)";
var command = new SQLiteCommand(sql, m_dbConnection);
command.ExecuteNonQuery();
//Fill
sql = "insert into highscores (name, score) values ('Me', 3000)";
command = new SQLiteCommand(sql, m_dbConnection);
command.ExecuteNonQuery();
sql = "insert into highscores (name, score) values ('Myself', 6000)";
command = new SQLiteCommand(sql, m_dbConnection);
command.ExecuteNonQuery();
sql = "insert into highscores (name, score) values ('And I', 9001)";
command = new SQLiteCommand(sql, m_dbConnection);
command.ExecuteNonQuery();
sql = "select * from highscores order by score desc";
command = new SQLiteCommand(sql, m_dbConnection);
SQLiteDataReader reader = command.ExecuteReader();
while (reader.Read())
Debug.Log("Name: " + reader["name"] + "\tScore: " + reader["score"]);
}
}
}
\ No newline at end of file
using System;
using System.IO;
using System.Net.Http; using System.Net.Http;
using Ninject; using Ninject;
using Ninject.Modules; using Ninject.Modules;
...@@ -11,6 +13,14 @@ namespace TourDataManager { ...@@ -11,6 +13,14 @@ namespace TourDataManager {
public TourDataManager(string persistentPath){ public TourDataManager(string persistentPath){
this.persistentPath = persistentPath; this.persistentPath = persistentPath;
Environment.CurrentDirectory =
Environment.GetEnvironmentVariable("windir") ?? throw new Exception("Ай!");
DirectoryInfo info = new DirectoryInfo(".");
Console.WriteLine("Directory Info: " + info.FullName);
Container = new StandardKernel(new MyModule(persistentPath)); Container = new StandardKernel(new MyModule(persistentPath));
} }
...@@ -33,7 +43,7 @@ namespace TourDataManager { ...@@ -33,7 +43,7 @@ namespace TourDataManager {
} }
public override void Load(){ public override void Load(){
var cookieStorage = new CookieStorage(persistentPath + "\\cookie.storage"); var cookieStorage = new CookieStorage("\\cookie.storage");
var httpClientHandler = new HttpClientHandler(); var httpClientHandler = new HttpClientHandler();
//CookieContainer сам запоминает полученные из ответа куки //CookieContainer сам запоминает полученные из ответа куки
httpClientHandler.CookieContainer = cookieStorage.Get(); httpClientHandler.CookieContainer = cookieStorage.Get();
......
...@@ -33,6 +33,14 @@ ...@@ -33,6 +33,14 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="mscorlib" /> <Reference Include="mscorlib" />
<Reference Include="Ninject, Version=3.3.4.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7"> <Reference Include="Ninject, Version=3.3.4.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7">
<HintPath>..\packages\Ninject.3.3.4\lib\net45\Ninject.dll</HintPath> <HintPath>..\packages\Ninject.3.3.4\lib\net45\Ninject.dll</HintPath>
...@@ -40,8 +48,21 @@ ...@@ -40,8 +48,21 @@
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" /> <Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Data.SQLite, Version=1.0.109.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139">
<HintPath>..\packages\System.Data.SQLite.Core.1.0.109.2\lib\net46\System.Data.SQLite.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.SQLite.EF6, Version=1.0.109.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139">
<HintPath>..\packages\System.Data.SQLite.EF6.1.0.109.0\lib\net46\System.Data.SQLite.EF6.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.SQLite.Linq, Version=1.0.109.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139">
<HintPath>..\packages\System.Data.SQLite.Linq.1.0.109.0\lib\net46\System.Data.SQLite.Linq.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath> <HintPath>..\packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>
<Private>True</Private> <Private>True</Private>
...@@ -87,22 +108,29 @@ ...@@ -87,22 +108,29 @@
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System.Windows" /> <Reference Include="System.Windows" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" /> <Reference Include="WindowsBase" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Authenticator.cs" /> <Compile Include="Authenticator.cs" />
<Compile Include="CookieStorage.cs" /> <Compile Include="CookieStorage.cs" />
<Compile Include="DbTest.cs" />
<Compile Include="Debug.cs" /> <Compile Include="Debug.cs" />
<Compile Include="IAuthenticator.cs" /> <Compile Include="IAuthenticator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TourDataManager.cs" /> <Compile Include="TourDataManager.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\System.Data.SQLite.Core.1.0.109.2\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.109.2\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. Enable 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.109.2\build\net46\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.109.2\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. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="EntityFramework" version="6.2.0" targetFramework="net472" />
<package id="Ninject" version="3.3.4" targetFramework="net472" /> <package id="Ninject" version="3.3.4" targetFramework="net472" />
<package id="System.Data.SQLite" version="1.0.109.2" targetFramework="net472" />
<package id="System.Data.SQLite.Core" version="1.0.109.2" targetFramework="net472" />
<package id="System.Data.SQLite.EF6" version="1.0.109.0" targetFramework="net472" />
<package id="System.Data.SQLite.Linq" version="1.0.109.0" targetFramework="net472" />
<package id="System.IO" version="4.3.0" targetFramework="net472" /> <package id="System.IO" version="4.3.0" targetFramework="net472" />
<package id="System.Net.Http" version="4.3.3" targetFramework="net472" /> <package id="System.Net.Http" version="4.3.3" targetFramework="net472" />
<package id="System.Reactive" version="4.1.1" targetFramework="net472" /> <package id="System.Reactive" version="4.1.1" targetFramework="net472" />
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
</system.data></configuration>
\ No newline at end of file
using System; using System;
using System.IO;
using TourDataManager; using TourDataManager;
namespace TourDataManagerConsoleApplication { namespace TourDataManagerConsoleApplication {
...@@ -11,18 +12,12 @@ namespace TourDataManagerConsoleApplication { ...@@ -11,18 +12,12 @@ namespace TourDataManagerConsoleApplication {
public static void Main(string[] args){ public static void Main(string[] args){
var tourDataManager = new TourDataManager.TourDataManager(PersistentPath); //var tourDataManager = new TourDataManager.TourDataManager(PersistentPath);
tourDataManager.Login(defaultLogin, defaultPassword); //tourDataManager.Login(defaultLogin, defaultPassword);
new DbTest(Path.Combine(PersistentPath,"desktopplayer.sqlite"));
Console.Read(); Console.Read();
} }
public static async void Login(){
}
} }
} }
\ No newline at end of file
...@@ -33,14 +33,35 @@ ...@@ -33,14 +33,35 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="mscorlib" /> <Reference Include="mscorlib" />
<Reference Include="Ninject, Version=3.3.4.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7"> <Reference Include="Ninject, Version=3.3.4.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7">
<HintPath>..\packages\Ninject.3.3.4\lib\net45\Ninject.dll</HintPath> <HintPath>..\packages\Ninject.3.3.4\lib\net45\Ninject.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Data.SQLite, Version=1.0.109.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139">
<HintPath>..\packages\System.Data.SQLite.Core.1.0.109.2\lib\net46\System.Data.SQLite.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.SQLite.EF6, Version=1.0.109.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139">
<HintPath>..\packages\System.Data.SQLite.EF6.1.0.109.0\lib\net46\System.Data.SQLite.EF6.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.SQLite.Linq, Version=1.0.109.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139">
<HintPath>..\packages\System.Data.SQLite.Linq.1.0.109.0\lib\net46\System.Data.SQLite.Linq.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Reactive, Version=4.1.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263"> <Reference Include="System.Reactive, Version=4.1.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263">
<HintPath>..\packages\System.Reactive.4.1.1\lib\net46\System.Reactive.dll</HintPath> <HintPath>..\packages\System.Reactive.4.1.1\lib\net46\System.Reactive.dll</HintPath>
<Private>True</Private> <Private>True</Private>
...@@ -73,9 +94,17 @@ ...@@ -73,9 +94,17 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\System.Data.SQLite.Core.1.0.109.2\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.109.2\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. Enable 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.109.2\build\net46\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.109.2\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. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="EntityFramework" version="6.2.0" targetFramework="net472" />
<package id="Ninject" version="3.3.4" targetFramework="net472" /> <package id="Ninject" version="3.3.4" targetFramework="net472" />
<package id="System.Data.SQLite" version="1.0.109.2" targetFramework="net472" />
<package id="System.Data.SQLite.Core" version="1.0.109.2" targetFramework="net472" />
<package id="System.Data.SQLite.EF6" version="1.0.109.0" targetFramework="net472" />
<package id="System.Data.SQLite.Linq" version="1.0.109.0" targetFramework="net472" />
<package id="System.Reactive" version="4.1.1" targetFramework="net472" /> <package id="System.Reactive" version="4.1.1" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net472" /> <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.1" targetFramework="net472" /> <package id="System.Threading.Tasks.Extensions" version="4.5.1" targetFramework="net472" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment