public IIterator <T> Start(object context) { lock (shareByContext) { ShareSource shareSource; WeakReference <ShareSource> weakReference; if (!shareByContext.TryGetValue(context ?? nullContextKey, out weakReference) || !weakReference.TryGetTarget(out shareSource)) { // remove all garbage collected sequences ... foreach (var key in shareByContext.Where(x => { ShareSource s; return(!x.Value.TryGetTarget(out s)); }).Select(x => x.Key).ToList()) { shareByContext.Remove(key); } shareSource = new ShareSource(source.Start(context), maxQueueLength); shareByContext.Add(context ?? nullContextKey, new WeakReference <ShareSource>(shareSource)); } Debug.Assert(shareSource.SourceIterator.Context == context); return(shareSource.Start()); } }
public override int GetHashCode() { int hash = 1; if (BaselineSrc != 0) { hash ^= BaselineSrc.GetHashCode(); } if (PortraitFormat != 0) { hash ^= PortraitFormat.GetHashCode(); } if (PortraitAction != 0) { hash ^= PortraitAction.GetHashCode(); } if (PortraitLensTop.Length != 0) { hash ^= PortraitLensTop.GetHashCode(); } if (PortraitLensMid.Length != 0) { hash ^= PortraitLensMid.GetHashCode(); } if (PortraitLensBottom.Length != 0) { hash ^= PortraitLensBottom.GetHashCode(); } if (PortraitFrame.Length != 0) { hash ^= PortraitFrame.GetHashCode(); } if (PortraitFilter.Length != 0) { hash ^= PortraitFilter.GetHashCode(); } hash ^= portraitStickerIds_.GetHashCode(); if (PortraitStickerCount != 0) { hash ^= PortraitStickerCount.GetHashCode(); } if (ShareSource != 0) { hash ^= ShareSource.GetHashCode(); } if (ShareType != 0) { hash ^= ShareType.GetHashCode(); } if (ShareNetwork.Length != 0) { hash ^= ShareNetwork.GetHashCode(); } if (DownloadSource != 0) { hash ^= DownloadSource.GetHashCode(); } if (DownloadType != 0) { hash ^= DownloadType.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public ShareIterator(ShareSource shareSource) : base(shareSource.SourceIterator) { this.shareSource = shareSource; }