private static unsafe partial int OpenImpl_(IntPtr thisObject, int _includeType, void *_fileName, void *_parentData, void *_data, void *_bytes) { IncludeShadow shadow = CppObjectShadow.ToAnyShadow <IncludeShadow>(thisObject); Include callback = shadow.ToCallback <Include>(); try { IncludeType includeType = (IncludeType)_includeType; IntPtr parentData = (IntPtr)_parentData; ref IntPtr data = ref Unsafe.AsRef <IntPtr>(_data); ref int bytes = ref Unsafe.AsRef <int>(_bytes);
private static int WriteImpl(IntPtr thisPtr, IntPtr buffer, int sizeOfBytes, out int bytesWrite) { bytesWrite = 0; try { IStream stream = (IStream)CppObjectShadow.ToShadow <ComStreamBaseShadow>(thisPtr).Callback; bytesWrite = stream.Write(buffer, sizeOfBytes); } catch (Exception ex) { return((int)Result.GetResultFromException(ex)); } return(Result.Ok.Code); }
private static int CopyToImpl(IntPtr thisPtr, IntPtr streamPointer, long numberOfBytes, out long numberOfBytesRead, out long numberOfBytesWritten) { numberOfBytesRead = 0L; numberOfBytesWritten = 0L; try { IStream stream = (IStream)CppObjectShadow.ToShadow <ComStreamShadow>(thisPtr).Callback; numberOfBytesRead = stream.CopyTo((IStream) new ComStream(streamPointer), numberOfBytes, out numberOfBytesWritten); } catch (Exception ex) { return((int)Result.GetResultFromException(ex)); } return(Result.Ok.Code); }
private int SetterImpl(IntPtr thisPtr, IntPtr dataPtr, int dataSize) { if (dataPtr == IntPtr.Zero) { return(Result.Ok.Code); } var callback = CppObjectShadow.ToCallback <ID2D1EffectImpl>(thisPtr); var value = Marshal.PtrToStructure <U>(dataPtr); PropertyInfo.SetValue(callback, value); return(Result.Ok.Code); }
private static unsafe int SeekImpl(IntPtr thisPtr, long offset, SeekOrigin origin, IntPtr newPosition) { try { long num = ((IStream)CppObjectShadow.ToShadow <ComStreamShadow>(thisPtr).Callback).Seek(offset, origin); if (newPosition != IntPtr.Zero) { *(long *)(void *)newPosition = num; } } catch (Exception ex) { return((int)Result.GetResultFromException(ex)); } return(Result.Ok.Code); }
private static Result StatImpl(IntPtr thisPtr, ref StorageStatistics.__Native statisticsPtr, StorageStatisticsFlags flags) { try { ((IStream)CppObjectShadow.ToShadow <ComStreamShadow>(thisPtr).Callback).GetStatistics(flags).__MarshalTo(ref statisticsPtr); } catch (SharpDXException ex) { return(ex.ResultCode); } catch (Exception ex) { return((Result)Result.Fail.Code); } return(Result.Ok); }
private int GetterImpl(IntPtr thisPtr, IntPtr dataPtr, int datasize, out int actualSize) { actualSize = Marshal.SizeOf <U>(); if (dataPtr == IntPtr.Zero) { return(Result.Ok.Code); } var callback = CppObjectShadow.ToCallback <ID2D1EffectImpl>(thisPtr); var value = (U)PropertyInfo.GetValue(callback); Marshal.StructureToPtr(value, dataPtr, true); return(Result.Ok.Code); }
private static Result SetSizeImpl(IntPtr thisPtr, long newSize) { Result result = Result.Ok; try { ((IStream)CppObjectShadow.ToShadow <ComStreamShadow>(thisPtr).Callback).SetSize(newSize); } catch (SharpDXException ex) { result = ex.ResultCode; } catch (Exception ex) { result = (Result)Result.Fail.Code; } return(result); }
private static Result UnlockRegionImpl(IntPtr thisPtr, long offset, long numberOfBytes, LockType lockType) { Result result = Result.Ok; try { ((IStream)CppObjectShadow.ToShadow <ComStreamShadow>(thisPtr).Callback).UnlockRegion(offset, numberOfBytes, lockType); } catch (SharpDXException ex) { result = ex.ResultCode; } catch (Exception ex) { result = (Result)Result.Fail.Code; } return(result); }
private static Result CommitImpl(IntPtr thisPtr, CommitFlags flags) { Result result = Result.Ok; try { ((IStream)CppObjectShadow.ToShadow <ComStreamShadow>(thisPtr).Callback).Commit(flags); } catch (SharpDXException ex) { result = ex.ResultCode; } catch (Exception ex) { result = (Result)Result.Fail.Code; } return(result); }
private static Result CloneImpl(IntPtr thisPtr, out IntPtr streamPointer) { streamPointer = IntPtr.Zero; Result result = Result.Ok; try { IStream stream = ((IStream)CppObjectShadow.ToShadow <ComStreamShadow>(thisPtr).Callback).Clone(); streamPointer = ComStream.ToIntPtr(stream); } catch (SharpDXException ex) { result = ex.ResultCode; } catch (Exception ex) { result = (Result)Result.Fail.Code; } return(result); }
private static unsafe partial int OnIntegerValueChangedImpl_(IntPtr thisObject, void *_storyboard, void *_variable, void *_newValue, void *_previousValue, int _cDimension) { IUIAnimationVariableIntegerChangeHandler2 @this = CppObjectShadow.ToCallback <IUIAnimationVariableIntegerChangeHandler2>(thisObject); try { Span <int> newValue = new int[_cDimension]; Span <int> previousValue = new int[_cDimension]; new Span <int>(_newValue, newValue.Length).CopyTo(newValue); new Span <int>(_previousValue, previousValue.Length).CopyTo(previousValue); IUIAnimationStoryboard2 storyboard = new((IntPtr)_storyboard); IUIAnimationVariable2 variable = new((IntPtr)_variable); @this.OnValueChanged(storyboard, variable, newValue, previousValue, _cDimension); return(Result.Ok.Code); } catch (Exception __exception__) { (@this as IExceptionCallback)?.RaiseException(__exception__); return(Result.GetResultFromException(__exception__).Code); } }
private static int DecrementImpl(IntPtr thisObj, int param) => CppObjectShadow.ToCallback <ICallback>(thisObj).Increment(param);
public static IntPtr ToIntPtr(IStream stream) { return(CppObjectShadow.ToIntPtr <IStream>((ICallbackable)stream)); }