/* 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.Collections.Generic; using dnSpy.Contracts.Command; using dnSpy.Contracts.Controls; using dnSpy.Contracts.Text.Operations; namespace dnSpy.Contracts.Text.Editor { /// /// A REPL (Read, Eval, Print, Loop) editor /// interface IReplEditor : ICommandTargetCollectionProvider, IUIObjectProvider2, IDisposable { /// /// true if can be called /// bool CanClearScreen { get; } /// /// Clears the screen /// void ClearScreen(); /// /// true if can be called /// bool CanSaveText { get; } /// /// Saves the text /// /// Suggested filename without the file extension /// File extension /// File filter passed to SaveFileDialog void SaveText(string filenameNoExtension, string fileExtension, string filesFilter); /// /// true if can be called /// bool CanSaveCode { get; } /// /// Saves the code /// /// Suggested filename without the file extension /// File extension /// File filter passed to SaveFileDialog void SaveCode(string filenameNoExtension, string fileExtension, string filesFilter); /// /// true if can be called /// bool CanCopyCode { get; } /// /// Copies the selected code /// void CopyCode(); /// /// true if can be called /// bool CanSelectPreviousCommand { get; } /// /// Selects the previous command /// void SelectPreviousCommand(); /// /// true if can be called /// bool CanSelectNextCommand { get; } /// /// Selects the next command /// void SelectNextCommand(); /// /// Gets all selected code /// /// string GetCode(); /// /// Adds script output. This method can be called from any thread /// /// Text /// Color /// true to print the text on a new line void OutputPrint(string? text, object color, bool startOnNewLine = false); /// /// Adds script output. This method can be called from any thread /// /// Text /// Color /// true to print the text on a new line void OutputPrint(string? text, TextColor color, bool startOnNewLine = false); /// /// Adds script output and a new line. This method can be called from any thread /// /// Text /// Color /// true to print the text on a new line void OutputPrintLine(string? text, object color, bool startOnNewLine = false); /// /// Adds script output and a new line. This method can be called from any thread /// /// Text /// Color /// true to print the text on a new line void OutputPrintLine(string? text, TextColor color, bool startOnNewLine = false); /// /// Adds script output. This method can be called from any thread /// /// Text void OutputPrint(IEnumerable text); /// /// Gets notified by this instance /// IReplCommandHandler CommandHandler { get; set; } /// /// Called by after the command has finished executing /// void OnCommandExecuted(); /// /// Resets the state to original executing state, but doesn't reset history or clears the screen /// void Reset(); /// /// Gets the REPL editor operations /// IReplEditorOperations ReplEditorOperations { get; } /// /// Gets the text view /// IDsWpfTextView TextView { get; } /// /// Gets the text view host /// IDsWpfTextViewHost TextViewHost { get; } } }