예제 #1
0
        public bool SetOption(KeystoneOptionType type, uint value)
        {
            KeystoneError result = KeystoneImports.SetOption(this.engine, type, (IntPtr)(long)value);

            if (result == KeystoneError.KS_ERR_OK)
            {
                return(true);
            }
            if (this.throwOnError)
            {
                throw new InvalidOperationException(string.Format("Error while setting option in keystone: {0}", (object)Keystone.ErrorToString(result)));
            }
            return(false);
        }
예제 #2
0
        /// <summary>
        /// Set an option in the engine.
        /// </summary>
        /// <param name="type">Type of option</param>
        /// <param name="value">Value</param>
        /// <returns>True is the option is correctly setted, False otherwise &amp;&amp; throwOnError is false.</returns>
        /// <exception cref="InvalidOperationException">If Keystone return an error &amp;&amp; throwOnError is true</exception>
        public bool SetOption(KeystoneOptionType type, uint value)
        {
            var result = KeystoneImports.SetOption(engine, type, (IntPtr)value);

            if (result != KeystoneError.KS_ERR_OK)
            {
                if (throwOnError)
                {
                    throw new InvalidOperationException($"Error while setting option in keystone: {ErrorToString(result)}");
                }
                return(false);
            }

            return(true);
        }