本文整理汇总了C#中LLSD.AsString方法的典型用法代码示例。如果您正苦于以下问题:C# LLSD.AsString方法的具体用法?C# LLSD.AsString怎么用?C# LLSD.AsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLSD
的用法示例。
在下文中一共展示了LLSD.AsString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeXmlElement
public static void SerializeXmlElement(XmlTextWriter writer, LLSD data)
{
switch (data.Type)
{
case LLSDType.Unknown:
writer.WriteStartElement(String.Empty, "undef", String.Empty);
writer.WriteEndElement();
break;
case LLSDType.Boolean:
writer.WriteStartElement(String.Empty, "boolean", String.Empty);
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
case LLSDType.Integer:
writer.WriteStartElement(String.Empty, "integer", String.Empty);
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
case LLSDType.Real:
writer.WriteStartElement(String.Empty, "real", String.Empty);
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
case LLSDType.String:
writer.WriteStartElement(String.Empty, "string", String.Empty);
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
case LLSDType.UUID:
writer.WriteStartElement(String.Empty, "uuid", String.Empty);
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
case LLSDType.Date:
writer.WriteStartElement(String.Empty, "date", String.Empty);
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
case LLSDType.URI:
writer.WriteStartElement(String.Empty, "uri", String.Empty);
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
case LLSDType.Binary:
writer.WriteStartElement(String.Empty, "binary", String.Empty);
writer.WriteStartAttribute(String.Empty, "encoding", String.Empty);
writer.WriteString("base64");
writer.WriteEndAttribute();
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
case LLSDType.Map:
LLSDMap map = (LLSDMap)data;
writer.WriteStartElement(String.Empty, "map", String.Empty);
foreach (KeyValuePair<string, LLSD> kvp in map)
{
writer.WriteStartElement(String.Empty, "key", String.Empty);
writer.WriteString(kvp.Key);
writer.WriteEndElement();
SerializeXmlElement(writer, kvp.Value);
}
writer.WriteEndElement();
break;
case LLSDType.Array:
LLSDArray array = (LLSDArray)data;
writer.WriteStartElement(String.Empty, "array", String.Empty);
for (int i = 0; i < array.Count; i++)
{
SerializeXmlElement(writer, array[i]);
}
writer.WriteEndElement();
break;
}
}
示例2: SerializeNotationElementFormatted
private static void SerializeNotationElementFormatted(StringWriter writer, string intend, LLSD llsd)
{
switch (llsd.Type)
{
case LLSDType.Unknown:
writer.Write(undefNotationValue);
break;
case LLSDType.Boolean:
if (llsd.AsBoolean())
writer.Write(trueNotationValueTwo);
else
writer.Write(falseNotationValueTwo);
break;
case LLSDType.Integer:
writer.Write(integerNotationMarker);
writer.Write(llsd.AsString());
break;
case LLSDType.Real:
writer.Write(realNotationMarker);
writer.Write(llsd.AsString());
break;
case LLSDType.UUID:
writer.Write(uuidNotationMarker);
writer.Write(llsd.AsString());
break;
case LLSDType.String:
writer.Write(singleQuotesNotationMarker);
writer.Write(EscapeCharacter(llsd.AsString(), singleQuotesNotationMarker));
writer.Write(singleQuotesNotationMarker);
break;
case LLSDType.Binary:
writer.Write(binaryNotationMarker);
writer.Write("64");
writer.Write(doubleQuotesNotationMarker);
writer.Write(llsd.AsString());
writer.Write(doubleQuotesNotationMarker);
break;
case LLSDType.Date:
writer.Write(dateNotationMarker);
writer.Write(doubleQuotesNotationMarker);
writer.Write(llsd.AsString());
writer.Write(doubleQuotesNotationMarker);
break;
case LLSDType.URI:
writer.Write(uriNotationMarker);
writer.Write(doubleQuotesNotationMarker);
writer.Write(EscapeCharacter(llsd.AsString(), doubleQuotesNotationMarker));
writer.Write(doubleQuotesNotationMarker);
break;
case LLSDType.Array:
SerializeNotationArrayFormatted(writer, intend + baseIntend, (LLSDArray)llsd);
break;
case LLSDType.Map:
SerializeNotationMapFormatted(writer, intend + baseIntend, (LLSDMap)llsd);
break;
default:
throw new LLSDException("Notation serialization: Not existing element discovered.");
}
}