Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/tuyanet.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2021-10-28 22:32:19 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2021-10-28 22:32:19 +0300
commit166034b06b29bc21376338aadbb4406782b53bbb (patch)
tree22c14739caf10b1e7eb88959937c6e39033b56dc /TuyaParser.cs
parenta28b63890583fc63e806ec95f5cf572db73660bf (diff)
Downgraded to .NET Standard 2.0 for better compatibility
Diffstat (limited to 'TuyaParser.cs')
-rw-r--r--TuyaParser.cs7
1 files changed, 6 insertions, 1 deletions
diff --git a/TuyaParser.cs b/TuyaParser.cs
index 8930454..8e22b19 100644
--- a/TuyaParser.cs
+++ b/TuyaParser.cs
@@ -1,4 +1,5 @@
-using System;
+using Newtonsoft.Json.Linq;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -57,6 +58,10 @@ namespace com.clusterrr.TuyaNet
internal static byte[] CreatePayload(TuyaCommand command, string json, byte[] key, TuyaProtocolVersion protocolVersion = TuyaProtocolVersion.V33)
{
+ // Remove spaces and newlines
+ var root = JObject.Parse(json);
+ json = root.ToString(Newtonsoft.Json.Formatting.None);
+
byte[] payload = Encoding.UTF8.GetBytes(json);
if (protocolVersion == TuyaProtocolVersion.V33)