本文整理汇总了C#中org.Get方法的典型用法代码示例。如果您正苦于以下问题:C# org.Get方法的具体用法?C# org.Get怎么用?C# org.Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org
的用法示例。
在下文中一共展示了org.Get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBoolean
bool GetBoolean (org.freedesktop.DBus.Properties dbusobj, string path, string propname)
{
try {
return Boolean.Parse (dbusobj.Get (path, propname).ToString ());
} catch (Exception) {
return false;
}
}
示例2: ToString
/// <summary>Reverse the JSONML transformation, making an XML text from a JSONArray.</summary>
/// <param name="ja">A JSONArray.</param>
/// <returns>An XML string.</returns>
/// <exception cref="JSONException"/>
/// <exception cref="org.json.JSONException"/>
public static string ToString(org.json.JSONArray ja)
{
int i;
org.json.JSONObject jo;
string key;
System.Collections.Generic.IEnumerator<string> keys;
int length;
object @object;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
string tagName;
string value;
// Emit <tagName
tagName = ja.GetString(0);
org.json.XML.NoSpace(tagName);
tagName = org.json.XML.Escape(tagName);
sb.Append('<');
sb.Append(tagName);
@object = ja.Opt(1);
if (@object is org.json.JSONObject)
{
i = 2;
jo = (org.json.JSONObject)@object;
// Emit the attributes
keys = jo.Keys();
while (keys.HasNext())
{
key = keys.Next();
org.json.XML.NoSpace(key);
value = jo.OptString(key);
if (value != null)
{
sb.Append(' ');
sb.Append(org.json.XML.Escape(key));
sb.Append('=');
sb.Append('"');
sb.Append(org.json.XML.Escape(value));
sb.Append('"');
}
}
}
else
{
i = 1;
}
// Emit content in body
length = ja.Length();
if (i >= length)
{
sb.Append('/');
sb.Append('>');
}
else
{
sb.Append('>');
do
{
@object = ja.Get(i);
i += 1;
if (@object != null)
{
if (@object is string)
{
sb.Append(org.json.XML.Escape(@object.ToString()));
}
else
{
if (@object is org.json.JSONObject)
{
sb.Append(ToString((org.json.JSONObject)@object));
}
else
{
if (@object is org.json.JSONArray)
{
sb.Append(ToString((org.json.JSONArray)@object));
}
else
{
sb.Append(@object.ToString());
}
}
}
}
}
while (i < length);
sb.Append('<');
sb.Append('/');
sb.Append(tagName);
sb.Append('>');
}
return sb.ToString();
}
示例3: GetBoolean
bool GetBoolean (org.freedesktop.DBus.Properties dbusobj, string path, string propname)
{
try {
return Boolean.Parse (dbusobj.Get (path, propname).ToString ());
} catch (Exception e) {
Log.Error ("{0}", e.Message);
Log.Debug (e.StackTrace);
return false;
}
}