/// <exception cref="VariantException"></exception> /// <exception cref="TjsException"></exception> public override int PropGet(int flag, string membername, Variant result, Dispatch2 objthis) { if (membername != null) { return(base.PropGet(flag, membername, result, objthis)); } if (result == null) { return(Error.E_FAIL); } if (mGet == null) { return(Error.E_ACCESSDENIED); } object self; if (mIsStaticGet) { 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; try { object ret = mGet.Invoke(self, new object[] {}); NativeJavaClass.JavaObjectToVariant(result, mReturnType, ret); } catch (ArgumentException) { er = Error.E_INVALIDPARAM; } catch (MemberAccessException) { er = Error.E_ACCESSDENIED; } 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); }
/// <exception cref="VariantException"></exception> /// <exception cref="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_ACCESSDENIED; } 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); }
/// <exception cref="VariantException"></exception> /// <exception cref="TjsException"></exception> public override int PropSet(int flag, string membername, Variant param, Dispatch2 objthis) { if (membername != null) { return(base.PropSet(flag, membername, param, objthis)); } if (objthis == null) { return(Error.E_NATIVECLASSCRASH); } if (param == null) { return(Error.E_FAIL); } if (mSet == null) { return(Error.E_ACCESSDENIED); } object self; if (mIsStaticSet) { self = null; } else { // static 时は null 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 arg = NativeJavaClass.VariantToJavaObject(param, mParamType); if (arg == null) { return(Error.E_INVALIDPARAM); } object[] args = new object[1]; args[0] = arg; try { mSet.Invoke(self, args); } catch (ArgumentException) { er = Error.E_INVALIDPARAM; } catch (MemberAccessException) { er = Error.E_ACCESSDENIED; } 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); }