diff --git a/.gitignore b/.gitignore
index 0dafa6e4..1875ccf8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,6 +42,7 @@ Output/Songs
/ClientServerLib/ClientServerLib/ClientServerLib.csproj.user
/ClientServerLib/ClientServerLib/bin/Debug/ClientServerLib.dll
/ClientServerLib/ClientTest/bin/Debug/ClientServerLib.dll
+/ClientServerLib/ClientTest/bin/Release/ClientServerLib.dll
/ClientServerLib/ClientServerLib/bin/ClientServerLib.dll
ClientTest.exe
*.vshost.*
diff --git a/ClientServerLib/ClientServerLib/ClientServerLib.csproj b/ClientServerLib/ClientServerLib/ClientServerLib.csproj
index 8264baeb..f0453376 100644
--- a/ClientServerLib/ClientServerLib/ClientServerLib.csproj
+++ b/ClientServerLib/ClientServerLib/ClientServerLib.csproj
@@ -31,6 +31,10 @@
4
+
+ False
+ bin\Newtonsoft.Json.dll
+
diff --git a/ClientServerLib/ClientServerLib/Vocaluxe/CCommands.cs b/ClientServerLib/ClientServerLib/Vocaluxe/CCommands.cs
index 274d49b0..49e078e1 100644
--- a/ClientServerLib/ClientServerLib/Vocaluxe/CCommands.cs
+++ b/ClientServerLib/ClientServerLib/Vocaluxe/CCommands.cs
@@ -2,16 +2,17 @@
using System.Collections.Generic;
using System.Linq;
using System.IO;
-using System.Runtime.Serialization.Formatters;
-using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Security.Cryptography;
+using Newtonsoft.Json;
namespace Vocaluxe.Base.Server
{
public static class CCommands
{
+ private static UTF8Encoding encoder = new UTF8Encoding();
+
public static SHA256Managed SHA256 = new SHA256Managed();
public const int ResponseOK = 1;
@@ -75,9 +76,8 @@ namespace Vocaluxe.Base.Server
byte[] data;
using (MemoryStream ms = new MemoryStream())
{
- BinaryFormatter formatter = new BinaryFormatter();
- formatter.Serialize(ms, obj);
- data = ms.ToArray();
+ string json = JsonConvert.SerializeObject(obj);
+ data = encoder.GetBytes(json);
}
stream.Write(data, 0, data.Length);
return stream.ToArray();
@@ -99,11 +99,10 @@ namespace Vocaluxe.Base.Server
{
try
{
- BinaryFormatter formatter = new BinaryFormatter();
- obj = (T)formatter.Deserialize(ms);
+ obj = JsonConvert.DeserializeObject(encoder.GetString(data));
return true;
}
- catch (Exception e)
+ catch
{
return false;
}
diff --git a/ClientServerLib/ClientServerLib/Vocaluxe/VocaluxeStructs.cs b/ClientServerLib/ClientServerLib/Vocaluxe/VocaluxeStructs.cs
index 76af669d..3c6eb627 100644
--- a/ClientServerLib/ClientServerLib/Vocaluxe/VocaluxeStructs.cs
+++ b/ClientServerLib/ClientServerLib/Vocaluxe/VocaluxeStructs.cs
@@ -2,7 +2,6 @@
namespace Vocaluxe.Base.Server
{
- [Serializable]
public struct SLoginData
{
public byte[] SHA256;
diff --git a/Output/ClientServerLib.dll b/Output/ClientServerLib.dll
index 13f422d8..2e84f868 100644
Binary files a/Output/ClientServerLib.dll and b/Output/ClientServerLib.dll differ
diff --git a/Output/Newtonsoft.Json.dll b/Output/Newtonsoft.Json.dll
new file mode 100644
index 00000000..a1c39382
Binary files /dev/null and b/Output/Newtonsoft.Json.dll differ