public static InvokeContext Deserialize(JsonObject json)
        {
            var item = new InvokeContext()
            {
                TraceEnabled = json.GetBooleanValue("TraceEnabled"),
                Trace        = new StringBuilder(json.GetStringValue("Trace")),
            };

            var invokeItemsJson = json.GetJsonArray("InvokeItems");

            if (invokeItemsJson != null)
            {
                item.InvokeItems = InvokeItem.Deserialize(invokeItemsJson);
            }
            return(item);
        }
        public static void Serialize(JsonWriter writer, InvokeContext item, Format format)
        {
            writer.WriteStartObject();

            if (format.TraceEnabled)
            {
                writer.Write("TraceEnabled", item.TraceEnabled);
            }

            if ((format.Trace) && (item.Trace != null))
            {
                writer.Write("Trace", item.Trace.ToString());
            }

            if ((format.InvokeItems != null) && (item.InvokeItems != null))
            {
                writer.WriteName("InvokeItems");
                InvokeItem.Serialize(writer, item.InvokeItems, format.InvokeItems);
            }

            writer.WriteEndObject();
        }
Пример #3
0
        public static void Serialize(JsonWriter writer, InvokeItem item, Format format)
        {
            writer.WriteStartObject();

            if (format.Ready)
            {
                writer.Write("Ready", item.Ready);
            }

            if (format.Completed)
            {
                writer.Write("Completed", item.Completed);
            }

            if (format.TimeoutInSeconds)
            {
                writer.Write("TimeoutInSeconds", item.TimeoutInSeconds);
            }

            if (format.Script)
            {
                writer.Write("Script", item.Script);
            }

            if ((format.Request != null) && (item.Request != null))
            {
                writer.WriteName("Request");
                InvokeRequest.Serialize(writer, item.Request, format.Request);
            }

            if ((format.Response != null) && (item.Response != null))
            {
                writer.WriteName("Response");
                InvokeResponse.Serialize(writer, item.Response, format.Response);
            }

            writer.WriteEndObject();
        }
Пример #4
0
        public static InvokeItem Deserialize(JsonObject json)
        {
            var item = new InvokeItem()
            {
                Ready            = json.GetBooleanValue("Ready"),
                TimeoutInSeconds = json.GetIntValue("TimeoutInSeconds"),
                Script           = json.GetStringValue("Script"),
            };

            var requestJson = json.GetJsonObject("Request");

            if (requestJson != null)
            {
                item.Request = InvokeRequest.Deserialize(requestJson);
            }
            var responseJson = json.GetJsonObject("Response");

            if (responseJson != null)
            {
                item.Response = InvokeResponse.Deserialize(responseJson);
            }
            return(item);
        }