change sqllite libary

This commit is contained in:
Li 2022-07-17 23:45:12 +12:00
parent 6627ca5dc4
commit 41a6038527
7 changed files with 25 additions and 14 deletions

View file

@ -23,9 +23,6 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="6.0.7" />
</ItemGroup>
<PropertyGroup> <PropertyGroup>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>false</GenerateBindingRedirectsOutputType> <GenerateBindingRedirectsOutputType>false</GenerateBindingRedirectsOutputType>

View file

@ -1,5 +1,5 @@
Package: hisp Package: hisp
Version: 1.7.90 Version: 1.7.91
Depends: coreutils,systemd,mariadb-server,libsqlite3-dev,zlib1g-dev,libicu-dev,libkrb5-dev Depends: coreutils,systemd,mariadb-server,libsqlite3-dev,zlib1g-dev,libicu-dev,libkrb5-dev
Maintainer: Li Maintainer: Li
Homepage: https://islehorse.com Homepage: https://islehorse.com

View file

@ -28,7 +28,7 @@
</ContentWithTargetPath> </ContentWithTargetPath>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="6.0.7" /> <PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.7" />
<PackageReference Include="MySqlConnector" Version="2.1.11" /> <PackageReference Include="MySqlConnector" Version="2.1.11" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup> </ItemGroup>

View file

@ -30,5 +30,5 @@ using System.Runtime.InteropServices;
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("1.7.90.0")] [assembly: AssemblyVersion("1.7.91.0")]
[assembly: AssemblyFileVersion("1.7.90.0")] [assembly: AssemblyFileVersion("1.7.91.0")]

View file

@ -13,6 +13,7 @@ using HISP.Game.SwfModules;
using MySqlConnector; using MySqlConnector;
using Microsoft.Data.Sqlite; using Microsoft.Data.Sqlite;
using SQLitePCL;
namespace HISP.Server namespace HISP.Server
{ {
@ -67,11 +68,16 @@ namespace HISP.Server
public static void OpenDatabase() public static void OpenDatabase()
{ {
if (!ConfigReader.SqlLite) if (!ConfigReader.SqlLite)
{
ConnectionString = "server=" + ConfigReader.DatabaseIP + ";user=" + ConfigReader.DatabaseUsername + ";password=" + ConfigReader.DatabasePassword + ";database=" + ConfigReader.DatabaseName; ConnectionString = "server=" + ConfigReader.DatabaseIP + ";user=" + ConfigReader.DatabaseUsername + ";password=" + ConfigReader.DatabasePassword + ";database=" + ConfigReader.DatabaseName;
else
ConnectionString = "Data Source=\"" + ConfigReader.DatabaseName + ".db\";";
DataFixerUpper.FixUpDb(); }
else
{
ConnectionString = "Data Source=\"" + ConfigReader.DatabaseName + ".db\";";
Batteries.Init();
}
using (DbConnection db = connectDb()) using (DbConnection db = connectDb())
{ {
@ -128,6 +134,7 @@ namespace HISP.Server
if (ConfigReader.SqlLite) if (ConfigReader.SqlLite)
{ {
try try
{ {
DbCommand sqlCommand = db.CreateCommand(); DbCommand sqlCommand = db.CreateCommand();
@ -624,6 +631,7 @@ namespace HISP.Server
}; };
} }
DataFixerUpper.FixUpDb();
} }
public static void DeleteRanchOwner(int ranchId) public static void DeleteRanchOwner(int ranchId)

View file

@ -109,7 +109,13 @@ namespace HISP.Noobs
ConfigReader.SqlLite = true; ConfigReader.SqlLite = true;
ConfigReader.LogLevel = 0; ConfigReader.LogLevel = 0;
ConfigReader.CrossDomainPolicyFile = Path.Combine(BaseDir, "CrossDomainPolicy.xml"); ConfigReader.CrossDomainPolicyFile = Path.Combine(BaseDir, "CrossDomainPolicy.xml");
ConfigReader.DatabaseName = Path.Combine(BaseDir, "game1.db");
// Compatibility patch
if (File.Exists(Path.Combine(BaseDir, "game1.db.db"))) {
File.Move(Path.Combine(BaseDir, "game1.db.db"), Path.Combine(BaseDir, "game1.db"));
}
ConfigReader.DatabaseName = Path.Combine(BaseDir, "game1");
IncrementProgress(); IncrementProgress();
@ -175,7 +181,7 @@ namespace HISP.Noobs
} }
catch (Exception e) catch (Exception e)
{ {
MessageBox.Show("Horse Isle server failed to start: " + e.Message, "Error starting web server", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Horse Isle server failed to start: " + e.Message, "Error starting hi1 server", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
IncrementProgress(); IncrementProgress();

View file

@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.90.0")] [assembly: AssemblyVersion("1.7.91.0")]
[assembly: AssemblyFileVersion("1.7.90.0")] [assembly: AssemblyFileVersion("1.7.91.0")]