public override int GetHashCode() { unchecked { int result = (m_ObjPropertyCollection != null ? m_ObjPropertyCollection.GetHashCode() : 0); result = (result * 397) ^ (CharacterSet != null ? CharacterSet.GetHashCode() : 0); result = (result * 397) ^ (ContentEncoding != null ? ContentEncoding.GetHashCode() : 0); result = (result * 397) ^ (ContentType != null ? ContentType.GetHashCode() : 0); result = (result * 397) ^ (Headers != null ? Headers.GetHashCode() : 0); result = (result * 397) ^ IsFromCache.GetHashCode(); result = (result * 397) ^ IsMutuallyAuthenticated.GetHashCode(); result = (result * 397) ^ LastModified.GetHashCode(); result = (result * 397) ^ (Method != null ? Method.GetHashCode() : 0); result = (result * 397) ^ (OriginalReferrerUrl != null ? OriginalReferrerUrl.GetHashCode() : 0); result = (result * 397) ^ (OriginalUrl != null ? OriginalUrl.GetHashCode() : 0); result = (result * 397) ^ (ProtocolVersion != null ? ProtocolVersion.GetHashCode() : 0); result = (result * 397) ^ (Referrer != null ? Referrer.GetHashCode() : 0); result = (result * 397) ^ (ResponseUri != null ? ResponseUri.GetHashCode() : 0); result = (result * 397) ^ (Server != null ? Server.GetHashCode() : 0); result = (result * 397) ^ StatusCode.GetHashCode(); result = (result * 397) ^ (StatusDescription != null ? StatusDescription.GetHashCode() : 0); result = (result * 397) ^ (Step != null ? Step.GetHashCode() : 0); result = (result * 397) ^ (Text != null ? Text.GetHashCode() : 0); result = (result * 397) ^ (Title != null ? Title.GetHashCode() : 0); result = (result * 397) ^ DownloadTime.GetHashCode(); return(result); } }
/// <summary>Withes the fragment.</summary> /// <remarks>Depending on the existing fragment and the <paramref name="fragment" /> being set, output may differ. /// Setting a <b>null</b> value will remove the fragment regardless the <paramref name="handledAs" /> setting.</remarks> /// <param name="fragment">The fragment.</param> /// <param name="handledAs">Instructs on how to behave when an URL has already a fragment.</param> /// <returns>New URL with fragment modified.</returns> public HttpUrl WithFragment(string fragment, ExistingFragment handledAs = ExistingFragment.Throw) { if (!HasFragment) { return(fragment == null ? this : new HttpUrl(_isAbsolute, OriginalUrl + "#" + fragment, Scheme, Host, Port, Path, _query, fragment, _segments)); } if (fragment == null) { return(new HttpUrl(_isAbsolute, OriginalUrl.Substring(0, OriginalUrl.IndexOf('#')), Scheme, Host, Port, Path, _query, null, _segments)); } switch (handledAs) { case ExistingFragment.Append: return(new HttpUrl(_isAbsolute, OriginalUrl + fragment, Scheme, Host, Port, Path, _query, Fragment + fragment, _segments)); case ExistingFragment.Replace: return(new HttpUrl(_isAbsolute, OriginalUrl.Substring(0, OriginalUrl.IndexOf('#') + 1) + fragment, Scheme, Host, Port, Path, _query, fragment, _segments)); case ExistingFragment.MoveAsSegment: return(((HttpUrl)AddSegment(Fragment)).WithFragment(fragment, ExistingFragment.Replace)); } throw new InvalidOperationException("Url has already a fragment."); }
public string GetAbsoluteUrl() { if (OriginalUrl.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || OriginalUrl.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) { return(OriginalUrl); } return($"http://{OriginalUrl}"); }
public bool Update(OriginalUrl originalUrl) { if (originalUrl != null && (originalUrl.OriginalUrlValue != null) && (GetById(originalUrl.Id) != null) && (GetByName(originalUrl.OriginalUrlValue) == null)) { context.OriginalUrls.Update(originalUrl); return((context.SaveChanges() > 0) ? true : false); } return(false); }
public override int GetHashCode() { if (OriginalUrl != null) { return(OriginalUrl.GetHashCode()); } if (LargeUrl != null) { return(LargeUrl.GetHashCode()); } if (ThumbnailUrl != null) { return(ThumbnailUrl.GetHashCode()); } return(base.GetHashCode()); }
async Task <Repository> GetRepositoryInternal() { await sem.WaitAsync(); try { if (owner == null) { var ownerLogin = OriginalUrl.Owner; var repositoryName = OriginalUrl.RepositoryName; if (ownerLogin != null && repositoryName != null) { var repo = await Client.Repository.Get(ownerLogin, repositoryName); if (repo != null) { hasWiki = await HasWikiInternal(repo); isEnterprise = isEnterprise ?? await IsEnterpriseInternal(); repositoryCache = repo; } owner = ownerLogin; } } } // it'll throw if it's private or an enterprise instance requiring authentication catch (ApiException apiex) { if (!HostAddress.IsGitHubDotComUri(OriginalUrl.ToRepositoryUrl())) { isEnterprise = apiex.IsGitHubApiException(); } } catch {} finally { sem.Release(); } return(repositoryCache); }
public override int GetHashCode() { int hash = 1; if (HasTitle) { hash ^= Title.GetHashCode(); } if (HasType) { hash ^= Type.GetHashCode(); } if (HasOriginalUrl) { hash ^= OriginalUrl.GetHashCode(); } if (HasThumbnail) { hash ^= Thumbnail.GetHashCode(); } if (HasProvider) { hash ^= Provider.GetHashCode(); } if (HasDescription) { hash ^= Description.GetHashCode(); } if (HasFavicon) { hash ^= Favicon.GetHashCode(); } if (HasHtml) { hash ^= Html.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }