Esempio n. 1
0
        /// <summary>
        /// Extract <c>int</c> information from an <c>Easy</c> object.
        /// </summary>
        /// <param name="info">One of the values in the
        /// <see cref="CURLINFO"/> enumeration. In this case, it must
        /// specifically be one of the members that obtains an <c>int</c>.
        /// </param>
        /// <param name="intVal">Reference to an <c>int</c> value.</param>
        /// <returns>The <see cref="CURLcode"/> obtained from the internal
        /// call to <c>curl_easy_getinfo()</c>.
        /// </returns>
        /// <exception cref="System.NullReferenceException">This is thrown if
        /// the native <c>CURL*</c> handle wasn't created successfully.</exception>
        public CURLcode GetInfo(CURLINFO info, ref int intVal)
        {
            EnsureHandle();
            CURLcode retCode = CURLcode.CURLE_OK;

            int ptr = 0;

            // ensure it's an integral type
            if ((int)info < CURLINFO_LONG || (int)info >= CURLINFO_DOUBLE)
            {
                return(CURLcode.CURLE_BAD_FUNCTION_ARGUMENT);
            }

            retCode = External.curl_easy_getinfo_int(m_pCURL, info, ref ptr);
            if (retCode == CURLcode.CURLE_OK)
            {
                intVal = (int)ptr;
            }
            return(retCode);
        }