/// <summary> /// Gets the <see cref="IEditor"/> associated with the specified /// file path. /// </summary> /// <param name="key"> /// The file path of the value to get. /// </param> /// <param name="value"> /// When this method returns, contains the <see cref="IEditor"/> /// associated with <paramref name="key"/>, if it is found; /// otherwise <see langword="null"/> is returned. This parameter is /// passed uninitialized. /// </param> /// <returns> /// <see langword="true"/> if <see cref="EditorDictionary"/> /// contains an <see cref="IEditor"/> with the specified file path /// key; otherwise <see langword="false"/>. /// </returns> /// <exception cref="ArgumentException"> /// <paramref name="key"/> is a zero-length string, contains only /// whitespace, or contains one or more of the invalid characters /// defined in <see cref=" GetInvalidPathChars"/>. /// <para/> /// -or- /// <para/> /// The system could not retrieve the absolute path. /// </exception> /// <exception cref="System.Security.SecurityException"> /// The caller does not have the required permissions. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="key"/> is <see langword="null"/>. /// </exception> /// <exception cref="NotSupportedException"> /// <paramref name="key"/> contains a colon (":") that is not part /// of a volume identifier (for example, "c:\"). /// </exception> /// <exception cref="System.IO.PathTooLongException"> /// The specified path, file name, or both exceed the /// system-defined maximum length. /// </exception> /// <inheritdoc cref="GetFullPath(String)" select="exception"/> /// public bool TryGetValue(string key, out IEditor value) { var actualKey = GetFullPath(key); return(Editors.TryGetValue( actualKey, out value)); }
/// <summary> /// Removes the <see cref="IEditor"/> with the specified file path /// key. /// </summary> /// <param name="key"> /// The file path of the <see cref="IEditor"/> to remove. /// </param> /// <returns> /// <see langword="true"/> if the <see cref="IEditor"/> is /// successfully found and removed; otherwise <see /// langword="false"/>. /// </returns> /// <exception cref="ArgumentException"> /// <paramref name="key"/> is a zero-length string, contains only /// whitespace, or contains one or more of the invalid characters /// defined in <see cref=" GetInvalidPathChars"/>. /// <para/> /// -or- /// <para/> /// The system could not retrieve the absolute path. /// </exception> /// <exception cref="System.Security.SecurityException"> /// The caller does not have the required permissions. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="key"/> is <see langword="null"/>. /// </exception> /// <exception cref="NotSupportedException"> /// <paramref name="key"/> contains a colon (":") that is not part /// of a volume identifier (for example, "c:\"). /// </exception> /// <exception cref="System.IO.PathTooLongException"> /// The specified path, file name, or both exceed the /// system-defined maximum length. /// </exception> public bool Remove(string key) { var actualKey = GetFullPath(key); if (Editors.TryGetValue(actualKey, out var value)) { Editors.Remove(actualKey); var e = new EditorEventArgs(value); EditorSelector.OnEditorRemoved(e); return(true); } return(false); }