public static string Run(object v) { HaxeSerializer s = new HaxeSerializer(); s.Serialize(v); return(s.mResultStringBuilder.ToString()); }
public int SendRequest(ExpandoObject parameters) { if (parameters == null) { parameters = new ExpandoObject(); } parameters["_requestID"] = ++mRequestId; if (DebugEnabled) { //#if DEBUG Debug.Log($"[SnipeClient] [{ConnectionId}] SendRequest " + parameters.ToJSONString()); //#endif } // mTcpClient.Connected property gets the connection state of the Socket as of the LAST I/O operation (not current state!) // (http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.connected.aspx) // So we need to check the connection availability manually, and here is where we can do it if (this.Connected) { if (!mClientKeySent && !string.IsNullOrEmpty(ClientKey)) { parameters["clientKey"] = ClientKey; mClientKeySent = true; if (!string.IsNullOrEmpty(mAppInfo)) { parameters["appInfo"] = mAppInfo; } } ResetHeartbeatTime(); if (mTCPClient != null) { string message = HaxeSerializer.Run(parameters); mTCPClient.SendRequest(message); } else if (mWebSocketClient != null) { string message = HaxeSerializer.Run(parameters); mWebSocketClient.SendRequest(message); } } else { CheckConnectionLost(); } return(mRequestId); }
public static string Run(object v) { HaxeSerializer s = new HaxeSerializer(); s.Serialize(v); return s.mResultStringBuilder.ToString(); }