Esempio n. 1
0
        // Token: 0x06000900 RID: 2304 RVA: 0x000238E4 File Offset: 0x00021AE4
        internal List <ConditionalResults> Evaluate(IReadOnlyPropertyBag propertyBag)
        {
            List <BaseConditionalRegistration> values = this.cache.Values;

            if (values == null || values.Count == 0)
            {
                return(null);
            }
            List <ConditionalResults> list = null;

            foreach (BaseConditionalRegistration baseConditionalRegistration in values)
            {
                ConditionalResults conditionalResults = baseConditionalRegistration.Evaluate(propertyBag);
                if (conditionalResults != null)
                {
                    if (list == null)
                    {
                        list = new List <ConditionalResults>();
                    }
                    list.Add(conditionalResults);
                    ConditionalRegistration conditionalRegistration = baseConditionalRegistration as ConditionalRegistration;
                    if (conditionalRegistration != null)
                    {
                        int currentHits = conditionalRegistration.CurrentHits;
                        if (currentHits >= conditionalRegistration.MaxHits)
                        {
                            ExTraceGlobals.DiagnosticHandlersTracer.TraceDebug <string, int, int>((long)this.GetHashCode(), "[ConditionalRegistrationCache.Evaluate] Removing entry '{0}' because current hits {1} exceeds MaxHits {2}.", conditionalRegistration.Cookie, currentHits, conditionalRegistration.MaxHits);
                            this.cache.Remove(baseConditionalRegistration.Cookie);
                        }
                    }
                }
            }
            return(list);
        }
Esempio n. 2
0
        public static string Save(ConditionalResults hit)
        {
            string fullPathForCookie = ConditionalRegistrationLog.GetFullPathForCookie(hit.Registration.User.Replace("/", "-"), hit.Registration.Cookie);

            ConditionalRegistrationLog.LimitFileCount(fullPathForCookie);
            ExTraceGlobals.DiagnosticHandlersTracer.TraceDebug <string, string>(0L, "[ConditionalRegistrationLog.Log] Logging registration results for '{0}' to path '{1}'", hit.Registration.Cookie, fullPathForCookie);
            try
            {
                using (XmlWriter xmlWriter = XmlWriter.Create(fullPathForCookie, ConditionalRegistrationLog.writerSettings))
                {
                    hit.GetXmlResults().WriteTo(xmlWriter);
                    xmlWriter.Flush();
                }
            }
            catch (Exception arg)
            {
                ExTraceGlobals.DiagnosticHandlersTracer.TraceDebug <string, Exception>(0L, "[ConditionalRegistrationLog.Log] Caught exception trying to save hit for cookie: {0}.  Exception: {1}", hit.Registration.Cookie, arg);
            }
            return(fullPathForCookie);
        }