/* Copyright (C) 2014-2019 de4dot@gmail.com This file is part of dnSpy dnSpy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. dnSpy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with dnSpy. If not, see . */ using System; using System.ComponentModel; using dnSpy.Contracts.Text; namespace dnSpy.Contracts.Bookmarks { /// /// Formats some columns in the bookmarks window /// public abstract class BookmarkLocationFormatter : INotifyPropertyChanged, IDisposable { /// /// Name of the Location property /// public const string LocationProperty = nameof(LocationProperty); /// /// Name of the Module property /// public const string ModuleProperty = nameof(ModuleProperty); /// /// Raised when a property is changed /// public event PropertyChangedEventHandler? PropertyChanged; void OnPropertyChanged(string propName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName)); /// /// Called when the location needs to be reformatted /// protected void RaiseLocationChanged() => OnPropertyChanged(LocationProperty); /// /// Called when the module needs to be reformatted /// protected void RaiseModuleChanged() => OnPropertyChanged(ModuleProperty); /// /// Writes the location shown in the Location column /// /// Output /// Options public abstract void WriteLocation(ITextColorWriter output, BookmarkLocationFormatterOptions options); /// /// Writes the module shown in the Module column /// /// Output public abstract void WriteModule(ITextColorWriter output); /// /// Called when this instance isn't needed anymore /// public abstract void Dispose(); } /// /// Formatter options /// [Flags] public enum BookmarkLocationFormatterOptions { /// /// No bit is set /// None = 0, /// /// Show metadata tokens /// Tokens = 0x00000001, /// /// Show module names /// ModuleNames = 0x00000002, /// /// Show parameter types /// ParameterTypes = 0x00000004, /// /// Show parameter names /// ParameterNames = 0x00000008, /// /// Show declaring types /// DeclaringTypes = 0x00000010, /// /// Show return types /// ReturnTypes = 0x00000020, /// /// Show namespaces /// Namespaces = 0x00000040, /// /// Show intrinsic type keywords (eg. int instead of Int32) /// IntrinsicTypeKeywords = 0x00000080, /// /// Use digit separators /// DigitSeparators = 0x00000100, /// /// Use decimal instead of hexadecimal /// Decimal = 0x00000200, } }