Beispiel #1
0
        public bool IsMatchingEventInfo(StackHashEventInfo eventInfo)
        {
            if (eventInfo == null)
            {
                throw new ArgumentNullException("eventInfo");
            }

            if (this.m_HitDateLocal != eventInfo.HitDateLocal)
            {
                return(false);
            }

            if (this.m_Lcid != eventInfo.Lcid)
            {
                return(false);
            }
            //if (String.Compare(this.m_Locale, eventInfo.Locale, StringComparison.OrdinalIgnoreCase) != 0)
            //    return false;
            //if (String.Compare(this.m_Language, eventInfo.Language, StringComparison.OrdinalIgnoreCase) != 0)
            //    return false;
            if (String.Compare(this.m_OperatingSystemName, eventInfo.OperatingSystemName, StringComparison.OrdinalIgnoreCase) != 0)
            {
                return(false);
            }
            if (String.Compare(this.m_OperatingSystemVersion, eventInfo.m_OperatingSystemVersion, StringComparison.OrdinalIgnoreCase) != 0)
            {
                return(false);
            }

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// Updates the statistics based on the specified event info.
        /// Each Event info will cause an update to each of the stats lists.
        /// </summary>
        /// <param name="eventInfo">New event info.</param>
        public void AddNewEventInfo(StackHashEventInfo eventInfo)
        {
            if (eventInfo == null)
            {
                throw new ArgumentNullException("eventInfo");
            }

            // ******************************************************
            // Update the locale rollup stats.
            // ******************************************************
            StackHashProductLocaleSummary localeSummary = m_LocaleSummaryCollection.FindLocale((int)eventInfo.Lcid);

            if (localeSummary == null)
            {
                // Not found so add a new entry.
                localeSummary = new StackHashProductLocaleSummary(eventInfo.Language, eventInfo.Lcid, eventInfo.Locale, eventInfo.TotalHits);
                m_LocaleSummaryCollection.Add(localeSummary);
            }
            else
            {
                // Add the total hits to the existing entry.
                localeSummary.TotalHits += eventInfo.TotalHits;
            }

            // ******************************************************
            // Update the OS stats.
            // ******************************************************
            StackHashProductOperatingSystemSummary operatingSystemSummary =
                m_OperatingSystemSummaryCollection.FindOperatingSystem(eventInfo.OperatingSystemName, eventInfo.OperatingSystemVersion);

            if (operatingSystemSummary == null)
            {
                // Not found so add a new entry.
                operatingSystemSummary = new StackHashProductOperatingSystemSummary(eventInfo.OperatingSystemName, eventInfo.OperatingSystemVersion, eventInfo.TotalHits);
                m_OperatingSystemSummaryCollection.Add(operatingSystemSummary);
            }
            else
            {
                // Add the total hits to the existing entry.
                operatingSystemSummary.TotalHits += eventInfo.TotalHits;
            }

            // ******************************************************
            // Update the HitDate stats.
            // ******************************************************
            StackHashProductHitDateSummary hitDateSummary = m_HitDateSummaryCollection.FindHitDate(eventInfo.HitDateLocal);

            if (hitDateSummary == null)
            {
                // Not found so add a new entry.
                hitDateSummary = new StackHashProductHitDateSummary(eventInfo.HitDateLocal, eventInfo.TotalHits);
                m_HitDateSummaryCollection.Add(hitDateSummary);
            }
            else
            {
                // Add the total hits to the existing entry.
                hitDateSummary.TotalHits += eventInfo.TotalHits;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Clones a copy of the event info.
        /// </summary>
        /// <returns>Cloned copy of EventInfo.</returns>
        public object Clone()
        {
            StackHashEventInfo eventInfo = new StackHashEventInfo(m_DateCreatedLocal, m_DateModifiedLocal,
                                                                  m_HitDateLocal, m_Language, m_Lcid, m_Locale, m_OperatingSystemName, m_OperatingSystemVersion,
                                                                  m_TotalHits);

            return(eventInfo);
        }
Beispiel #4
0
        /// <summary>
        /// There are 4 WinQual mirror sites.
        ///
        /// US - Americas.winqual.microsoft.com (131.107.97.31) – (UTC minus 7)
        /// This always returns a time of 07:00:00 UTC for hit dates. Date = say 25-Oct-2010
        ///
        /// UK - Europe.winqual.microsoft.com (94.245.126.63) (UTC plus 1)
        /// This always returns a time of 23:00:00 UTC for hit dates. Date = say 24-Oct-2010
        ///
        /// Japan - Asia.winqual.microsoft.com (207.46.84.113) (UTC plus 8)
        /// This always returns a time of 15:00:00 UTC for hit dates. Date = say 24-Oct-2010
        ///
        /// Perth Australia - ?.winqual.microsoft.com (207.46.52.39) (UTC plus 9)
        /// This always returns a time of 16:00:00 UTC for hit dates. Date = say 24-Oct-2010
        ///
        /// When I make a request to https:\\winqual.microsoft.com I get a different resolved IP address each time (Verified by continuous pinging - I suspect this is the load balancing in action). i.e. sometimes I get directed to Japan, other times to US etc...
        /// This results in one of the different times / dates that I see for the same EventInfo.
        ///
        /// The reason for the difference in date and time is, I believe, as follows.
        ///
        /// The code on the winqual server gets the hit date (STORED AS DATE ONLY) from the database – and uses it to create a DateTime object which will default to LOCAL TIME. The date will therefore be something like “25-Oct-2010 00:00:00 Local”.
        /// When sending in the Atom Feed, it needs to turn it into UTC for transmission. This Local to UTC conversion will erroneously change the date and time.
        ///
        /// e.g.
        /// The US server will take the 25-Oct-2010 00:00:00 Local and convert to 25-Oct-2010 07:00:00 UTC (plus 7 hours – date stays the same).
        /// The UK server will take the 25-Oct-2010 00:00:00 Local and convert to 24-Oct-2010 23:00:00 UTC (minus 1 hour – causes date change).
        /// The Australian server will take the 25-Oct-2010 00:00:00 Local and convert to 24-Oct-2010 15:00:00 UTC (minus 9 hours – causes date change).
        /// The Japanese server will take the 25-Oct-2010 00:00:00 Local and convert to 24-Oct-2010 16:00:00 UTC (minus 8 hours – causes date change).
        ///
        /// This is exactly what I am seeing. If I ALWAYS connected to the same server, then this wouldn’t be a problem. However, because I end up connecting to different servers depending on load and possibly location, then I get different data back from each server resulting in what appears to me as different EventInfo’s.
        ///
        /// WORKAROUND.
        /// If this is the issue, then I can work around the issue by converting affected dates as follows.
        ///
        /// If (Time part of the date >= 12:00:00)
        ///     Increment the date.
        ///     Set the time part to 00:00:00
        /// Else
        ///     Set the time part to 00:00:00  // The date should be correct.
        ///
        /// This effectively unwinds the Local to UTC conversion that the server is applying to give me the correct date.
        ///
        /// </summary>
        /// <returns>Normalized copy of the event info.</returns>
        public StackHashEventInfo Normalize()
        {
            // Make a copy of the event info before changing anything.
            StackHashEventInfo normalizedEventInfo = (StackHashEventInfo)this.Clone();

            normalizedEventInfo.HitDateLocal = NormalizeDate(m_HitDateLocal);

            return(normalizedEventInfo);
        }
Beispiel #5
0
        public void SetWinQualFields(StackHashEventInfo eventInfo)
        {
            if (eventInfo == null)
            {
                throw new ArgumentNullException("eventInfo");
            }

            m_DateCreatedLocal  = eventInfo.DateCreatedLocal;
            m_DateModifiedLocal = eventInfo.DateModifiedLocal;
            m_HitDateLocal      = eventInfo.HitDateLocal;
            m_Language          = eventInfo.Language;
            m_Lcid   = eventInfo.Lcid;
            m_Locale = eventInfo.Locale;
            m_OperatingSystemName    = eventInfo.OperatingSystemName;
            m_OperatingSystemVersion = eventInfo.OperatingSystemVersion;
            m_TotalHits        = eventInfo.TotalHits;
            m_StructureVersion = eventInfo.StructureVersion;
        }
Beispiel #6
0
        public int CompareTo(object obj)
        {
            StackHashEventInfo eventInfo = obj as StackHashEventInfo;

            if ((this.m_DateCreatedLocal == eventInfo.DateCreatedLocal) &&
                (this.m_DateModifiedLocal == eventInfo.DateModifiedLocal) &&
                (this.m_HitDateLocal == eventInfo.HitDateLocal) &&
                (this.m_Language == eventInfo.Language) &&
                (this.m_Lcid == eventInfo.Lcid) &&
                (this.m_Locale == eventInfo.m_Locale) &&
                (this.m_OperatingSystemName == eventInfo.OperatingSystemName) &&
                (this.m_OperatingSystemVersion == eventInfo.m_OperatingSystemVersion) &&
                (this.m_TotalHits == eventInfo.TotalHits))
            {
                return(0);
            }
            else
            {
                return(-1);
            }
        }
Beispiel #7
0
        }                                        // Needed to serialize;

        public StackHashEventInfoPackage(int eventId, String eventTypeName, StackHashEventInfo eventInfo)
        {
            m_EventInfo     = eventInfo;
            m_EventId       = eventId;
            m_EventTypeName = eventTypeName;
        }