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);
示例#2
0
 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);
 }
示例#3
0
 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);
 }
示例#4
0
        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);
        }
示例#5
0
 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);
 }
示例#6
0
 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);
 }
示例#7
0
        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);
        }
示例#8
0
            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);
            }
示例#9
0
            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);
            }
示例#10
0
            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);
            }
示例#11
0
            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);
        }
    }
示例#13
0
 private static int DecrementImpl(IntPtr thisObj, int param) =>
 CppObjectShadow.ToCallback <ICallback>(thisObj).Increment(param);
示例#14
0
 public static IntPtr ToIntPtr(IStream stream)
 {
     return(CppObjectShadow.ToIntPtr <IStream>((ICallbackable)stream));
 }