本文整理汇总了C#中Kirikiri.Tjs2.Variant.AsOctet方法的典型用法代码示例。如果您正苦于以下问题:C# Variant.AsOctet方法的具体用法?C# Variant.AsOctet怎么用?C# Variant.AsOctet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kirikiri.Tjs2.Variant
的用法示例。
在下文中一共展示了Variant.AsOctet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VariantToExpressionString
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
public static string VariantToExpressionString(Variant val)
{
// convert given variant to string which can be interpret as an expression.
// this function does not convert objects ( returns empty string )
if (val.IsVoid())
{
return "void";
}
else
{
if (val.IsInteger())
{
return val.AsString();
}
else
{
if (val.IsReal())
{
string s = Variant.RealToHexString(val.AsDouble());
return s + " /* " + val.AsString() + " */";
}
else
{
if (val.IsString())
{
string s = LexBase.EscapeC(val.AsString());
return "\"" + s + "\"";
}
else
{
if (val.IsOctet())
{
string s = Variant.OctetToListString(val.AsOctet());
return "<%" + s + "%>";
}
else
{
return string.Empty;
}
}
}
}
}
}
示例2: GetOctetProperty
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
private static void GetOctetProperty(Variant result, Variant octet, int n)
{
// processes properties toward octets.
ByteBuffer o = octet.AsOctet();
int len = o != null ? o.Capacity() : 0;
if (n < 0 || n >= len)
{
throw new TJSException(Error.RangeError);
}
result.Set(o.Get(n));
return;
}
示例3: VariantToJavaObject
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
public static object VariantToJavaObject(Variant param, Type type)
{
if (type.IsPrimitive)
{
// プリミティブタイプの场合
if (type.Equals(typeof(int)))
{
return Sharpen.Extensions.ValueOf(param.AsInteger());
}
else
{
if (type.Equals(typeof(double)))
{
return (param.AsDouble());
}
else
{
if (type.Equals(typeof(bool)))
{
return Sharpen.Extensions.ValueOf(param.AsInteger() != 0 ? true : false);
}
else
{
if (type.Equals(typeof(float)))
{
return ((float)param.AsDouble());
}
else
{
if (type.Equals(typeof(long)))
{
return Sharpen.Extensions.ValueOf(param.AsInteger());
}
else
{
if (type.Equals(typeof(char)))
{
return ((char)param.AsInteger());
}
else
{
if (type.Equals(typeof(byte)))
{
return (unchecked((byte)param.AsInteger()));
}
else
{
if (type.Equals(typeof(short)))
{
return ((short)param.AsInteger());
}
else
{
// may be Void.TYPE
return null;
}
}
}
}
}
}
}
}
}
else
{
if (type.Equals(typeof(string)))
{
return param.AsString();
}
else
{
if (type.Equals(typeof(ByteBuffer)))
{
return param.AsOctet();
}
else
{
if (type.Equals(typeof(Variant)))
{
return param;
}
else
{
if (type.Equals(typeof(VariantClosure)))
{
return param.AsObjectClosure();
}
else
{
if (type.Equals(typeof(Dispatch2)))
{
return param.AsObject();
}
else
{
if (type.Equals(param.ToJavaObject().GetType()))
{
return param.ToJavaObject();
//.........这里部分代码省略.........
示例4: VariantToReadableString
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
public static string VariantToReadableString(Variant val, int maxlen)
{
string ret = null;
if (val == null || val.IsVoid())
{
ret = "(void)";
}
else
{
if (val.IsInteger())
{
ret = "(int)" + val.AsString();
}
else
{
if (val.IsReal())
{
ret = "(real)" + val.AsString();
}
else
{
if (val.IsString())
{
ret = "(string)\"" + LexBase.EscapeC(val.AsString()) + "\"";
}
else
{
if (val.IsOctet())
{
ret = "(octet)<% " + Variant.OctetToListString(val.AsOctet()) + " %>";
}
else
{
if (val.IsObject())
{
VariantClosure c = (VariantClosure)val.AsObjectClosure();
StringBuilder str = new StringBuilder(128);
str.Append("(object)");
str.Append('(');
if (c.mObject != null)
{
str.Append('[');
if (c.mObject is NativeClass)
{
str.Append(((NativeClass)c.mObject).GetClassName());
}
else
{
if (c.mObject is InterCodeObject)
{
str.Append(((InterCodeObject)c.mObject).GetName());
}
else
{
if (c.mObject is CustomObject)
{
string name = ((CustomObject)c.mObject).GetClassNames();
if (name != null)
{
str.Append(name);
}
else
{
str.Append(c.mObject.GetType().FullName);
}
}
else
{
str.Append(c.mObject.GetType().FullName);
}
}
}
str.Append(']');
}
else
{
str.Append("0x00000000");
}
if (c.mObjThis != null)
{
str.Append('[');
if (c.mObjThis is NativeClass)
{
str.Append(((NativeClass)c.mObjThis).GetClassName());
}
else
{
if (c.mObjThis is InterCodeObject)
{
str.Append(((InterCodeObject)c.mObjThis).GetName());
}
else
{
if (c.mObjThis is CustomObject)
{
string name = ((CustomObject)c.mObjThis).GetClassNames();
if (name != null)
{
str.Append(name);
//.........这里部分代码省略.........