Ejemplo n.º 1
0
        /// <summary>
        /// Creates a Chroma Link effect with the specified parameters.
        /// </summary>
        /// <param name="effectType">The type of Chroma Link effect to create.</param>
        /// <param name="param">Effect-specific parameters.</param>
        /// <returns>A <see cref="Guid" /> for the created effect.</returns>
        private Guid CreateChromaLinkEffect(Effects.ChromaLink.ChromaLinkEffectType effectType, IntPtr param)
        {
            var guid   = Guid.Empty;
            var result = _nativeSdkMethods.CreateChromaLinkEffect(effectType, param, ref guid);

            if (!result)
            {
                throw new NativeCallException("CreateChromaLinkEffect", result);
            }
            return(guid);
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        /// <summary>
        /// Helper method for creating Chroma Link effects with parameter struct.
        /// </summary>
        /// <typeparam name="T">The effect struct type.</typeparam>
        /// <param name="effectType">The type of effect to create.</param>
        /// <param name="data">Effect options struct.</param>
        /// <returns>A <see cref="Guid" /> for the created effect.</returns>
        public Task <Guid> CreateChromaLinkEffectAsync <T>(Effects.ChromaLink.ChromaLinkEffectType effectType, T data)
            where T : struct
        {
            var ptr = Marshal.AllocHGlobal(Marshal.SizeOf(data));

            Marshal.StructureToPtr(data, ptr, false);

            try
            {
                return(Task.FromResult(CreateChromaLinkEffect(effectType, ptr)));
            }
            finally
            {
                Marshal.FreeHGlobal(ptr);
            }
        }
Ejemplo n.º 3
0
 /// <inheritdoc />
 /// <summary>
 /// Creates a new Chroma Link effect with the specified effect data by sending a POST request to the Chroma Link API.
 /// </summary>
 /// <typeparam name="T">The effect struct type.</typeparam>
 /// <param name="effectType">The type of effect to create.</param>
 /// <param name="data">Effect options struct.</param>
 /// <returns>A <see cref="Guid" /> for the created effect.</returns>
 public async Task <Guid> CreateChromaLinkEffectAsync <T>(Effects.ChromaLink.ChromaLinkEffectType effectType, T data) where T : struct
 {
     return(await CreateEffectAsync("/chromalink", data).ConfigureAwait(false));
 }
Ejemplo n.º 4
0
 /// <inheritdoc />
 /// <summary>
 /// Creates a new Chroma Link effect without any effect data by sending a POST request to the Chroma Link API.
 /// </summary>
 /// <param name="effectType">The type of effect to create.</param>
 /// <returns>A <see cref="Guid" /> for the created effect.</returns>
 public async Task <Guid> CreateChromaLinkEffectAsync(Effects.ChromaLink.ChromaLinkEffectType effectType)
 {
     return(await CreateEffectAsync("/chromalink", new EffectData(effectType)).ConfigureAwait(false));
 }
Ejemplo n.º 5
0
 /// <inheritdoc />
 /// <summary>
 /// Creates a new Chroma Link effect without any effect data.
 /// </summary>
 /// <param name="effectType">The type of effect to create.</param>
 /// <returns>A <see cref="Guid" /> for the created effect.</returns>
 public Task <Guid> CreateChromaLinkEffectAsync(Effects.ChromaLink.ChromaLinkEffectType effectType)
 {
     return(Task.FromResult(CreateChromaLinkEffect(effectType, IntPtr.Zero)));
 }