protected sealed override void OnBinary(IContenxt context, FrameRequest frame) { var text = Encoding.UTF8.GetString(frame.Content); //var ip = ((System.Net.IPEndPoint)context.Session.RemoteEndPoint).Address.ToString(); var ip = context.Session.RemoteEndPoint.ToString(); //Debug.Log(text); try { var jsonResult = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(text); var uuid = jsonResult["uuid"].ToString(); if (Globle.WSClients.ContainsKey(uuid)) { Globle.WSClients[uuid].message = text; Globle.WSClients[uuid].result = jsonResult; Globle.WSClients[uuid].lastUpdated = DateTime.Now.Date; } else { var WSC = new WSClientClass(); WSC.ip = ip; WSC.message = text; WSC.uuid = jsonResult["uuid"].ToString(); WSC.result = jsonResult; WSC.lastUpdated = DateTime.Now.Date; WSC.isRemote = false; Globle.WSClients.Add(uuid, WSC); Globle.WSClientsChanged = true; } } catch { } }
protected override void OnBinary(FrameRequest frame) { try { var text = Encoding.UTF8.GetString(frame.Content); //var ip = ((System.Net.IPEndPoint)context.Session.RemoteEndPoint).Address.ToString(); //var ip = context.Session.RemoteEndPoint.ToString(); try { var jsonResult = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(text); var uuid = "USB: " + jsonResult["uuid"].ToString(); if (Globle.WSClients.ContainsKey(uuid)) { Globle.WSClients[uuid].message = text; Globle.WSClients[uuid].result = jsonResult; Globle.WSClients[uuid].lastUpdated = DateTime.Now.Date; } else { var WSC = new WSClientClass(); WSC.ip = "USB"; WSC.message = text; WSC.uuid = jsonResult["uuid"].ToString(); WSC.result = jsonResult; WSC.lastUpdated = DateTime.Now.Date; WSC.isRemote = false; WSC.isUSB = true; Globle.WSClients.Add(uuid, WSC); Globle.WSClientsChanged = true; } } catch { } } catch (Exception ex) { Globle.AddDataLog("USB", Globle.LangController.GetLang("LOG.USBClientException", ex.Message, ex.StackTrace)); } }
protected override void OnBinary(FrameRequest frame) { try { var text = Encoding.UTF8.GetString(frame.Content); var jsonResult = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(text); var ipMessage = jsonResult["ipMessage"]; foreach (JProperty jp in ipMessage) { var ip = ("P2P") + " : " + jp.Name; var request = jp.Value.ToString(); var jsonResultMessage = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(jp.Value.ToString()); if (Globle.WSClients.ContainsKey(ip)) { Globle.WSClients[ip].message = request; Globle.WSClients[ip].result = jsonResultMessage; Globle.WSClients[ip].lastUpdated = DateTime.Now.Date; } else { var WSC = new WSClientClass(); WSC.ip = ip; WSC.message = request; WSC.uuid = jsonResultMessage["uuid"].ToString(); WSC.result = jsonResultMessage; WSC.lastUpdated = DateTime.Now.Date; WSC.isRemote = true; Globle.WSClients.Add(ip, WSC); Globle.WSClientsChanged = true; } } } catch (Exception ex) { Globle.AddDataLog("WSC", Globle.LangController.GetLang("LOG.WSCClientException", ex.Message, ex.StackTrace)); } }