Ejemplo n.º 1
0
        /// <summary>
        /// Returns true if LightingZoneStatus instances are equal
        /// </summary>
        /// <param name="other">Instance of LightingZoneStatus to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(LightingZoneStatus other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     LastUpdate == other.LastUpdate ||
                     LastUpdate != null &&
                     LastUpdate.Equals(other.LastUpdate)
                 ) &&
                 (
                     Level == other.Level ||
                     Level != null &&
                     Level.Equals(other.Level)
                 ));
        }
Ejemplo n.º 2
0
        public bool Equals(GeneralUser input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     MembershipId == input.MembershipId ||
                     (MembershipId.Equals(input.MembershipId))
                     ) &&
                 (
                     UniqueName == input.UniqueName ||
                     (UniqueName != null && UniqueName.Equals(input.UniqueName))
                 ) &&
                 (
                     NormalizedName == input.NormalizedName ||
                     (NormalizedName != null && NormalizedName.Equals(input.NormalizedName))
                 ) &&
                 (
                     DisplayName == input.DisplayName ||
                     (DisplayName != null && DisplayName.Equals(input.DisplayName))
                 ) &&
                 (
                     ProfilePicture == input.ProfilePicture ||
                     (ProfilePicture.Equals(input.ProfilePicture))
                 ) &&
                 (
                     ProfileTheme == input.ProfileTheme ||
                     (ProfileTheme.Equals(input.ProfileTheme))
                 ) &&
                 (
                     UserTitle == input.UserTitle ||
                     (UserTitle.Equals(input.UserTitle))
                 ) &&
                 (
                     SuccessMessageFlags == input.SuccessMessageFlags ||
                     (SuccessMessageFlags.Equals(input.SuccessMessageFlags))
                 ) &&
                 (
                     IsDeleted == input.IsDeleted ||
                     (IsDeleted != null && IsDeleted.Equals(input.IsDeleted))
                 ) &&
                 (
                     About == input.About ||
                     (About != null && About.Equals(input.About))
                 ) &&
                 (
                     FirstAccess == input.FirstAccess ||
                     (FirstAccess != null && FirstAccess.Equals(input.FirstAccess))
                 ) &&
                 (
                     LastUpdate == input.LastUpdate ||
                     (LastUpdate != null && LastUpdate.Equals(input.LastUpdate))
                 ) &&
                 (
                     LegacyPortalUid == input.LegacyPortalUid ||
                     (LegacyPortalUid.Equals(input.LegacyPortalUid))
                 ) &&
                 (
                     Context == input.Context ||
                     (Context != null && Context.Equals(input.Context))
                 ) &&
                 (
                     PsnDisplayName == input.PsnDisplayName ||
                     (PsnDisplayName != null && PsnDisplayName.Equals(input.PsnDisplayName))
                 ) &&
                 (
                     XboxDisplayName == input.XboxDisplayName ||
                     (XboxDisplayName != null && XboxDisplayName.Equals(input.XboxDisplayName))
                 ) &&
                 (
                     FbDisplayName == input.FbDisplayName ||
                     (FbDisplayName != null && FbDisplayName.Equals(input.FbDisplayName))
                 ) &&
                 (
                     ShowActivity == input.ShowActivity ||
                     (ShowActivity != null && ShowActivity.Equals(input.ShowActivity))
                 ) &&
                 (
                     Locale == input.Locale ||
                     (Locale != null && Locale.Equals(input.Locale))
                 ) &&
                 (
                     LocaleInheritDefault == input.LocaleInheritDefault ||
                     (LocaleInheritDefault != null && LocaleInheritDefault.Equals(input.LocaleInheritDefault))
                 ) &&
                 (
                     LastBanReportId == input.LastBanReportId ||
                     (LastBanReportId.Equals(input.LastBanReportId))
                 ) &&
                 (
                     ShowGroupMessaging == input.ShowGroupMessaging ||
                     (ShowGroupMessaging != null && ShowGroupMessaging.Equals(input.ShowGroupMessaging))
                 ) &&
                 (
                     ProfilePicturePath == input.ProfilePicturePath ||
                     (ProfilePicturePath != null && ProfilePicturePath.Equals(input.ProfilePicturePath))
                 ) &&
                 (
                     ProfilePictureWidePath == input.ProfilePictureWidePath ||
                     (ProfilePictureWidePath != null && ProfilePictureWidePath.Equals(input.ProfilePictureWidePath))
                 ) &&
                 (
                     ProfileThemeName == input.ProfileThemeName ||
                     (ProfileThemeName != null && ProfileThemeName.Equals(input.ProfileThemeName))
                 ) &&
                 (
                     UserTitleDisplay == input.UserTitleDisplay ||
                     (UserTitleDisplay != null && UserTitleDisplay.Equals(input.UserTitleDisplay))
                 ) &&
                 (
                     StatusText == input.StatusText ||
                     (StatusText != null && StatusText.Equals(input.StatusText))
                 ) &&
                 (
                     StatusDate == input.StatusDate ||
                     (StatusDate != null && StatusDate.Equals(input.StatusDate))
                 ) &&
                 (
                     ProfileBanExpire == input.ProfileBanExpire ||
                     (ProfileBanExpire != null && ProfileBanExpire.Equals(input.ProfileBanExpire))
                 ) &&
                 (
                     BlizzardDisplayName == input.BlizzardDisplayName ||
                     (BlizzardDisplayName != null && BlizzardDisplayName.Equals(input.BlizzardDisplayName))
                 ) &&
                 (
                     SteamDisplayName == input.SteamDisplayName ||
                     (SteamDisplayName != null && SteamDisplayName.Equals(input.SteamDisplayName))
                 ) &&
                 (
                     StadiaDisplayName == input.StadiaDisplayName ||
                     (StadiaDisplayName != null && StadiaDisplayName.Equals(input.StadiaDisplayName))
                 ) &&
                 (
                     TwitchDisplayName == input.TwitchDisplayName ||
                     (TwitchDisplayName != null && TwitchDisplayName.Equals(input.TwitchDisplayName))
                 ) &&
                 (
                     CachedBungieGlobalDisplayName == input.CachedBungieGlobalDisplayName ||
                     (CachedBungieGlobalDisplayName != null && CachedBungieGlobalDisplayName.Equals(input.CachedBungieGlobalDisplayName))
                 ) &&
                 (
                     CachedBungieGlobalDisplayNameCode == input.CachedBungieGlobalDisplayNameCode ||
                     (CachedBungieGlobalDisplayNameCode.Equals(input.CachedBungieGlobalDisplayNameCode))
                 ));
        }
Ejemplo n.º 3
0
        public void UpdateFromUri(Boolean deriveAttributes = false, int retentionDays = -1)
        {
            //WebClient client = new WebClient();
            //using (SyndicationFeedXmlReader x = new SyndicationFeedXmlReader(client.OpenRead(Location)))
            HttpWebRequest httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(Location.ToString());

            httpWebRequest.UserAgent = "Googlebot/1.0 ([email protected] http://googlebot.com/)";

            // Use The Default Proxy
            httpWebRequest.Proxy = System.Net.WebRequest.DefaultWebProxy;

            // Use The Thread's Credentials (Logged In User's Credentials)
            if (httpWebRequest.Proxy != null)
            {
                httpWebRequest.Proxy.Credentials = CredentialCache.DefaultCredentials;
            }

            using (HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse())
            {
                using (Stream responseStream = httpWebResponse.GetResponseStream())
                {
                    using (XmlReader x = XmlReader.Create(responseStream))
                    {
                        SyndicationFeed feed = SyndicationFeed.Load(x);
                        x.Close();
                        if (deriveAttributes)
                        {
                            Title      = feed.Title.Text;
                            LastUpdate = feed.LastUpdatedTime.DateTime;
                            Host       = Location.Host;
                        }

                        // Title is not set
                        if (Title.StartsWith("http"))
                        {
                            Title = feed.Title.Text;
                        }


                        //Date unchanged
                        if (LastUpdate.Equals(feed.LastUpdatedTime.DateTime))
                        {
                            LastUpdate = DateTime.Now;
                        }
                        else
                        {
                            LastUpdate = feed.LastUpdatedTime.DateTime;
                        }

                        foreach (SyndicationItem item in feed.Items)
                        {
                            Article art = new Article();
                            art.ParentFeed  = this;
                            art.Location    = item.Links[0].Uri;
                            art.PublishDate = item.PublishDate.ToLocalTime().DateTime;
                            art.Title       = item.Title.Text;
                            art.Unread      = true;

                            // Some dates don't parse correctly (connect.microsoft.com for instance)
                            if (art.PublishDate.Date.Equals(new DateTime(1, 1, 1)))
                            {
                                art.PublishDate = item.LastUpdatedTime.ToLocalTime().DateTime;
                                if (art.PublishDate.Date.Equals(new DateTime(1, 1, 1)))
                                {
                                    art.PublishDate = LastUpdate;
                                }
                            }

                            // load article from feed only when within retention
                            if (retentionDays > 0 && art.PublishDate >= DateTime.Now.AddDays(-1 * retentionDays))
                            {
                                Articles.Add(art);
                            }


                            // Dates older than 180 days are likely parsing errors too
                            // I can't evaluate the retention policy after setting
                            // the date to the feed's last update, because some
                            // sites "resurrect" older posts and put them in the feed.
                            if (art.PublishDate < DateTime.Now.AddDays(-180))
                            {
                                art.PublishDate = item.LastUpdatedTime.ToLocalTime().DateTime;

                                art.PublishDate = LastUpdate;
                            }
                        }
                    } // using XmlReader
                }     // using Stream
            }         // using HttpWebResponse
        }