Skip to content

Commit a19e8db

Browse files
committed
JsonConvert Fix
1 parent 3f66ac5 commit a19e8db

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

DatabaseManager.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
using Google.Protobuf;
22
using MySql.Data.MySqlClient;
3+
using Newtonsoft.Json;
34
using Rocket.Core.Logging;
5+
using SDG.Framework.IO.Deserialization;
46
using SDG.Unturned;
57
using Steamworks;
68
using System;
79
using System.Collections.Generic;
810
using System.Linq;
9-
using System.Text.Json;
1011

1112
namespace PlayerInfoLibrary
1213
{
@@ -609,7 +610,7 @@ private string ParseOption(OptionType optionType)
609610

610611
private PlayerData BuildPlayerData(MySqlDataReader reader)
611612
{
612-
return new PlayerData((CSteamID)reader.GetUInt64("SteamID"), reader.GetString("SteamName"), reader.GetString("CharName"), Parser.getIPFromUInt32(reader.GetUInt32("IP")), JsonSerializer.Deserialize<List<string>>(reader.GetString("HWID")), reader.GetInt64("LastLoginGlobal").FromTimeStamp(), reader.GetUInt16("LastServerID"), !reader.IsDBNull("LastServerName") ? reader.GetString("LastServerName") : string.Empty, !reader.IsDBNull("ServerID") ? reader.GetUInt16("ServerID") : (ushort)0, !reader.IsDBNull("LastLoginLocal") ? reader.GetInt64("LastLoginLocal").FromTimeStamp() : (0L).FromTimeStamp(), !reader.IsDBNull("CleanedBuildables") ? reader.GetBoolean("CleanedBuildables") : false, !reader.IsDBNull("CleanedPlayerData") ? reader.GetBoolean("CleanedPlayerData") : false, reader.GetInt32("TotalPlayTime"));
613+
return new PlayerData((CSteamID)reader.GetUInt64("SteamID"), reader.GetString("SteamName"), reader.GetString("CharName"), Parser.getIPFromUInt32(reader.GetUInt32("IP")), JsonConvert.DeserializeObject<List<string>>(reader.GetString("HWID")), reader.GetInt64("LastLoginGlobal").FromTimeStamp(), reader.GetUInt16("LastServerID"), !reader.IsDBNull("LastServerName") ? reader.GetString("LastServerName") : string.Empty, !reader.IsDBNull("ServerID") ? reader.GetUInt16("ServerID") : (ushort)0, !reader.IsDBNull("LastLoginLocal") ? reader.GetInt64("LastLoginLocal").FromTimeStamp() : (0L).FromTimeStamp(), !reader.IsDBNull("CleanedBuildables") ? reader.GetBoolean("CleanedBuildables") : false, !reader.IsDBNull("CleanedPlayerData") ? reader.GetBoolean("CleanedPlayerData") : false, reader.GetInt32("TotalPlayTime"));
613614
}
614615

615616
// Cleanup section.
@@ -787,7 +788,7 @@ internal void SaveToDB(PlayerData pdata, bool retry = false)
787788
command.Parameters.AddWithValue("@steamname", pdata.SteamName.Truncate(200));
788789
command.Parameters.AddWithValue("@charname", pdata.CharacterName.Truncate(200));
789790
command.Parameters.AddWithValue("@ip", Parser.getUInt32FromIP(pdata.IP));
790-
command.Parameters.AddWithValue("@hwid", JsonSerializer.Serialize(pdata.HWID));
791+
command.Parameters.AddWithValue("@hwid", JsonConvert.SerializeObject(pdata.HWID));
791792
command.Parameters.AddWithValue("@instanceid", pdata.ServerID);
792793
command.Parameters.AddWithValue("@lastinstanceid", pdata.LastServerID);
793794
command.Parameters.AddWithValue("@lastloginglobal", pdata.LastLoginGlobal.ToTimeStamp());

PlayerInfoLib.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
<Reference Include="MySql.Data, Version=8.0.28.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
6868
<HintPath>packages\MySql.Data.8.0.28\lib\net48\MySql.Data.dll</HintPath>
6969
</Reference>
70+
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
71+
<SpecificVersion>False</SpecificVersion>
72+
<HintPath>D:\Program Files (x86)\Steam\steamapps\common\U3DS\Unturned_Data\Managed\Newtonsoft.Json.dll</HintPath>
73+
</Reference>
7074
<Reference Include="Rocket.API">
7175
<HintPath>lib\Rocket.API.dll</HintPath>
7276
<Private>False</Private>
@@ -97,7 +101,6 @@
97101
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
98102
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
99103
</Reference>
100-
<Reference Include="System.Text.Json, Version=8.0.0.5, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL" />
101104
<Reference Include="System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
102105
<Reference Include="System.Xml.Linq" />
103106
<Reference Include="System.Data.DataSetExtensions" />

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.4.2.0")]
36-
[assembly: AssemblyFileVersion("1.4.2.0")]
35+
[assembly: AssemblyVersion("1.6.0.0")]
36+
[assembly: AssemblyFileVersion("1.6.0.0")]

0 commit comments

Comments
 (0)