/// <summary> /// /// </summary> /// <param name="other"></param> /// <returns></returns> public bool Equals(User other) { if (other == null) { return(false); } return( Id == other.Id && Login.Equals(other.Login) //&& Password.Equals(other.Password) && FirstName.Equals(other.FirstName) && LastName.Equals(other.LastName) && Email.Equals(other.Email) && MailNotification.Equals(other.MailNotification) && (ApiKey != null ? ApiKey.Equals(other.ApiKey) : other.ApiKey == null) && AuthenticationModeId == other.AuthenticationModeId && CreatedOn == other.CreatedOn && LastLoginOn == other.LastLoginOn && Status == other.Status && MustChangePassword == other.MustChangePassword && (CustomFields != null ? CustomFields.Equals <IssueCustomField>(other.CustomFields) : other.CustomFields == null) && (Memberships != null ? Memberships.Equals <Membership>(other.Memberships): other.Memberships == null) && (Groups != null ? Groups.Equals <UserGroup>(other.Groups) : other.Groups == null) ); }
public override bool Equals(object o) { if (!(o is ApiAccess)) { return(false); } ApiAccess v = o as ApiAccess; if (!AccountName.Equals(v.AccountName)) { return(false); } if (!ApiKey.Equals(v.ApiKey)) { return(false); } if (!ApiSecret.Equals(v.ApiSecret)) { return(false); } if (!ProviderName.Equals(v.ProviderName)) { return(false); } return(true); }
/// <summary> /// Returns true if APIKeyInfo instances are equal /// </summary> /// <param name="input">Instance of APIKeyInfo to be compared</param> /// <returns>Boolean</returns> public bool Equals(APIKeyInfo input) { if (input == null) { return(false); } return (( ApiKey == input.ApiKey || (ApiKey != null && ApiKey.Equals(input.ApiKey)) ) && ( UserId == input.UserId || (UserId != null && UserId.Equals(input.UserId)) ) && ( Ips == input.Ips || Ips != null && Ips.SequenceEqual(input.Ips) ) && ( Note == input.Note || (Note != null && Note.Equals(input.Note)) ) && ( Permissions == input.Permissions || Permissions != null && Permissions.SequenceEqual(input.Permissions) ) && ( CreatedAt == input.CreatedAt || (CreatedAt != null && CreatedAt.Equals(input.CreatedAt)) ) && ( ReadOnly == input.ReadOnly || (ReadOnly != null && ReadOnly.Equals(input.ReadOnly)) )); }
public bool Equals(ApiKeyAuthenticationDetails other) { return(other != null && ClientId.Equals(other.ClientId) && ApiKey.Equals(other.ApiKey, StringComparison.Ordinal)); }
public void GetNewWallpaper() { NotifyIconText = "Retrieving next picture..."; NotifyIconIcon = WallpaperFlickr.Properties.Resources.flickrwait; IsNotifyFail = false; if (ApiKey.Equals(string.Empty)) { NotifyIconText = "API key missing"; NotifyIconIcon = WallpaperFlickr.Properties.Resources.flickrbad; IsNotifyFail = true; return; } FlickrNet.Flickr flickr = new FlickrNet.Flickr(); flickr.ApiKey = ApiKey; FlickrNet.PhotoCollection photos = null; switch (_settings.SearchOrFaves) { case 0: FlickrNet.PhotoSearchOptions options = new FlickrNet.PhotoSearchOptions(); if (!Tags.Trim().Equals(string.Empty)) { options.Tags = Tags; options.TagMode = GetTagMode(); } if (!UserId.Trim().Equals(string.Empty)) { FlickrNet.FoundUser fuser; string UserName = ""; string[] AllUserNames = UserId.Split(','); UserName = AllUserNames[new Random().Next(0, AllUserNames.GetUpperBound(0) + 1)]; try { // Exception handler added by CLR 2010-06-11 fuser = flickr.PeopleFindByUserName(UserName.Trim()); } catch (Exception ex) { FailWithError(ex); return; } if (!fuser.UserId.Equals(string.Empty)) { options.UserId = fuser.UserId; } } options.PrivacyFilter = FlickrNet.PrivacyFilter.PublicPhotos; options.SortOrder = GetSortOrder(); options.PerPage = 365; try { photos = flickr.PhotosSearch(options); //photos = flickr.PhotosGetRecent(); // this was me trying to do Explore stuff, but failed } catch (Exception ex) { //MessageBox.Show(ex.Message); FailWithError(ex); return; } options = null; break; case 1: try { FlickrNet.FoundUser fuser; fuser = flickr.PeopleFindByUserName(FaveUserId); photos = flickr.FavoritesGetPublicList(fuser.UserId); } catch (Exception ex) { FailWithError(ex); return; } break; case 2: // do explore try { photos = flickr.InterestingnessGetList(); } catch (Exception ex) { //MessageBox.Show(ex.Message); FailWithError(ex); return; } break; default: break; } clsWallpaper wallpaper = new clsWallpaper(); Random pn = new Random(); if (photos.Count == 0) { NotifyIconText = "Specified parameters return no photographs from Flickr"; NotifyIconIcon = WallpaperFlickr.Properties.Resources.flickrbad; IsNotifyFail = true; return; } else { int chosePhoto = pn.Next(0, photos.Count); //FlickrNet.Sizes fs = flickr.PhotosGetSizes("4570943273"); FlickrNet.SizeCollection fs; bool LoadedWallpaper = false; try { fs = flickr.PhotosGetSizes(photos[chosePhoto].PhotoId); // Load the last size (which should be "Original"). Doing all this // because photo.OriginalURL just causes an exception LoadedWallpaper = wallpaper.Load(fs[fs.Count - 1].Source, _settings, getDisplayStyle(), Application.ExecutablePath, photos[chosePhoto].WebUrl); } catch (Exception ex) // load failed with an exception { FailWithError(ex); return; } if (!LoadedWallpaper) // load failed, but didn't cause an exception { NotifyIconText = "Failed to load wallpaper"; NotifyIconIcon = WallpaperFlickr.Properties.Resources.flickrbad; IsNotifyFail = true; return; } // Get further info about the photo to display in the tooltip FlickrNet.PhotoInfo fi; try { fi = flickr.PhotosGetInfo(photos[chosePhoto].PhotoId); } catch (Exception ex) { FailWithError(ex); return; } // Set thumbnail NotifyIconIcon = TinyPictureVersion(FileSystem.MyPath() + "\\wallpaper\\_CurrentPaper.bmp"); FlickrNet.Person fuser; string notifyText = ""; fuser = flickr.PeopleGetInfo(photos[chosePhoto].UserId); notifyText = fuser.UserName + ": " + photos[chosePhoto].Title; string description = fi.Description; string location = "\n"; if (fi.Location != null) { if (fi.Location.County != null) { location += fi.Location.County.Description + ", " + fi.Location.Country.Description; } else { location += fi.Location.Country.Description; } } description = System.Web.HttpUtility.HtmlDecode(Regex.Replace(description, "<[^>]*>", "")); NotifyIconText = notifyText.Substring(0, Math.Min(63, notifyText.Length)); NotifyIconBalloonTipText = fi.DateTaken.ToLongDateString() + location + "\n" + description; NotifyIconBalloonTipTitle = photos[chosePhoto].Title; if (ShowBubbles) { NotifyPropertyChanged("PopupBalloon"); } } wallpaper = null; flickr = null; photos = null; //notifyIcon1.Icon = WallpaperFlickr.Properties.Resources.flickr; }