예제 #1
0
        protected string getRequest(out int assignedID)
        {
            int newID = ID;

            assignedID = newID;

            Action <JsonWriter> addData = delegate(JsonWriter writer) {
                writer.WritePropertyName("type");
                writer.WriteValue(Type);
                writer.WritePropertyName("id");
                writer.WriteValue(newID);
                writer.WritePropertyName("content");
                writer.WriteStartObject();
                writer.WritePropertyName("device");
                writer.WriteValue(Device);
                writer.WritePropertyName("action");
                writer.WriteValue(Action);
                writer.WritePropertyName("parameters");
                writer.WriteStartArray();
                if (ParamStrings.Count > 0)
                {
                    foreach (string param in ParamStrings)
                    {
                        writer.WriteValue(param);
                    }
                }
                else
                {
                    foreach (int param in ParamInt)
                    {
                        writer.WriteValue(param);
                    }
                }
                writer.WriteEndArray();
                writer.WriteEndObject();
            };

            string result = JSONUtilities.getJSON(addData);

            return(result);
        }