From 41a603852708f1912aa24dea97ec5032849a83a3 Mon Sep 17 00:00:00 2001 From: Li Date: Sun, 17 Jul 2022 23:45:12 +1200 Subject: [PATCH] change sqllite libary --- HorseIsleServer/HISPd/HISPd.csproj | 3 --- HorseIsleServer/HISPd/Resources/DEBIAN/control | 2 +- HorseIsleServer/LibHISP/LibHISP.csproj | 2 +- HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs | 4 ++-- HorseIsleServer/LibHISP/Server/Database.cs | 14 +++++++++++--- HorseIsleServer/N00BS/Program.cs | 10 ++++++++-- HorseIsleServer/N00BS/Properties/AssemblyInfo.cs | 4 ++-- 7 files changed, 25 insertions(+), 14 deletions(-) diff --git a/HorseIsleServer/HISPd/HISPd.csproj b/HorseIsleServer/HISPd/HISPd.csproj index 9c21a54..21bbc33 100644 --- a/HorseIsleServer/HISPd/HISPd.csproj +++ b/HorseIsleServer/HISPd/HISPd.csproj @@ -23,9 +23,6 @@ Resources.Designer.cs - - - false false diff --git a/HorseIsleServer/HISPd/Resources/DEBIAN/control b/HorseIsleServer/HISPd/Resources/DEBIAN/control index 3bbd834..c2c6703 100644 --- a/HorseIsleServer/HISPd/Resources/DEBIAN/control +++ b/HorseIsleServer/HISPd/Resources/DEBIAN/control @@ -1,5 +1,5 @@ Package: hisp -Version: 1.7.90 +Version: 1.7.91 Depends: coreutils,systemd,mariadb-server,libsqlite3-dev,zlib1g-dev,libicu-dev,libkrb5-dev Maintainer: Li Homepage: https://islehorse.com diff --git a/HorseIsleServer/LibHISP/LibHISP.csproj b/HorseIsleServer/LibHISP/LibHISP.csproj index ded0f51..f51ed87 100644 --- a/HorseIsleServer/LibHISP/LibHISP.csproj +++ b/HorseIsleServer/LibHISP/LibHISP.csproj @@ -28,7 +28,7 @@ - + diff --git a/HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs b/HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs index 22be50d..7f46dfd 100644 --- a/HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs +++ b/HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs @@ -30,5 +30,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.7.90.0")] -[assembly: AssemblyFileVersion("1.7.90.0")] +[assembly: AssemblyVersion("1.7.91.0")] +[assembly: AssemblyFileVersion("1.7.91.0")] diff --git a/HorseIsleServer/LibHISP/Server/Database.cs b/HorseIsleServer/LibHISP/Server/Database.cs index 9e0a6c7..675055c 100644 --- a/HorseIsleServer/LibHISP/Server/Database.cs +++ b/HorseIsleServer/LibHISP/Server/Database.cs @@ -13,6 +13,7 @@ using HISP.Game.SwfModules; using MySqlConnector; using Microsoft.Data.Sqlite; +using SQLitePCL; namespace HISP.Server { @@ -67,11 +68,16 @@ namespace HISP.Server public static void OpenDatabase() { if (!ConfigReader.SqlLite) + { 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()) { @@ -128,6 +134,7 @@ namespace HISP.Server if (ConfigReader.SqlLite) { + try { DbCommand sqlCommand = db.CreateCommand(); @@ -624,6 +631,7 @@ namespace HISP.Server }; } + DataFixerUpper.FixUpDb(); } public static void DeleteRanchOwner(int ranchId) diff --git a/HorseIsleServer/N00BS/Program.cs b/HorseIsleServer/N00BS/Program.cs index c593c24..462df67 100644 --- a/HorseIsleServer/N00BS/Program.cs +++ b/HorseIsleServer/N00BS/Program.cs @@ -109,7 +109,13 @@ namespace HISP.Noobs ConfigReader.SqlLite = true; ConfigReader.LogLevel = 0; 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(); @@ -175,7 +181,7 @@ namespace HISP.Noobs } 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; } IncrementProgress(); diff --git a/HorseIsleServer/N00BS/Properties/AssemblyInfo.cs b/HorseIsleServer/N00BS/Properties/AssemblyInfo.cs index c62df16..d864f9f 100644 --- a/HorseIsleServer/N00BS/Properties/AssemblyInfo.cs +++ b/HorseIsleServer/N00BS/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.7.90.0")] -[assembly: AssemblyFileVersion("1.7.90.0")] +[assembly: AssemblyVersion("1.7.91.0")] +[assembly: AssemblyFileVersion("1.7.91.0")]