예제 #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="method"></param>
        internal QueryMonitor(APIMethods method)
        {
            m_lastUpdate      = DateTime.MinValue;
            m_isFullKeyNeeded = method.HasAttribute <FullKeyAttribute>();
            m_methodHeader    = (method.HasHeader() ? method.GetHeader() : String.Empty);
            m_forceUpdate     = true;
            m_method          = method;
            m_enabled         = true;

            bool methodHasAttribute = m_method.HasAttribute <UpdateAttribute>();

            m_cacheStyle = (methodHasAttribute ? m_method.GetAttribute <UpdateAttribute>().CacheStyle : CacheStyle.Short);

            NetworkMonitor.Register(this);
        }
예제 #2
0
        /// <summary>
        /// Gets the available update periods for the given method.
        /// </summary>
        /// <param name="method"></param>
        /// <returns></returns>
        private List <UpdatePeriod> GetUpdatePeriods(APIMethods method)
        {
            List <UpdatePeriod> periods = new List <UpdatePeriod>();

            periods.Add(UpdatePeriod.Never);

            var updateAttribute = method.GetAttribute <UpdateAttribute>();
            int min             = (int)updateAttribute.Minimum;
            int max             = (int)updateAttribute.Maximum;

            foreach (UpdatePeriod period in Enum.GetValues(typeof(UpdatePeriod)))
            {
                if (period != UpdatePeriod.Never)
                {
                    int index = (int)period;
                    if (index >= min && index <= max)
                    {
                        periods.Add(period);
                    }
                }
            }

            return(periods);
        }
예제 #3
0
        /// <summary>
        /// Gets the available update periods for the given method.
        /// </summary>
        /// <param name="method"></param>
        /// <returns></returns>
        private List<UpdatePeriod> GetUpdatePeriods(APIMethods method)
        {
            List<UpdatePeriod> periods = new List<UpdatePeriod>();
            periods.Add(UpdatePeriod.Never);

            var updateAttribute = method.GetAttribute<UpdateAttribute>();
            int min = (int)updateAttribute.Minimum;
            int max = (int)updateAttribute.Maximum;

            foreach (UpdatePeriod period in Enum.GetValues(typeof(UpdatePeriod)))
            {
                if (period != UpdatePeriod.Never)
                {
                    int index = (int)period;
                    if (index >= min && index <= max)
                        periods.Add(period);
                }
            }

            return periods;
        }