private int NativeGetInt(IntPtr thisPtr, IntPtr dataPtr, int dataSize, out int actualSize) { actualSize = ValueSize; try { if (dataPtr == IntPtr.Zero) { // TODO: Should we throw an exception return(Result.Ok.Code); } // TODO: Check dataSize against <T>? var shadow = CustomEffectShadow.ToShadow <CustomEffectShadow>(thisPtr); var callback = (CustomEffect)shadow.Callback; T value; actualSize = ValueSize; getter(callback, out value); GetValue(dataPtr, ref value); } catch (Exception exception) { return((int)SharpDX.Result.GetResultFromException(exception)); } return(Result.Ok.Code); }
private int NativeSetInt(IntPtr thisPtr, IntPtr dataPtr, int dataSize) { try { // TODO: Check dataSize against <T>? var shadow = CustomEffectShadow.ToShadow <CustomEffectShadow>(thisPtr); var callback = (CustomEffect)shadow.Callback; T value; SetValue(dataPtr, out value); setter(callback, ref value); } catch (Exception exception) { return((int)SharpDX.Result.GetResultFromException(exception)); } return(Result.Ok.Code); }