Ejemplo n.º 1
0
 private void SetContextOption(ContextOption option, int value)
 {
     if (_contextProxy.SetContextOption((int)option, value) == -1)
     {
         throw new ZmqException(ErrorProxy.GetLastError());
     }
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 3
0
 public static int CtxGet(Ctx ctx, ContextOption option)
 {
     if (ctx == null || !ctx.CheckTag())
     {
         throw NetMQException.Create(ErrorCode.EFAULT);
     }
     return(ctx.Get(option));
 }
Ejemplo n.º 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();
         }
     }
 }
Ejemplo n.º 6
0
Archivo: Ctx.cs Proyecto: 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);
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 10
0
Archivo: Ctx.cs Proyecto: 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);
     }
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 12
0
 public static int CtxGet(Ctx ctx, ContextOption option)
 {
     if (ctx == null || !ctx.CheckTag())
     {
         throw NetMQException.Create(ErrorCode.EFAULT);
     }
     return ctx.Get(option);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 14
0
Archivo: ZMQ.cs Proyecto: knocte/netmq
 public static int CtxGet(Ctx ctx, ContextOption option)
 {
     if (ctx == null || !ctx.CheckTag())
     {
         throw new InvalidOperationException();
     }
     return ctx.Get(option);
 }
Ejemplo n.º 15
0
 public static extern Result zmq_ctx_set(this context context, ContextOption option, int optval);
Ejemplo n.º 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);
         }
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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));
     }
 }
Ejemplo n.º 21
0
 public static extern int zmq_ctx_get(this context context, ContextOption option);
Ejemplo n.º 22
0
Archivo: ZMQ.cs Proyecto: knocte/netmq
 public static void CtxSet(Ctx ctx, ContextOption option, int optval)
 {
     if (ctx == null || !ctx.CheckTag())
     {
         throw new InvalidOperationException();
     }
     ctx.Set(option, optval);
 }