Example #1
0
 private void SetContextOption(ContextOption option, int value)
 {
     if (_contextProxy.SetContextOption((int)option, value) == -1)
     {
         throw new ZmqException(ErrorProxy.GetLastError());
     }
 }
Example #2
0
 public static void CtxSet(Ctx ctx, ContextOption option, int optval)
 {
     if (ctx == null || !ctx.CheckTag())
     {
         throw NetMQException.Create(ErrorCode.EFAULT);
     }
     ctx.Set(option, optval);
 }
Example #3
0
 public static int CtxGet(Ctx ctx, ContextOption option)
 {
     if (ctx == null || !ctx.CheckTag())
     {
         throw NetMQException.Create(ErrorCode.EFAULT);
     }
     return(ctx.Get(option));
 }
Example #4
0
 /// <summary>
 /// Return either the max-sockets or the I/O-thread-count, depending upon which ContextOption is indicated.
 /// </summary>
 /// <param name="option">this determines which of the two properties to get</param>
 public int Get(ContextOption option)
 {
     if (option == ContextOption.MaxSockets)
     {
         return(m_maxSockets);
     }
     if (option == ContextOption.IOThreads)
     {
         return(m_ioThreadCount);
     }
     throw new InvalidException(String.Format("In Ctx.Get({0}), option must be MaxSockets or IOThreads.", option));
 }
 // public methods...
 #region PropagateChoiceToParents
 public void PropagateChoiceToParents()
 {
     if (_Parent != null)
     {
         ContextOption lSaveParentChoice = _Parent.Choice;
         ContextOption lNewParentChoice  = _Parent.CalculateState();
         if (lNewParentChoice != lSaveParentChoice)
         {
             _Parent.PropagateChoiceToParents();
         }
     }
 }
Example #6
0
File: Ctx.cs Project: xuzhe35/netmq
 public int Get(ContextOption option)
 {
     if (option == ContextOption.MaxSockets)
     {
         return(m_maxSockets);
     }
     else if (option == ContextOption.IOThreads)
     {
         return(m_ioThreadCount);
     }
     else
     {
         throw new InvalidException("option = " + option);
     }
 }
Example #7
0
        public int Get(ContextOption option)
        {
            int rc = 0;

            if (option == ContextOption.MaxSockets)
            {
                rc = m_maxSockets;
            }
            else
            if (option == ContextOption.IOThreads)
            {
                rc = m_ioThreadCount;
            }
            else
            {
                throw InvalidException.Create("option = " + option);
            }
            return(rc);
        }
Example #8
0
 /// <summary>
 /// Set either the max-sockets or the I/O-thread-count, depending upon which ContextOption is indicated.
 /// </summary>
 /// <param name="option">this determines which of the two properties to set</param>
 /// <param name="optionValue">the value to assign to that property</param>
 public void Set(ContextOption option, int optionValue)
 {
     if (option == ContextOption.MaxSockets && optionValue >= 1)
     {
         lock (m_optSync)
         {
             m_maxSockets = optionValue;
         }
     }
     else if (option == ContextOption.IOThreads && optionValue >= 0)
     {
         lock (m_optSync)
         {
             m_ioThreadCount = optionValue;
         }
     }
     else
     {
         throw new InvalidException(String.Format("In Ctx.Set({0}, {1}), option must be MaxSockets or IOThreads, and optionValue >= 1 or 0.", option, optionValue));
     }
 }
        public ContextOption CalculateState()
        {
            bool firstTime = true;

            _Choice = ContextOption.Ignored;
            foreach (ContextEntry contextEntry in _SubContext)
            {
                if (firstTime)
                {
                    firstTime = false;
                    _Choice   = contextEntry.Choice;
                }
                else
                if (_Choice != contextEntry.Choice)
                {
                    _Choice = ContextOption.Mixed;
                    break;
                }
            }
            return(_Choice);
        }
Example #10
0
File: Ctx.cs Project: xuzhe35/netmq
 public void Set(ContextOption option, int optval)
 {
     if (option == ContextOption.MaxSockets && optval >= 1)
     {
         lock (m_optSync)
         {
             m_maxSockets = optval;
         }
     }
     else if (option == ContextOption.IOThreads && optval >= 0)
     {
         lock (m_optSync)
         {
             m_ioThreadCount = optval;
         }
     }
     else
     {
         throw new InvalidException("option = " + option);
     }
 }
Example #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="httpContext"></param>
        /// <param name="option"></param>
        /// <param name="siteCollectionUrl"></param>
        private void ExecuteConstructor(HttpContext httpContext, ContextOption option, string siteCollectionUrl = null)
        {
            this.SharePointClientCtx = null;
            try
            {
                switch (option)
                {
                case ContextOption.OneListGuid:
                    if (!string.IsNullOrWhiteSpace(siteCollectionUrl))
                    {
                        this.SharePointClientCtx = this.StartObjectVariables(httpContext, siteCollectionUrl);
                        this.ListContext         = this.SharePointClientCtx.Web.Lists.GetById(this.ListGuid);
                    }
                    else
                    {
                        this.SharePointClientCtx = this.StartObjectVariables(httpContext);
                        this.ListContext         = this.SharePointClientCtx.Web.Lists.GetById(this.ListGuid);
                    }
                    break;

                case ContextOption.MultipleListsGuids:
                    if (!string.IsNullOrWhiteSpace(siteCollectionUrl))
                    {
                        this.SharePointClientCtx = this.StartObjectVariables(httpContext, siteCollectionUrl);
                        this.ListsContext        = new Dictionary <string, List>();
                        this.ListsContext        = this.ContextingLists(this.SharePointClientCtx.Web, this.ListGuids).ToDictionary(x => x.Key, x => x.Value);
                    }
                    else
                    {
                        this.SharePointClientCtx = this.StartObjectVariables(httpContext);
                        this.ListsContext        = new Dictionary <string, List>();
                        this.ListsContext        = this.ContextingLists(this.SharePointClientCtx.Web, this.ListGuids).ToDictionary(x => x.Key, x => x.Value);
                    }
                    break;

                case ContextOption.OneListName:
                    if (!string.IsNullOrWhiteSpace(siteCollectionUrl))
                    {
                        this.SharePointClientCtx = this.StartObjectVariables(httpContext, siteCollectionUrl, this.ListName);
                        this.ListContext         = this.SharePointClientCtx.Web.Lists.GetByTitle(this.ListName);
                    }
                    else
                    {
                        this.SharePointClientCtx = this.StartObjectVariables(httpContext);
                        this.ListContext         = this.SharePointClientCtx.Web.Lists.GetByTitle(this.ListName);
                    }
                    break;

                case ContextOption.MultipleListsNames:
                    if (!string.IsNullOrWhiteSpace(siteCollectionUrl))
                    {
                        this.SharePointClientCtx = this.StartObjectVariables(httpContext, siteCollectionUrl);
                        this.ListsContext        = new Dictionary <string, List>();
                        this.ListsContext        = this.ContextingLists(this.SharePointClientCtx.Web, this.ListNames).ToDictionary(x => x.Key, x => x.Value);
                    }
                    else
                    {
                        this.SharePointClientCtx = this.StartObjectVariables(httpContext);
                        this.ListsContext        = new Dictionary <string, List>();
                        this.ListsContext        = this.ContextingLists(this.SharePointClientCtx.Web, this.ListNames).ToDictionary(x => x.Key, x => x.Value);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Ocorreu algum durante a rotina de autenticaĆ§Ć£o ao SharePoint.", ex);
            }
        }
Example #12
0
 public static int CtxGet(Ctx ctx, ContextOption option)
 {
     if (ctx == null || !ctx.CheckTag())
     {
         throw NetMQException.Create(ErrorCode.EFAULT);
     }
     return ctx.Get(option);
 }
Example #13
0
 public static void CtxSet(Ctx ctx, ContextOption option, int optval)
 {
     if (ctx == null || !ctx.CheckTag())
     {
         throw NetMQException.Create(ErrorCode.EFAULT);
     }
     ctx.Set(option, optval);
 }
Example #14
0
File: ZMQ.cs Project: knocte/netmq
 public static int CtxGet(Ctx ctx, ContextOption option)
 {
     if (ctx == null || !ctx.CheckTag())
     {
         throw new InvalidOperationException();
     }
     return ctx.Get(option);
 }
Example #15
0
 public static extern Result zmq_ctx_set(this context context, ContextOption option, int optval);
Example #16
0
 public void Set(ContextOption option, int optval)
 {
     if (option == ContextOption.MaxSockets && optval >= 1)
     {
         lock (m_optSync)
         {
             m_maxSockets = optval;
         }
     }
     else
         if (option == ContextOption.IOThreads && optval >= 0)
         {
             lock (m_optSync)
             {
                 m_ioThreadCount = optval;
             }
         }
         else
         {
             throw new ArgumentException("option = " + option);
         }
 }
Example #17
0
 public int Get(ContextOption option)
 {
     int rc = 0;
     if (option == ContextOption.MaxSockets)
         rc = m_maxSockets;
     else
         if (option == ContextOption.IOThreads)
             rc = m_ioThreadCount;
         else
         {
             throw new ArgumentException("option = " + option);
         }
     return rc;
 }
Example #18
0
 public int Get(ContextOption option)
 {
     int rc = 0;
     if (option == ContextOption.MaxSockets)
         rc = m_maxSockets;
     else
         if (option == ContextOption.IOThreads)
             rc = m_ioThreadCount;
         else
         {
             throw InvalidException.Create("option = " + option);
         }
     return rc;
 }
Example #19
0
 /// <summary>
 /// Return either the max-sockets or the I/O-thread-count, depending upon which ContextOption is indicated.
 /// </summary>
 /// <param name="option">this determines which of the two properties to get</param>
 /// <exception cref="InvalidException">option must be MaxSockets or IOThreads.</exception>
 public int Get(ContextOption option)
 {
     if (option == ContextOption.MaxSockets)
         return m_maxSockets;
     if (option == ContextOption.IOThreads)
         return m_ioThreadCount;
     throw new InvalidException(string.Format("In Ctx.Get({0}), option must be MaxSockets or IOThreads.", option));
 }
Example #20
0
 /// <summary>
 /// Set either the max-sockets or the I/O-thread-count, depending upon which ContextOption is indicated.
 /// </summary>
 /// <param name="option">this determines which of the two properties to set</param>
 /// <param name="optionValue">the value to assign to that property</param>
 /// <exception cref="InvalidException">option must be MaxSockets with optionValue >= 1, or IOThreads with optionValue >= 0.</exception>
 public void Set(ContextOption option, int optionValue)
 {
     if (option == ContextOption.MaxSockets && optionValue >= 1)
     {
         lock (m_optSync)
         {
             m_maxSockets = optionValue;
         }
     }
     else if (option == ContextOption.IOThreads && optionValue >= 0)
     {
         lock (m_optSync)
         {
             m_ioThreadCount = optionValue;
         }
     }
     else
     {
         throw new InvalidException(string.Format("In Ctx.Set({0}, {1}), option must be MaxSockets with optionValue >= 1, or IOThreads with optionValue >= 0.", option, optionValue));
     }
 }
Example #21
0
 public static extern int zmq_ctx_get(this context context, ContextOption option);
Example #22
0
File: ZMQ.cs Project: knocte/netmq
 public static void CtxSet(Ctx ctx, ContextOption option, int optval)
 {
     if (ctx == null || !ctx.CheckTag())
     {
         throw new InvalidOperationException();
     }
     ctx.Set(option, optval);
 }