本文整理汇总了C#中JsonWriter.BeginObject方法的典型用法代码示例。如果您正苦于以下问题:C# JsonWriter.BeginObject方法的具体用法?C# JsonWriter.BeginObject怎么用?C# JsonWriter.BeginObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonWriter
的用法示例。
在下文中一共展示了JsonWriter.BeginObject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportAsJsonSensorData
/// <summary>
/// <see cref="Field.ExportAsJsonSensorData"/>
/// </summary>
public override void ExportAsJsonSensorData(JsonWriter w)
{
w.BeginObject ();
w.WriteName ("fieldType");
w.WriteValue ("boolean");
this.ExportAsJsonSensorDataCommonAttributes(w);
w.WriteName ("value");
w.WriteValue (this.value);
w.WriteName ("datatype");
w.WriteValue (this.dataType);
w.EndObject ();
}
示例2: StartExportTimestamp
/// <summary>
/// Starts the export of sensor data values for a particular point in time. This call must be followed by a call to <see cref="EndExportTimestamp"/>.
/// Use <see cref="ExportField"/> to export field information to the Sensor Data JSON document.
/// </summary>
/// <param name="Json">JSON Output</param>
/// <param name="Timestamp">Timestamp</param>
public static void StartExportTimestamp (JsonWriter Json, DateTime Timestamp)
{
Timestamp = Timestamp.ToUniversalTime ();
Json.BeginObject ();
Json.WriteName ("timestampUtc");
Json.BeginObject ();
Json.WriteName ("year");
Json.WriteValue (Timestamp.Year);
Json.WriteName ("month");
Json.WriteValue (Timestamp.Month);
Json.WriteName ("day");
Json.WriteValue (Timestamp.Day);
Json.WriteName ("hour");
Json.WriteValue (Timestamp.Hour);
Json.WriteName ("minute");
Json.WriteValue (Timestamp.Minute);
Json.WriteName ("second");
Json.WriteValue (Timestamp.Second);
Json.EndObject ();
Json.WriteName ("fields");
Json.BeginArray ();
}
示例3: ExportAsJsonSensorData
/// <summary>
/// <see cref="Field.ExportAsJsonSensorData"/>
/// </summary>
public override void ExportAsJsonSensorData(JsonWriter w)
{
w.BeginObject ();
w.WriteName ("fieldType");
w.WriteValue ("dateTime");
this.ExportAsJsonSensorDataCommonAttributes(w);
w.WriteName ("year");
w.WriteValue (this.value.Year);
w.WriteName ("month");
w.WriteValue (this.value.Month);
w.WriteName ("day");
w.WriteValue (this.value.Day);
w.WriteName ("hour");
w.WriteValue (this.value.Hour);
w.WriteName ("minute");
w.WriteValue (this.value.Minute);
w.WriteName ("second");
w.WriteValue (this.value.Second);
w.EndObject ();
}
示例4: StartExportNode
/// <summary>
/// Starts the export of sensor data values for a particular node. This call must be followed by a call to <see cref="EndExportNode"/>.
/// Use <see cref="StartExportTimestamp"/> to export node information pertaining to a given point in time to the Sensor Data JSON document.
/// </summary>
/// <param name="Json">JSON Output</param>
/// <param name="NodeId">Node ID.</param>
/// <param name="CacheType">Cache Type</param>
/// <param name="SourceId">Source ID.</param>
public static void StartExportNode (JsonWriter Json, string NodeId, string CacheType, string SourceId)
{
Json.BeginObject ();
Json.WriteName ("nodeId");
Json.WriteValue (NodeId);
if (!string.IsNullOrEmpty (CacheType))
{
Json.WriteName ("cacheType");
Json.WriteValue (CacheType);
}
if (!string.IsNullOrEmpty (SourceId))
{
Json.WriteName ("sourceId");
Json.WriteValue (SourceId);
}
Json.WriteName ("timestamps");
Json.BeginArray ();
}
示例5: ExportAsJsonSensorData
/// <summary>
/// <see cref="Field.ExportAsJsonSensorData"/>
/// </summary>
public override void ExportAsJsonSensorData(JsonWriter w)
{
w.BeginObject ();
w.WriteName ("fieldType");
w.WriteValue ("numeric");
this.ExportAsJsonSensorDataCommonAttributes(w);
w.WriteName ("value");
w.WriteValue (this.value);
w.WriteName ("unit");
w.WriteValue (this.unit);
w.WriteName ("nrDec");
w.WriteValue (this.nrDecimals);
w.EndObject ();
}
示例6: ExportAsJsonSensorData
/// <summary>
/// <see cref="Field.ExportAsJsonSensorData"/>
/// </summary>
public override void ExportAsJsonSensorData(JsonWriter w)
{
w.BeginObject ();
w.WriteName ("fieldType");
w.WriteValue ("duration");
this.ExportAsJsonSensorDataCommonAttributes(w);
w.WriteName ("days");
w.WriteValue (this.value.Days);
w.WriteName ("hours");
w.WriteValue (this.value.Hours);
w.WriteName ("minutes");
w.WriteValue (this.value.Minutes);
w.WriteName ("seconds");
w.WriteValue (this.value.Seconds);
w.WriteName ("milliseconds");
w.WriteValue (this.value.Milliseconds);
w.EndObject ();
}
示例7: WriteJson
public void WriteJson(JsonWriter output, string key)
{
using (output.BeginObject(key))
{
output.WriteValue("x", X);
output.WriteValue("y", Y);
output.WriteValue("w", Width);
output.WriteValue("h", Height);
if (paddingLeft != 0)
{
output.WriteValue("l", paddingLeft);
}
if (paddingRight != 0)
{
output.WriteValue("r", paddingRight);
}
if (paddingTop != 0)
{
output.WriteValue("t", paddingTop);
}
if (paddingBottom != 0)
{
output.WriteValue("b", paddingBottom);
}
}
}
示例8: ExportAsJsonSensorDataCommonAttributes
//.........这里部分代码省略.........
w.WriteName ("manualEstimate");
w.WriteValue (true);
}
if ((this.status & FieldStatus.ManualReadout) != 0)
{
w.WriteName ("manualReadout");
w.WriteValue (true);
}
if ((this.status & FieldStatus.AutomaticReadout) != 0)
{
w.WriteName ("automaticReadout");
w.WriteValue (true);
}
if ((this.status & FieldStatus.TimeOffset) != 0)
{
w.WriteName ("timeOffset");
w.WriteValue (true);
}
if ((this.status & FieldStatus.Warning) != 0)
{
w.WriteName ("warning");
w.WriteValue (true);
}
if ((this.status & FieldStatus.Error) != 0)
{
w.WriteName ("error");
w.WriteValue (true);
}
if ((this.status & FieldStatus.Signed) != 0)
{
w.WriteName ("signed");
w.WriteValue (true);
}
if ((this.status & FieldStatus.Invoiced) != 0)
{
w.WriteName ("invoiced");
w.WriteValue (true);
}
if ((this.status & FieldStatus.EndOfSeries) != 0)
{
w.WriteName ("endOfSeries");
w.WriteValue (true);
}
if ((this.status & FieldStatus.PowerFailure) != 0)
{
w.WriteName ("powerFailure");
w.WriteValue (true);
}
if ((this.status & FieldStatus.InvoicedConfirmed) != 0)
{
w.WriteName ("invoiceConfirmed");
w.WriteValue (true);
}
if (this.stringIds != null && this.stringIds.Length > 0)
{
if (!string.IsNullOrEmpty (this.languageModule))
{
w.WriteName ("module");
w.WriteValue (this.languageModule);
}
w.WriteName ("stringIds");
w.BeginArray ();
foreach (FieldLanguageStep Step in this.stringIds)
{
w.BeginObject ();
w.WriteName ("stringId");
w.WriteValue (Step.StringId);
if (Step.Seed != null)
{
w.WriteName ("seed");
w.WriteValue (Step.Seed);
}
if (!string.IsNullOrEmpty (Step.LanguageModule))
{
w.WriteName ("module");
w.WriteValue (Step.LanguageModule);
}
w.EndObject ();
}
w.EndArray ();
}
}