private ResolvedClipboardTrigger CreateResolvedClipboardTrigger(ClipboardTrigger trigger, IDataObject dataObject) { // Check if clipboard object already exists in list if (dataObject.TryGetWClipboardId(out var guid) && _allCollection.TryGetValue(guid, out var refClipboardObject)) { refClipboardObject.Triggers.Add(trigger); return(new ResolvedClipboardTrigger(trigger, refClipboardObject, ResolvedClipboardTriggerType.WClipboardId)); } //Extract Formats //TODO retry exceptions var equatableFormats = formatsExtractors.SelectMany(fe => fe.Extract(trigger, dataObject)).ToList(); trigger.AdditionalInfo.Add(new OriginalFormatsInfo(dataObject.GetFormats())); //Check if it contains any data if (equatableFormats.Count == 0) { return(new ResolvedClipboardTrigger(trigger, null, ResolvedClipboardTriggerType.Invalid)); } //Filter if (ShouldFilter(trigger, equatableFormats)) { return(new ResolvedClipboardTrigger(trigger, null, ResolvedClipboardTriggerType.Filtered)); } //Check for Equals return(CheckForEqualsReference(trigger, dataObject, equatableFormats)); }
public Program GetProgram(string path) { if (!cache.TryGetValue(path, out var program)) { program = new Program(path); cache.Add(program); } return(program); }
public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out T value) { return(_collection.TryGetValue(key, out value)); }