本文整理汇总了C#中Variant.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# Variant.Clear方法的具体用法?C# Variant.Clear怎么用?C# Variant.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Variant
的用法示例。
在下文中一共展示了Variant.Clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FuncCall
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
public override int FuncCall(int flag, string membername, Variant result, Variant
[] param, Dispatch2 objthis)
{
if (membername != null)
{
return base.FuncCall(flag, membername, result, param, objthis);
}
if (param.Length < mParamTypes.Length)
{
return Error.E_INVALIDPARAM;
}
// パラメータが少ない
if (result != null)
{
result.Clear();
}
object self;
if (mIsStatic)
{
self = null;
}
else
{
// static 时は null
if (objthis == null)
{
return Error.E_NATIVECLASSCRASH;
}
NativeJavaInstance ni = (NativeJavaInstance)objthis.GetNativeInstance(mClassID);
if (ni == null)
{
return Error.E_FAIL;
}
self = ni.GetNativeObject();
if (self == null)
{
return Error.E_NATIVECLASSCRASH;
}
}
int er = Error.S_OK;
object[] args = NativeJavaClass.VariantArrayToJavaObjectArray(param, mParamTypes);
try
{
object ret = mProcess.Invoke(self, args);
if (result != null)
{
NativeJavaClass.JavaObjectToVariant(result, mReturnType, ret);
}
}
catch (ArgumentException)
{
er = Error.E_INVALIDPARAM;
}
catch (MemberAccessException)
{
er = Error.E_ACCESSDENYED;
}
catch (TargetInvocationException e)
{
Exception t = e.InnerException;
if (t is VariantException)
{
throw (VariantException)t;
}
else
{
if (t is TJSException)
{
throw (TJSException)t;
}
else
{
throw new TJSException(t.ToString());
}
}
}
return er;
}
示例2: JavaObjectToVariant
public static void JavaObjectToVariant(Variant result, Type type, object src)
{
if (result == null)
{
return;
}
if (type.IsPrimitive)
{
// プリミティブタイプの场合
if (type.Equals(typeof(int)))
{
result.Set(((int)src));
}
else
{
if (type.Equals(typeof(double)))
{
result.Set(((double)src));
}
else
{
if (type.Equals(typeof(bool)))
{
result.Set(((bool)src) ? 1 : 0);
}
else
{
if (type.Equals(typeof(float)))
{
result.Set(((float)src));
}
else
{
if (type.Equals(typeof(long)))
{
result.Set(((long)src));
}
else
{
if (type.Equals(typeof(char)))
{
result.Set((int)((char)src));
}
else
{
if (type.Equals(typeof(byte)))
{
result.Set(((byte)src));
}
else
{
if (type.Equals(typeof(short)))
{
result.Set(((short)src));
}
else
{
// may be Void.TYPE
result.Clear();
}
}
}
}
}
}
}
}
}
else
{
if (type.Equals(typeof(string)))
{
result.Set((string)src);
}
else
{
if (type.Equals(typeof(ByteBuffer)))
{
result.Set((ByteBuffer)src);
}
else
{
if (type.Equals(typeof(Variant)))
{
result.Set((Variant)src);
}
else
{
if (type.Equals(typeof(VariantClosure)))
{
result.Set(((VariantClosure)src).mObject, ((VariantClosure)src).mObjThis);
}
else
{
if (type.Equals(typeof(Dispatch2)))
{
result.Set((Dispatch2)src);
}
else
{
//.........这里部分代码省略.........