Beispiel #1
0
        private JSON getFieldsValuesJsonObject()
        {
            JSON root = new JSON();

            PropertyInfo[] properties = this.GetType().GetProperties();

            foreach (var p in properties)
            {
                ColibrySerializeHelper.getProperty(this, p, root, p.Name);
            }
            return(root);
        }
Beispiel #2
0
        // serialize this class to JSON
        virtual public JSON ToJSON()
        {
            JSON root = new JSON();

            PropertyInfo[] properties = this.GetType().GetProperties();

            foreach (var p in properties)
            {
                if (p.Name == "id")
                {
                    if (id == null)
                    {
                        continue;
                    }
                }
                ColibrySerializeHelper.getProperty(this, p, root, p.Name);
            }
            return(root);
        }
Beispiel #3
0
        public JSON unsetValue(string fieldname)
        {
            var propertyInfo = this.GetType().GetProperty(fieldname);

            if (propertyInfo != null)
            {
                propertyInfo.SetValue(this, null, null);
                JSON root       = new JSON();
                JSON roottosend = new JSON();

                ColibrySerializeHelper.getProperty(this, propertyInfo, root, propertyInfo.Name);
                roottosend["field"] = fieldname;
                roottosend["value"] = root[propertyInfo.Name];
                return(roottosend);
            }
            else
            {
                Debug.Log("No such property " + fieldname);
                return(null);
            }
        }
Beispiel #4
0
        public void setValue(SDKCorePluginCustomCallbackDelegate fp, string fieldname, object fieldvalue)
        {
            var propertyInfo = this.GetType().GetProperty(fieldname);

            if (propertyInfo != null)
            {
                propertyInfo.SetValue(this, fieldvalue, null);
                JSON root       = new JSON();
                JSON roottosend = new JSON();

                ColibrySerializeHelper.getProperty(this, propertyInfo, root, propertyInfo.Name);
                roottosend["field"] = fieldname;
                roottosend["value"] = root[propertyInfo.Name];

                string stringToSend = roottosend.serialized;
                SDKCorePlugin.SDKCorePluginSendRequest(ColibryUserRequestSigns.SET_VALUE, ColibryUserCmds.SET_VALUE, stringToSend, sdkResponse, fp);
            }
            else
            {
                Debug.Log("No such property " + fieldname);
            }
        }