Beispiel #1
0
        /// <summary>
        /// Liefert die Bytes ab der Stelle <paramref name="Offset"/> als Wert.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="Array"></param>
        /// <param name="Offset">Position, ab der gelesen wird. Erhöht sich um die Anzhal der gelesenen Bytes!</param>
        /// <returns></returns>
        unsafe static public dynamic CopyValue <T> (this byte [] Array, ref Int32 Offset) where T : unmanaged
        {
            try
            {
                fixed(byte *ptr = Array)
                {
                    switch (Type.GetTypeCode(typeof(T)))
                    {
                    case TypeCode.SByte:
                        SByte *vpSByte = (SByte *)(ptr + Offset);
                        return(*vpSByte);

                    case TypeCode.Byte:
                        Byte *vpByte = (Byte *)(ptr + Offset);
                        return(*vpByte);

                    case TypeCode.Int16:
                        Int16 *vpInt16 = (Int16 *)(ptr + Offset);
                        return(*vpInt16);

                    case TypeCode.UInt16:
                        UInt16 *vpUInt16 = (UInt16 *)(ptr + Offset);
                        return(*vpUInt16);

                    case TypeCode.Int32:
                        Int32 *vpInt32 = (Int32 *)(ptr + Offset);
                        return(*vpInt32);

                    case TypeCode.UInt32:
                        UInt32 *vpUInt32 = (UInt32 *)(ptr + Offset);
                        return(*vpUInt32);

                    case TypeCode.Int64:
                        Int64 *vpInt64 = (Int64 *)(ptr + Offset);
                        return(*vpInt64);

                    case TypeCode.UInt64:
                        UInt64 *vpUInt64 = (UInt64 *)(ptr + Offset);
                        return(*vpUInt64);

                    case TypeCode.Char:
                        Char *vpChar = (Char *)(ptr + Offset);
                        return(*vpChar);

                    case TypeCode.Boolean:
                        Boolean *vpBoolean = (Boolean *)(ptr + Offset);
                        return(*vpBoolean);
                    }
                }
            } finally {
                Offset += sizeof(T);
            }
            throw new Exception("Not implemented!");
        }
 public override sealed FMOD_RESULT FMOD_Channel_GetPaused(FMOD_CHANNEL *channel, Boolean *paused) => INTERNAL_FMOD_Channel_GetPaused(channel, paused);
 public unsafe partial void GetBooleanIndexed([Flow(FlowDirection.In)] EXT target, [Flow(FlowDirection.In)] uint index, [Count(Computed = "target"), Flow(FlowDirection.Out)] Boolean *data);
Beispiel #4
0
        private static unsafe string EncodeObject(ref object data, EventData *dataDescriptor, byte *dataBuffer)

        /*++
         *
         * Routine Description:
         *
         * This routine is used by WriteEvent to unbox the object type and
         * to fill the passed in ETW data descriptor.
         *
         * Arguments:
         *
         * data - argument to be decoded
         *
         * dataDescriptor - pointer to the descriptor to be filled
         *
         * dataBuffer - storage buffer for storing user data, needed because cant get the address of the object
         *
         * Return Value:
         *
         * null if the object is a basic type other than string. String otherwise
         *
         * --*/
        {
            dataDescriptor->Reserved = 0;

            string sRet = data as string;

            if (sRet != null)
            {
                dataDescriptor->Size = (uint)((sRet.Length + 1) * 2);
                return(sRet);
            }

            if (data == null)
            {
                dataDescriptor->Size        = 0;
                dataDescriptor->DataPointer = 0;
            }
            else if (data is IntPtr)
            {
                dataDescriptor->Size = (uint)sizeof(IntPtr);
                IntPtr *intptrPtr = (IntPtr *)dataBuffer;
                *       intptrPtr = (IntPtr)data;
                dataDescriptor->DataPointer = (ulong)intptrPtr;
            }
            else if (data is int)
            {
                dataDescriptor->Size = (uint)sizeof(int);
                int *intptrPtr = (int *)dataBuffer;
                *    intptrPtr = (int)data;
                dataDescriptor->DataPointer = (ulong)intptrPtr;
            }
            else if (data is long)
            {
                dataDescriptor->Size = (uint)sizeof(long);
                long *longptr = (long *)dataBuffer;
                *     longptr = (long)data;
                dataDescriptor->DataPointer = (ulong)longptr;
            }
            else if (data is uint)
            {
                dataDescriptor->Size = (uint)sizeof(uint);
                uint *uintptr = (uint *)dataBuffer;
                *     uintptr = (uint)data;
                dataDescriptor->DataPointer = (ulong)uintptr;
            }
            else if (data is UInt64)
            {
                dataDescriptor->Size = (uint)sizeof(ulong);
                UInt64 *ulongptr = (ulong *)dataBuffer;
                *       ulongptr = (ulong)data;
                dataDescriptor->DataPointer = (ulong)ulongptr;
            }
            else if (data is char)
            {
                dataDescriptor->Size = (uint)sizeof(char);
                char *charptr = (char *)dataBuffer;
                *     charptr = (char)data;
                dataDescriptor->DataPointer = (ulong)charptr;
            }
            else if (data is byte)
            {
                dataDescriptor->Size = (uint)sizeof(byte);
                byte *byteptr = (byte *)dataBuffer;
                *     byteptr = (byte)data;
                dataDescriptor->DataPointer = (ulong)byteptr;
            }
            else if (data is short)
            {
                dataDescriptor->Size = (uint)sizeof(short);
                short *shortptr = (short *)dataBuffer;
                *      shortptr = (short)data;
                dataDescriptor->DataPointer = (ulong)shortptr;
            }
            else if (data is sbyte)
            {
                dataDescriptor->Size = (uint)sizeof(sbyte);
                sbyte *sbyteptr = (sbyte *)dataBuffer;
                *      sbyteptr = (sbyte)data;
                dataDescriptor->DataPointer = (ulong)sbyteptr;
            }
            else if (data is ushort)
            {
                dataDescriptor->Size = (uint)sizeof(ushort);
                ushort *ushortptr = (ushort *)dataBuffer;
                *       ushortptr = (ushort)data;
                dataDescriptor->DataPointer = (ulong)ushortptr;
            }
            else if (data is float)
            {
                dataDescriptor->Size = (uint)sizeof(float);
                float *floatptr = (float *)dataBuffer;
                *      floatptr = (float)data;
                dataDescriptor->DataPointer = (ulong)floatptr;
            }
            else if (data is double)
            {
                dataDescriptor->Size = (uint)sizeof(double);
                double *doubleptr = (double *)dataBuffer;
                *       doubleptr = (double)data;
                dataDescriptor->DataPointer = (ulong)doubleptr;
            }
            else if (data is bool)
            {
                dataDescriptor->Size = (uint)sizeof(bool);
                bool *boolptr = (bool *)dataBuffer;
                *     boolptr = (bool)data;
                dataDescriptor->DataPointer = (ulong)boolptr;
            }
            else if (data is Guid)
            {
                dataDescriptor->Size = (uint)sizeof(Guid);
                Guid *guidptr = (Guid *)dataBuffer;
                *     guidptr = (Guid)data;
                dataDescriptor->DataPointer = (ulong)guidptr;
            }
            else if (data is decimal)
            {
                dataDescriptor->Size = (uint)sizeof(decimal);
                decimal *decimalptr = (decimal *)dataBuffer;
                *        decimalptr = (decimal)data;
                dataDescriptor->DataPointer = (ulong)decimalptr;
            }
            else if (data is Boolean)
            {
                dataDescriptor->Size = (uint)sizeof(Boolean);
                Boolean *booleanptr = (Boolean *)dataBuffer;
                *        booleanptr = (Boolean)data;
                dataDescriptor->DataPointer = (ulong)booleanptr;
            }
            else
            {
                //To our eyes, everything else is a just a string
                sRet = data.ToString();
                dataDescriptor->Size = (uint)((sRet.Length + 1) * 2);
                return(sRet);
            }

            return(null);
        }
Beispiel #5
0
 public abstract FMOD_RESULT FMOD_Channel_GetMute(FMOD_CHANNEL *channel, Boolean *mute);
Beispiel #6
0
 public abstract FMOD_RESULT FMOD_Channel_GetPaused(FMOD_CHANNEL *channel, Boolean *paused);
Beispiel #7
0
 public unsafe partial void GetVariantBoolean([Flow(FlowDirection.In)] uint id, [Flow(FlowDirection.In)] GetVariantValueEXT value, [Count(Computed = "id"), Flow(FlowDirection.Out)] Boolean *data);
 public static unsafe bool AreProgramsResident(this NVVertexProgram thisApi, [Flow(FlowDirection.In)] uint n, [Count(Parameter = "n"), Flow(FlowDirection.In)] ReadOnlySpan <Program> programs, [Count(Parameter = "n"), Flow(FlowDirection.Out)] Boolean *residences)
 {
     // SpanOverloader
     return(thisApi.AreProgramsResident(n, in programs.GetPinnableReference(), residences));
 }
 public override sealed FMOD_RESULT FMOD_Channel_IsPlaying(FMOD_CHANNEL *channel, Boolean *isplaying) => INTERNAL_FMOD_Channel_IsPlaying(channel, isplaying);
 public override sealed FMOD_RESULT FMOD_Channel_GetMute(FMOD_CHANNEL *channel, Boolean *mute) => INTERNAL_FMOD_Channel_GetMute(channel, mute);
 private static extern FMOD_RESULT INTERNAL_FMOD_Channel_IsPlaying(FMOD_CHANNEL *channel, Boolean *isplaying);
 private static extern FMOD_RESULT INTERNAL_FMOD_Channel_GetMute(FMOD_CHANNEL *channel, Boolean *mute);
 public override sealed FMOD_RESULT FMOD_Channel_GetVolumeRamp(FMOD_CHANNEL *channel, Boolean *ramp) => INTERNAL_FMOD_Channel_GetVolumeRamp(channel, ramp);
 private static extern FMOD_RESULT INTERNAL_FMOD_Channel_GetVolumeRamp(FMOD_CHANNEL *channel, Boolean *ramp);
Beispiel #15
0
 public static FMOD_RESULT FMOD_Channel_IsPlaying(FMOD_CHANNEL *channel, Boolean *isplaying) => pFMOD_Channel_IsPlaying(channel, isplaying);
Beispiel #16
0
 public static extern FMOD_RESULT FMOD_Channel_GetPaused(FMOD_CHANNEL *channel, Boolean *paused);
Beispiel #17
0
 private static extern unsafe void NextStep(Double *t, Double *h, Double *v, Boolean *ishmax, Double *thmax, Double *hmax, Boolean *isvmax, Double *tvmax, Double *hvmax, Double *vmax, Boolean *iskarmanline, Double *tkarmanline, Double *vkarmanline, Boolean *isexosphere, Double *texosphere, Double *vexosphere, Boolean *issecondescape);
Beispiel #18
0
 public static FMOD_RESULT FMOD_Channel_GetPaused(FMOD_CHANNEL *channel, Boolean *paused) => pFMOD_Channel_GetPaused(channel, paused);
 static extern unsafe bool CopyFileEx(string lpExistingFileName, string lpNewFileName, CopyProgressRoutine lpProgressRoutine, IntPtr lpData, Boolean *pbCancel, CopyFileFlags dwCopyFlags);
Beispiel #20
0
 public static extern FMOD_RESULT FMOD_Channel_GetVolumeRamp(FMOD_CHANNEL *channel, Boolean *ramp);
Beispiel #21
0
 public static unsafe bool AreTexturesResident(this ExtTextureObject thisApi, [Flow(FlowDirection.In)] uint n, [Count(Parameter = "n"), Flow(FlowDirection.In)] ReadOnlySpan <Texture> textures, [Count(Parameter = "n"), Flow(FlowDirection.Out)] Boolean *residences)
 {
     // SpanOverloader
     return(thisApi.AreTexturesResident(n, in textures.GetPinnableReference(), residences));
 }
Beispiel #22
0
 public static FMOD_RESULT FMOD_Channel_GetVolumeRamp(FMOD_CHANNEL *channel, Boolean *ramp) => pFMOD_Channel_GetVolumeRamp(channel, ramp);
Beispiel #23
0
 public abstract FMOD_RESULT FMOD_Channel_GetVolumeRamp(FMOD_CHANNEL *channel, Boolean *ramp);
Beispiel #24
0
 public static extern FMOD_RESULT FMOD_Channel_GetMute(FMOD_CHANNEL *channel, Boolean *mute);
Beispiel #25
0
 public abstract FMOD_RESULT FMOD_Channel_IsPlaying(FMOD_CHANNEL *channel, Boolean *isplaying);
Beispiel #26
0
 public static FMOD_RESULT FMOD_Channel_GetMute(FMOD_CHANNEL *channel, Boolean *mute) => pFMOD_Channel_GetMute(channel, mute);
Beispiel #27
0
 public void Read(Boolean *p, Int32 min, Int32 max)
 {
     Runtime.RTError("reading boolean values from text files is not supported");
 }
Beispiel #28
0
 public static extern FMOD_RESULT FMOD_Channel_IsPlaying(FMOD_CHANNEL *channel, Boolean *isplaying);
        static unsafe string EncodeObject(ref object data, UnsafeNativeMethods.EventData *dataDescriptor, byte *dataBuffer)
        {
            dataDescriptor->Reserved = 0;

            string sRet = data as string;

            if (sRet != null)
            {
                dataDescriptor->Size = (uint)((sRet.Length + 1) * 2);
                return(sRet);
            }

            if (data is IntPtr)
            {
                dataDescriptor->Size = (uint)sizeof(IntPtr);
                IntPtr *intptrPtr = (IntPtr *)dataBuffer;
                *       intptrPtr = (IntPtr)data;
                dataDescriptor->DataPointer = (ulong)intptrPtr;
            }
            else if (data is int)
            {
                dataDescriptor->Size = (uint)sizeof(int);
                int *intptrPtr = (int *)dataBuffer;
                *    intptrPtr = (int)data;
                dataDescriptor->DataPointer = (ulong)intptrPtr;
            }
            else if (data is long)
            {
                dataDescriptor->Size = (uint)sizeof(long);
                long *longptr = (long *)dataBuffer;
                *     longptr = (long)data;
                dataDescriptor->DataPointer = (ulong)longptr;
            }
            else if (data is uint)
            {
                dataDescriptor->Size = (uint)sizeof(uint);
                uint *uintptr = (uint *)dataBuffer;
                *     uintptr = (uint)data;
                dataDescriptor->DataPointer = (ulong)uintptr;
            }
            else if (data is UInt64)
            {
                dataDescriptor->Size = (uint)sizeof(ulong);
                UInt64 *ulongptr = (ulong *)dataBuffer;
                *       ulongptr = (ulong)data;
                dataDescriptor->DataPointer = (ulong)ulongptr;
            }
            else if (data is char)
            {
                dataDescriptor->Size = (uint)sizeof(char);
                char *charptr = (char *)dataBuffer;
                *     charptr = (char)data;
                dataDescriptor->DataPointer = (ulong)charptr;
            }
            else if (data is byte)
            {
                dataDescriptor->Size = (uint)sizeof(byte);
                byte *byteptr = (byte *)dataBuffer;
                *     byteptr = (byte)data;
                dataDescriptor->DataPointer = (ulong)byteptr;
            }
            else if (data is short)
            {
                dataDescriptor->Size = (uint)sizeof(short);
                short *shortptr = (short *)dataBuffer;
                *      shortptr = (short)data;
                dataDescriptor->DataPointer = (ulong)shortptr;
            }
            else if (data is sbyte)
            {
                dataDescriptor->Size = (uint)sizeof(sbyte);
                sbyte *sbyteptr = (sbyte *)dataBuffer;
                *      sbyteptr = (sbyte)data;
                dataDescriptor->DataPointer = (ulong)sbyteptr;
            }
            else if (data is ushort)
            {
                dataDescriptor->Size = (uint)sizeof(ushort);
                ushort *ushortptr = (ushort *)dataBuffer;
                *       ushortptr = (ushort)data;
                dataDescriptor->DataPointer = (ulong)ushortptr;
            }
            else if (data is float)
            {
                dataDescriptor->Size = (uint)sizeof(float);
                float *floatptr = (float *)dataBuffer;
                *      floatptr = (float)data;
                dataDescriptor->DataPointer = (ulong)floatptr;
            }
            else if (data is double)
            {
                dataDescriptor->Size = (uint)sizeof(double);
                double *doubleptr = (double *)dataBuffer;
                *       doubleptr = (double)data;
                dataDescriptor->DataPointer = (ulong)doubleptr;
            }
            else if (data is bool)
            {
                dataDescriptor->Size = (uint)sizeof(bool);
                bool *boolptr = (bool *)dataBuffer;
                *     boolptr = (bool)data;
                dataDescriptor->DataPointer = (ulong)boolptr;
            }
            else if (data is Guid)
            {
                dataDescriptor->Size = (uint)sizeof(Guid);
                Guid *guidptr = (Guid *)dataBuffer;
                *     guidptr = (Guid)data;
                dataDescriptor->DataPointer = (ulong)guidptr;
            }
            else if (data is decimal)
            {
                dataDescriptor->Size = (uint)sizeof(decimal);
                decimal *decimalptr = (decimal *)dataBuffer;
                *        decimalptr = (decimal)data;
                dataDescriptor->DataPointer = (ulong)decimalptr;
            }
            else if (data is Boolean)
            {
                dataDescriptor->Size = (uint)sizeof(Boolean);
                Boolean *booleanptr = (Boolean *)dataBuffer;
                *        booleanptr = (Boolean)data;
                dataDescriptor->DataPointer = (ulong)booleanptr;
            }
            else
            {
                // Everything else is a just a string
                sRet = data.ToString();
                dataDescriptor->Size = (uint)((sRet.Length + 1) * 2);
                return(sRet);
            }

            return(null);
        }
 private static extern FMOD_RESULT INTERNAL_FMOD_Channel_GetPaused(FMOD_CHANNEL *channel, Boolean *paused);