private void Events() { if (_devices != null) { Logger.Log(LogMsgType.INFO, "Events started!", LogAuthor.Adapter); foreach (var device in _devices) { if (device.Events == null) { continue; } if (device.Properties == null) { string json_response = clp_connection.GetCLPObject(clp_user, CLPtokenToString(), device.AUID); CLP_Parameters clp_parameters = new CLP_Parameters(); clp_parameters.Parse(json_response); device.Properties = clp_parameters.GetParams(device.AUID); } Thread thread = new Thread(() => EventCheck(device)); thread.IsBackground = true; thread.Start(); _eventThreads?.Add(thread); } } }
private bool ArePropertiesSet(CLP_Connection clp_connection, string clp_user, string clp_token, string clp_auid, Dictionary <string, string> props) { string json_response = clp_connection.GetCLPObject(clp_user, clp_token, clp_auid); CLP_Parameters clp_parameters = new CLP_Parameters(); clp_parameters.Parse(json_response); Dictionary <string, string> dict = clp_parameters.GetParams(clp_auid); foreach (KeyValuePair <string, string> item in props) { if (!dict.ContainsKey(item.Key)) { return(false); } if (!dict[item.Key].ToUpper().Equals(item.Value.ToUpper())) { return(false); } } return(true); }