private static void ExportControl(Control control, JsonWriter writer) { StringWriter innerWriter = new StringWriter(); HtmlTextWriter htmlWriter = GetHtmlWriter(innerWriter); control.RenderControl(htmlWriter); writer.WriteString(innerWriter.ToString()); }
protected virtual void ExportTime(DateTime time, JsonWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } writer.WriteString(FormatDateTime(time)); }
protected override void ExportValue(ExportContext context, object value, JsonWriter writer) { if (this._properties.Count == 0) { writer.WriteString(value.ToString()); } else { ObjectReferenceTracker tracker = null; try { writer.WriteStartObject(); int num = 0; foreach (PropertyDescriptor descriptor in this._properties) { IObjectMemberExporter exporter = ((this._exporters != null) && (num < this._exporters.Length)) ? this._exporters[num++] : null; if (exporter != null) { exporter.Export(context, writer, value); } else { object o = descriptor.GetValue(value); if (!JsonNull.LogicallyEquals(o)) { writer.WriteMember(descriptor.Name); if (value.GetType().IsClass && (tracker == null)) { tracker = TrackObject(context, value); } context.Export(o, writer); } } } writer.WriteEndObject(); } finally { if (tracker != null) { tracker.Pop(value); } } } }
public virtual void Export(object value, JsonWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } if (JsonNull.LogicallyEquals(value)) { writer.WriteNull(); } else { IExporter exporter = this.FindExporter(value.GetType()); if (exporter != null) { exporter.Export(this, value, writer); } else { writer.WriteString(value.ToString()); } } }
protected override void ExportValue(ExportContext context, object value, JsonWriter writer) { writer.WriteString(value.ToString()); }
protected override void ExportValue(ExportContext context, object value, JsonWriter writer) { byte[] inArray = (byte[]) value; writer.WriteString(Convert.ToBase64String(inArray)); }