Exemple #1
0
        private External.CURLSH_UNLOCK_DELEGATE m_pDelUnlock; // unlock delegate

        /// <summary>
        /// Constructor
        /// </summary>
        /// <exception cref="System.InvalidOperationException">This is thrown
        /// if <see cref="Curl"/> hasn't bee properly initialized.</exception>
        /// <exception cref="System.NullReferenceException">This is thrown if
        /// the native <c>share</c> handle wasn't created successfully.</exception>
        public Share()
        {
            Curl.EnsureCurl();
            m_pShare = External.curl_share_init();
            EnsureHandle();
            m_pfLock   = null;
            m_pfUnlock = null;
            m_userData = null;
            InstallDelegates();
        }
Exemple #2
0
        /// <summary>
        /// Set options for this object.
        /// </summary>
        /// <param name="option">
        /// One of the values in the <see cref="CURLSHoption"/>
        /// enumeration.
        /// </param>
        /// <param name="parameter">
        /// An appropriate object based on the value passed in the
        /// <c>option</c> argument. See <see cref="CURLSHoption"/>
        /// for more information about the appropriate parameter type.
        /// </param>
        /// <returns>
        /// A <see cref="CURLSHcode"/>, hopefully
        /// <c>CURLSHcode.CURLSHE_OK</c>.
        /// </returns>
        /// <exception cref="System.NullReferenceException">This is thrown if
        /// the native <c>share</c> handle wasn't created successfully.</exception>
        public CURLSHcode SetOpt(CURLSHoption option, Object parameter)
        {
            EnsureHandle();
            CURLSHcode retCode = CURLSHcode.CURLSHE_OK;

            switch (option)
            {
            case CURLSHoption.CURLSHOPT_LOCKFUNC:
                LockFunction lf = parameter as LockFunction;
                if (lf == null)
                {
                    return(CURLSHcode.CURLSHE_BAD_OPTION);
                }
                m_pfLock = lf;
                break;

            case CURLSHoption.CURLSHOPT_UNLOCKFUNC:
                UnlockFunction ulf = parameter as UnlockFunction;
                if (ulf == null)
                {
                    return(CURLSHcode.CURLSHE_BAD_OPTION);
                }
                m_pfUnlock = ulf;
                break;

            case CURLSHoption.CURLSHOPT_SHARE:
            case CURLSHoption.CURLSHOPT_UNSHARE:
            {
                CURLlockData opt = (CURLlockData)
                                   Convert.ToInt32(parameter);
                if ((opt != CURLlockData.CURL_LOCK_DATA_COOKIE) &&
                    (opt != CURLlockData.CURL_LOCK_DATA_DNS))
                {
                    return(CURLSHcode.CURLSHE_BAD_OPTION);
                }
                retCode = External.curl_share_setopt(m_pShare,
                                                     option, (IntPtr)opt);
                break;
            }

            case CURLSHoption.CURLSHOPT_USERDATA:
                m_userData = parameter;
                break;

            default:
                retCode = CURLSHcode.CURLSHE_BAD_OPTION;
                break;
            }
            return(retCode);
        }
 public CreatorInformation(EventHandler functionToLaunchCreator, 
     string iconPath, string description, 
     bool paidAddOnFlag = false, 
     UnlockFunction unlockFunction = null,
     PermissionFunction permissionFunction = null, 
     UnlockRegisterFunction unlockRegisterFunction = null)
 {
     this.functionToLaunchCreator = functionToLaunchCreator;
     this.iconPath = iconPath;
     this.description = description;
     this.paidAddOnFlag = paidAddOnFlag;
     this.unlockFunction = unlockFunction;
     this.permissionFunction = permissionFunction;
     this.unlockRegisterFunction = unlockRegisterFunction;
 }
 public CreatorInformation(EventHandler functionToLaunchCreator,
                           string iconPath, string description,
                           bool paidAddOnFlag                            = false,
                           UnlockFunction unlockFunction                 = null,
                           PermissionFunction permissionFunction         = null,
                           UnlockRegisterFunction unlockRegisterFunction = null)
 {
     this.functionToLaunchCreator = functionToLaunchCreator;
     this.iconPath               = iconPath;
     this.description            = description;
     this.paidAddOnFlag          = paidAddOnFlag;
     this.unlockFunction         = unlockFunction;
     this.permissionFunction     = permissionFunction;
     this.unlockRegisterFunction = unlockRegisterFunction;
 }
 public CreatorInformation(
     Action showFunction,
     string iconPath, string description,
     bool paidAddOnFlag                            = false,
     UnlockFunction unlockFunction                 = null,
     PermissionFunction permissionFunction         = null,
     UnlockRegisterFunction unlockRegisterFunction = null)
 {
     this.Show                   = showFunction;
     this.iconPath               = iconPath;
     this.description            = description;
     this.paidAddOnFlag          = paidAddOnFlag;
     this.unlockFunction         = unlockFunction;
     this.permissionFunction     = permissionFunction;
     this.unlockRegisterFunction = unlockRegisterFunction;
 }
Exemple #6
0
        /// <summary>
        /// Set options for this object.
        /// </summary>
        /// <param name="option">
        /// One of the values in the <see cref="CURLSHoption"/>
        /// enumeration.
        /// </param>
        /// <param name="parameter">
        /// An appropriate object based on the value passed in the
        /// <c>option</c> argument. See <see cref="CURLSHoption"/>
        /// for more information about the appropriate parameter type.
        /// </param>
        /// <returns>
        /// A <see cref="CURLSHcode"/>, hopefully
        /// <c>CURLSHcode.CURLSHE_OK</c>.
        /// </returns>
        /// <exception cref="System.NullReferenceException">This is thrown if
        /// the native <c>share</c> handle wasn't created successfully.</exception>
        public CURLSHcode SetOpt(CURLSHoption option, Object parameter)
        {
            EnsureHandle();
            CURLSHcode retCode = CURLSHcode.CURLSHE_OK;

            switch(option)
            {
                case CURLSHoption.CURLSHOPT_LOCKFUNC:
                    LockFunction lf = parameter as LockFunction;
                    if (lf == null)
                        return CURLSHcode.CURLSHE_BAD_OPTION;
                    m_pfLock = lf;
                    break;

                case CURLSHoption.CURLSHOPT_UNLOCKFUNC:
                    UnlockFunction ulf = parameter as UnlockFunction;
                    if (ulf == null)
                        return CURLSHcode.CURLSHE_BAD_OPTION;
                    m_pfUnlock = ulf;
                    break;

                case CURLSHoption.CURLSHOPT_SHARE:
                case CURLSHoption.CURLSHOPT_UNSHARE:
                {
                    CURLlockData opt = (CURLlockData)
                        Convert.ToInt32(parameter);
                    if ((opt != CURLlockData.CURL_LOCK_DATA_COOKIE) &&
                        (opt != CURLlockData.CURL_LOCK_DATA_DNS))
                        return CURLSHcode.CURLSHE_BAD_OPTION;
                    retCode = External.curl_share_setopt(m_pShare,
                        option, (IntPtr)opt);
                    break;
                }

                case CURLSHoption.CURLSHOPT_USERDATA:
                    m_userData = parameter;
                    break;

                default:
                    retCode = CURLSHcode.CURLSHE_BAD_OPTION;
                    break;
            }
            return retCode;
        }
Exemple #7
0
        private External.CURLSH_UNLOCK_DELEGATE  m_pDelUnlock;   // unlock delegate

        /// <summary>
        /// Constructor
        /// </summary>
        /// <exception cref="System.InvalidOperationException">This is thrown
        /// if <see cref="Curl"/> hasn't bee properly initialized.</exception>
        /// <exception cref="System.NullReferenceException">This is thrown if
        /// the native <c>share</c> handle wasn't created successfully.</exception>
        public Share()
		{
            Curl.EnsureCurl();
            m_pShare = External.curl_share_init();
            EnsureHandle();
            m_pfLock = null;
            m_pfUnlock = null;
            m_userData = null;
            InstallDelegates();
		}