From 1e311904cc122ae4df90a3332f94866f3efe4b66 Mon Sep 17 00:00:00 2001 From: striche Date: Sat, 4 Feb 2023 16:35:15 -0600 Subject: [PATCH] Addressed issues where users on Windows 10 and Windows 11 were having issues running running the project. 1) Updated all projects to .NET Framework 4.7.2. This was a necessary prerequisite for the core fix. 2) The core fix is to upgrade the version of MySql.Data to address an error when opening connections. There is some kind of nuget issue with updating to the latest version (8.0.32) so fell back to updating to version 8.0.31. This also causes the addition of several all dependant libraries. Opted to just keep those at whatever version was specified by MySql.Data for now. 3) With the upgrade to MySql.Data, there is a behavioral change with the way the .Prepare statemenet works, and now it's required that parameters be added BEFORE calling .Prepare. So I've maded adjustments to the calls to .Prepare. --- Common Class Lib/Common Class Lib.csproj | 39 +++++++++++++++++-- Common Class Lib/app.config | 20 ++++++---- Common Class Lib/packages.config | 11 +++++- Lobby Server/Database.cs | 31 +++++++-------- Lobby Server/Lobby Server.csproj | 42 ++++++++++++++++++--- Lobby Server/app.config | 20 ++++++---- Lobby Server/packages.config | 11 +++++- Map Server/App.config | 13 +++---- Map Server/Database.cs | 4 +- Map Server/Map Server.csproj | 39 +++++++++++++++++-- Map Server/Properties/Resources.Designer.cs | 2 +- Map Server/Utils/SQLGeneration.cs | 15 +++----- Map Server/packages.config | 11 +++++- World Server/App.config | 20 ++++++---- World Server/World Server.csproj | 42 ++++++++++++++++++--- World Server/packages.config | 11 +++++- 16 files changed, 251 insertions(+), 80 deletions(-) diff --git a/Common Class Lib/Common Class Lib.csproj b/Common Class Lib/Common Class Lib.csproj index 1462cb50..db309f0a 100644 --- a/Common Class Lib/Common Class Lib.csproj +++ b/Common Class Lib/Common Class Lib.csproj @@ -10,7 +10,7 @@ Properties Meteor.Common Meteor.Common - v4.5.1 + v4.7.2 512 @@ -59,21 +59,49 @@ MinimumRecommendedRules.ruleset + + ..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll + ..\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll - - ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll - True + + ..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll + + + ..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll + + + ..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll + + + ..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll + + + ..\packages\MySql.Data.8.0.31\lib\net452\MySql.Data.dll ..\packages\NLog.4.5.0\lib\net45\NLog.dll + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll + @@ -83,6 +111,9 @@ + + ..\packages\MySql.Data.8.0.31\lib\net452\ZstdNet.dll + diff --git a/Common Class Lib/app.config b/Common Class Lib/app.config index 14a5fe96..06edd341 100644 --- a/Common Class Lib/app.config +++ b/Common Class Lib/app.config @@ -1,9 +1,13 @@ - + - - - - - - - + + + + + + + + + + + diff --git a/Common Class Lib/packages.config b/Common Class Lib/packages.config index 9a3092a2..947a3aab 100644 --- a/Common Class Lib/packages.config +++ b/Common Class Lib/packages.config @@ -1,6 +1,15 @@  - + + + + + + + + + + \ No newline at end of file diff --git a/Lobby Server/Database.cs b/Lobby Server/Database.cs index ad4641f3..902123ad 100644 --- a/Lobby Server/Database.cs +++ b/Lobby Server/Database.cs @@ -105,21 +105,21 @@ namespace Meteor.Lobby MySqlCommand cmd2 = new MySqlCommand(); cmd2.Connection = conn; cmd2.CommandText = "UPDATE characters SET serverId = @serverId, name = @name WHERE id = @cid"; - cmd2.Prepare(); cmd2.Parameters.AddWithValue("@serverId", serverId); cmd2.Parameters.AddWithValue("@name", name); cmd2.Parameters.AddWithValue("@cid", cid); + cmd2.Prepare(); cmd2.ExecuteNonQuery(); } else //Reserve { MySqlCommand cmd2 = new MySqlCommand(); cmd2.Connection = conn; cmd2.CommandText = "INSERT INTO characters(userId, slot, serverId, name, state) VALUES(@userId, @slot, @serverId, @name, 0)"; - cmd2.Prepare(); cmd2.Parameters.AddWithValue("@userId", userId); cmd2.Parameters.AddWithValue("@slot", slot); cmd2.Parameters.AddWithValue("@serverId", serverId); cmd2.Parameters.AddWithValue("@name", name); + cmd2.Prepare(); cmd2.ExecuteNonQuery(); cid = (ushort)cmd2.LastInsertedId; pid = 0xBABE; @@ -234,13 +234,17 @@ namespace Meteor.Lobby { MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; - cmd.CommandText = String.Format("INSERT INTO characters_class_levels(characterId, {0}) VALUES(@characterId, 1); INSERT INTO characters_class_exp(characterId) VALUES(@characterId)", CharacterCreatorUtils.GetClassNameForId((short)charaInfo.currentClass)); - cmd.Prepare(); - + cmd.CommandText = String.Format("INSERT INTO characters_class_levels(characterId, {0}) VALUES(@characterId, 1);", CharacterCreatorUtils.GetClassNameForId((short)charaInfo.currentClass)); cmd.Parameters.AddWithValue("@characterId", cid); - + cmd.Prepare(); cmd.ExecuteNonQuery(); + MySqlCommand cmd2 = new MySqlCommand(); + cmd.Connection = conn; + cmd.CommandText = String.Format("INSERT INTO characters_class_exp(characterId) VALUES(@characterId2)"); + cmd.Parameters.AddWithValue("@characterId2", cid); + cmd.Prepare(); + cmd.ExecuteNonQuery(); } catch (MySqlException e) { @@ -256,11 +260,9 @@ namespace Meteor.Lobby MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = String.Format("INSERT INTO characters_parametersave(characterId, hp, hpMax, mp, mpMax, mainSkill, mainSkillLevel) VALUES(@characterId, 1900, 1000, 115, 115, @mainSkill, 1);", CharacterCreatorUtils.GetClassNameForId((short)charaInfo.currentClass)); - cmd.Prepare(); - cmd.Parameters.AddWithValue("@characterId", cid); cmd.Parameters.AddWithValue("@mainSkill", charaInfo.currentClass); - + cmd.Prepare(); cmd.ExecuteNonQuery(); } @@ -277,9 +279,8 @@ namespace Meteor.Lobby MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = "SELECT id FROM server_battle_commands WHERE classJob = @classjob AND lvl = 1 ORDER BY id DESC"; - cmd.Prepare(); - cmd.Parameters.AddWithValue("@classJob", charaInfo.currentClass); + cmd.Prepare(); List defaultActions = new List(); using (var reader = cmd.ExecuteReader()) { @@ -291,16 +292,16 @@ namespace Meteor.Lobby MySqlCommand cmd2 = new MySqlCommand(); cmd2.Connection = conn; cmd2.CommandText = "INSERT INTO characters_hotbar (characterId, classId, hotbarSlot, commandId, recastTime) VALUES (@characterId, @classId, @hotbarSlot, @commandId, 0)"; - cmd2.Prepare(); cmd2.Parameters.AddWithValue("@characterId", cid); cmd2.Parameters.AddWithValue("@classId", charaInfo.currentClass); cmd2.Parameters.Add("@hotbarSlot", MySqlDbType.Int16); cmd2.Parameters.Add("@commandId", MySqlDbType.Int16); - for(int i = 0; i < defaultActions.Count; i++) + for (int i = 0; i < defaultActions.Count; i++) { cmd2.Parameters["@hotbarSlot"].Value = i; cmd2.Parameters["@commandId"].Value = defaultActions[i]; + cmd2.Prepare(); cmd2.ExecuteNonQuery(); } } @@ -340,10 +341,10 @@ namespace Meteor.Lobby cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = "UPDATE characters SET name=@name, DoRename=0 WHERE id=@cid AND userId=@uid"; - cmd.Prepare(); cmd.Parameters.AddWithValue("@uid", userId); cmd.Parameters.AddWithValue("@cid", characterId); cmd.Parameters.AddWithValue("@name", newName); + cmd.Prepare(); cmd.ExecuteNonQuery(); } @@ -374,9 +375,9 @@ namespace Meteor.Lobby MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = "UPDATE characters SET state=1 WHERE id=@cid AND name=@name"; - cmd.Prepare(); cmd.Parameters.AddWithValue("@cid", characterId); cmd.Parameters.AddWithValue("@name", name); + cmd.Prepare(); cmd.ExecuteNonQuery(); } diff --git a/Lobby Server/Lobby Server.csproj b/Lobby Server/Lobby Server.csproj index d40acfe1..ad30f80b 100644 --- a/Lobby Server/Lobby Server.csproj +++ b/Lobby Server/Lobby Server.csproj @@ -10,7 +10,7 @@ Properties Meteor.Lobby Lobby Server - v4.5.1 + v4.7.2 512 false cc1ba6f5 @@ -74,20 +74,49 @@ true + + ..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll + ..\packages\Cyotek.CircularBuffer.1.0.0.0\lib\net20\Cyotek.Collections.Generic.CircularBuffer.dll - - ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll - True + + ..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll + + + ..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll + + + ..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll + + + ..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll + + + ..\packages\MySql.Data.8.0.31\lib\net452\MySql.Data.dll ..\packages\NLog.4.5.0\lib\net45\NLog.dll + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll + @@ -96,6 +125,9 @@ + + ..\packages\MySql.Data.8.0.31\lib\net452\ZstdNet.dll + @@ -172,4 +204,4 @@ --> - + \ No newline at end of file diff --git a/Lobby Server/app.config b/Lobby Server/app.config index 14a5fe96..06edd341 100644 --- a/Lobby Server/app.config +++ b/Lobby Server/app.config @@ -1,9 +1,13 @@ - + - - - - - - - + + + + + + + + + + + diff --git a/Lobby Server/packages.config b/Lobby Server/packages.config index 85557fa0..17770642 100644 --- a/Lobby Server/packages.config +++ b/Lobby Server/packages.config @@ -1,7 +1,16 @@  + + + + - + + + + + + \ No newline at end of file diff --git a/Map Server/App.config b/Map Server/App.config index 34d13d4d..e103d5a3 100644 --- a/Map Server/App.config +++ b/Map Server/App.config @@ -1,20 +1,19 @@  - + - - - - - - + + + + + diff --git a/Map Server/Database.cs b/Map Server/Database.cs index 75508b70..61f19319 100644 --- a/Map Server/Database.cs +++ b/Map Server/Database.cs @@ -2596,10 +2596,10 @@ namespace Meteor.Map characterId = @characterId", CharacterUtils.GetClassNameForId(classId)); MySqlCommand cmd = new MySqlCommand(query, conn); - cmd.Prepare(); cmd = new MySqlCommand(query, conn); cmd.Parameters.AddWithValue("@characterId", player.actorId); cmd.Parameters.AddWithValue("@exp", exp); + cmd.Prepare(); cmd.ExecuteNonQuery(); } catch (MySqlException e) @@ -2629,10 +2629,10 @@ namespace Meteor.Map characterId = @characterId", CharacterUtils.GetClassNameForId(classId)); MySqlCommand cmd = new MySqlCommand(query, conn); - cmd.Prepare(); cmd = new MySqlCommand(query, conn); cmd.Parameters.AddWithValue("@characterId", player.actorId); cmd.Parameters.AddWithValue("@lvl", level); + cmd.Prepare(); cmd.ExecuteNonQuery(); } catch (MySqlException e) diff --git a/Map Server/Map Server.csproj b/Map Server/Map Server.csproj index 8ab70f72..60bf4d50 100644 --- a/Map Server/Map Server.csproj +++ b/Map Server/Map Server.csproj @@ -10,7 +10,7 @@ Properties Meteor.Map Map Server - v4.5.1 + v4.7.2 512 1d22ec4a @@ -63,16 +63,30 @@ true + + ..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll + ..\packages\Cyotek.CircularBuffer.1.0.0.0\lib\net20\Cyotek.Collections.Generic.CircularBuffer.dll True + + ..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll + + + ..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll + + + ..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll + + + ..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll + ..\packages\MoonSharp.1.2.1.0\lib\net40-client\MoonSharp.Interpreter.dll - - ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll - True + + ..\packages\MySql.Data.8.0.31\lib\net452\MySql.Data.dll False @@ -86,10 +100,24 @@ navmesh\SharpNav.dll + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll + @@ -98,6 +126,9 @@ + + ..\packages\MySql.Data.8.0.31\lib\net452\ZstdNet.dll + diff --git a/Map Server/Properties/Resources.Designer.cs b/Map Server/Properties/Resources.Designer.cs index e3920e57..5b32c62a 100644 --- a/Map Server/Properties/Resources.Designer.cs +++ b/Map Server/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Meteor.Map.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { diff --git a/Map Server/Utils/SQLGeneration.cs b/Map Server/Utils/SQLGeneration.cs index bdd0ad16..453e1fb9 100644 --- a/Map Server/Utils/SQLGeneration.cs +++ b/Map Server/Utils/SQLGeneration.cs @@ -51,8 +51,6 @@ namespace Meteor.Map.utils cmd.Parameters.AddWithValue("@id", 100); cmd.Parameters.AddWithValue("@placename", ""); - cmd.Prepare(); - Dictionary placenames = new Dictionary(); string line2; @@ -101,6 +99,7 @@ namespace Meteor.Map.utils cmd.Parameters["@placename"].Value = placenames[pId]; Program.Log.Debug("Wrote: {0}", id); + cmd.Prepare(); cmd.ExecuteNonQuery(); } @@ -133,9 +132,7 @@ namespace Meteor.Map.utils MySqlCommand cmd = new MySqlCommand(query, conn); cmd.Parameters.AddWithValue("@id", 100); cmd.Parameters.AddWithValue("@displayNameId", 100); - - cmd.Prepare(); - + string line, line2; Regex csvSplit = new Regex("(?:^|,)(\"(?:[^\"]+|\"\")*\"|[^,]*)", RegexOptions.Compiled); System.IO.StreamReader file = new System.IO.StreamReader("D:\\Coding\\FFXIV Related\\FFXIV Tool\\2012.09.19.0001.decode.csv\\actorclass.csv"); @@ -159,6 +156,7 @@ namespace Meteor.Map.utils cmd.Parameters["@displayNameId"].Value = nameId; Program.Log.Debug("Wrote: {0} : {1}", id, nameId); + cmd.Prepare(); cmd.ExecuteNonQuery(); } @@ -198,8 +196,6 @@ namespace Meteor.Map.utils for (int i = 0; i < NUMFIELDS; i++) cmd.Parameters.AddWithValue("@v" + i, 100); - cmd.Prepare(); - string line; Regex csvSplit = new Regex("(?:^|,)(\"(?:[^\"]+|\"\")*\"|[^,]*)", RegexOptions.Compiled); //System.IO.StreamReader file = new System.IO.StreamReader("D:\\Coding\\FFXIV Related\\FFXIV Tool\\2012.09.19.0001.decode.csv\\actorclass.csv"); @@ -224,7 +220,8 @@ namespace Meteor.Map.utils cmd.Parameters["@id"].Value = id; - Program.Log.Debug("Wrote: {0}", id); + Program.Log.Debug("Wrote: {0}", id); + cmd.Prepare(); cmd.ExecuteNonQuery(); } @@ -260,7 +257,6 @@ namespace Meteor.Map.utils cmd.Parameters.AddWithValue("@name", "Battle"); cmd.Parameters.AddWithValue("@otherId", 0); cmd.Parameters.AddWithValue("@rewardPoints", 0); - cmd.Prepare(); int otherId = 1; string line, line2; @@ -314,6 +310,7 @@ namespace Meteor.Map.utils cmd.Parameters["@name"].Value = name; cmd.Parameters["@otherId"].Value = otherId; cmd.Parameters["@rewardPoints"].Value = points; + cmd.Prepare(); cmd.ExecuteNonQuery(); otherId++; diff --git a/Map Server/packages.config b/Map Server/packages.config index 41dd95f3..23a02265 100644 --- a/Map Server/packages.config +++ b/Map Server/packages.config @@ -1,9 +1,18 @@  + + + + - + + + + + + \ No newline at end of file diff --git a/World Server/App.config b/World Server/App.config index 0860683f..aa5837b4 100644 --- a/World Server/App.config +++ b/World Server/App.config @@ -1,11 +1,15 @@ - + - + - - - - - - + + + + + + + + + + diff --git a/World Server/World Server.csproj b/World Server/World Server.csproj index c975ca5d..4949df35 100644 --- a/World Server/World Server.csproj +++ b/World Server/World Server.csproj @@ -9,7 +9,7 @@ Properties Meteor.World World Server - v4.5.1 + v4.7.2 512 true @@ -69,21 +69,50 @@ true + + ..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll + ..\packages\Cyotek.CircularBuffer.1.0.0.0\lib\net20\Cyotek.Collections.Generic.CircularBuffer.dll True - - ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll - True + + ..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll + + + ..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll + + + ..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll + + + ..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll + + + ..\packages\MySql.Data.8.0.31\lib\net452\MySql.Data.dll ..\packages\NLog.4.5.0\lib\net45\NLog.dll + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll + @@ -93,6 +122,9 @@ + + ..\packages\MySql.Data.8.0.31\lib\net452\ZstdNet.dll + @@ -218,4 +250,4 @@ --> - + \ No newline at end of file diff --git a/World Server/packages.config b/World Server/packages.config index c7df33be..55a703c3 100644 --- a/World Server/packages.config +++ b/World Server/packages.config @@ -1,6 +1,15 @@  - + + + + + + + + + + \ No newline at end of file