Skip to content

A Swiss Army knife for developers.

Refactoring

Etienne Baudouxf1427e3871c9
diff --git a/src/app/dev/DevToys.Api/Tool/CLI/ICommandLineTool.cs b/src/app/dev/DevToys.Api/Tool/CLI/ICommandLineTool.cs
index 4b2de7b3b..55de329d1 100644
--- a/src/app/dev/DevToys.Api/Tool/CLI/ICommandLineTool.cs
+++ b/src/app/dev/DevToys.Api/Tool/CLI/ICommandLineTool.cs
@@ -5,11 +5,11 @@ namespace DevToys.Api;
/// <summary>
/// Represents the factory for command line tool.
/// </summary>
+/// <remarks>
/// <example>
/// <code>
/// [Export(typeof(ICommandLineTool))]
/// [Name("Base64 Encode / Decoder")]
-/// [Author("John Doe")]
/// [CommandName(
/// Name = "base64",
/// Alias = "b64",
@@ -33,6 +33,7 @@ namespace DevToys.Api;
/// }
/// </code>
/// </example>
+/// </remarks>
public interface ICommandLineTool
{
/// <summary>
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIMultilineLineTextInput.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIMultilineLineTextInput.cs
new file mode 100644
index 000000000..544cfa7b2
--- /dev/null
+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIMultilineLineTextInput.cs
@@ -0,0 +1,8 @@
+namespace DevToys.Api;
+
+/// <summary>
+/// A component that can be used to display or edit unformatted text.
+/// </summary>
+public interface IUIMultilineLineTextInput : IUITextInput
+{
+}
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISinglelineTextInput.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISinglelineTextInput.cs
new file mode 100644
index 000000000..95a989d44
--- /dev/null
+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISinglelineTextInput.cs
@@ -0,0 +1,8 @@
+namespace DevToys.Api;
+
+/// <summary>
+/// A component that can be used to display or edit unformatted text.
+/// </summary>
+public interface IUISinglelineTextInput : IUITextInput
+{
+}
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUITextInput.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUITextInput.cs
index 21ed2d50e..e0053e9ee 100644
--- a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUITextInput.cs
+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUITextInput.cs
@@ -10,6 +10,11 @@ public interface IUITextInput : IUITitledElement
/// </summary>
bool IsReadOnly { get; }
+ /// <summary>
+ /// Gets whether the `Copy` button should be displayed on top of the editor, even when it is not read-only.
+ /// </summary>
+ bool CanCopyWhenEditable { get; }
+
/// <summary>
/// Gets the text displayed or typed by the user.
/// </summary>
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/GuiToolGroup.cs b/src/app/dev/DevToys.Api/Tool/GUI/GuiToolGroup.cs
index b3f88e93d..159e3a9e5 100644
--- a/src/app/dev/DevToys.Api/Tool/GUI/GuiToolGroup.cs
+++ b/src/app/dev/DevToys.Api/Tool/GUI/GuiToolGroup.cs
@@ -3,6 +3,7 @@
/// <summary>
/// Represents a group or category in the main menu of the app.
/// </summary>
+/// <remarks>
/// <example>
/// <code>
/// [Export(typeof(GuiToolGroup))]
@@ -21,6 +22,7 @@
/// }
/// </code>
/// </example>
+/// </remarks>
public class GuiToolGroup
{
/// <summary>
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/IGuiTool.cs b/src/app/dev/DevToys.Api/Tool/GUI/IGuiTool.cs
index 2cdea7a4c..a2e912faf 100644
--- a/src/app/dev/DevToys.Api/Tool/GUI/IGuiTool.cs
+++ b/src/app/dev/DevToys.Api/Tool/GUI/IGuiTool.cs
@@ -4,14 +4,14 @@
/// Represents the declaration of a tool with a GUI.
/// </summary>
/// <remarks>
+/// <para>
/// The project containing the <see cref="System.Resources.ResourceManager"/> with all the strings for the tool should contain an implementation
/// of <see cref="IResourceManagerAssemblyIdentifier"/> as shown in the example.
-/// </remarks>
+/// </para>
/// <example>
/// <code>
/// [Export(typeof(IGuiTool))]
/// [Name("Base64 Encoder / Decoder")]
-/// [Author("John Doe")]
/// [ToolDisplayInformation(
/// IconFontName = "FluentSystemIcons",
/// IconGlyph = "\u0108",
@@ -42,10 +42,20 @@
/// }
/// </code>
/// </example>
+/// </remarks>
public interface IGuiTool
{
/// <summary>
/// Gets the view for the tool.
/// </summary>
IUIElement View { get; }
+
+ /// <summary>
+ /// Invoked when the app detected a data compatible with the tool and that the user navigates to this tool in question.
+ /// The expected behavior of this method is to pass the <paramref name="parsedData"/> to the <see cref="IUIElement"/>
+ /// that fits the given data.
+ /// </summary>
+ /// <param name="dataTypeName">The data type name, as defined by <see cref="AcceptedDataTypeNameAttribute"/>.<param>
+ /// <param name="parsedData">The data returned by the corresponding <see cref="IDataTypeDetector"/>.</param>
+ void OnDataReceived(string dataTypeName, object? parsedData);
}
diff --git a/src/app/dev/DevToys.Api/Tool/IResourceManagerAssemblyIdentifier.cs b/src/app/dev/DevToys.Api/Tool/IResourceManagerAssemblyIdentifier.cs
index b94a4989c..b6ff9c943 100644
--- a/src/app/dev/DevToys.Api/Tool/IResourceManagerAssemblyIdentifier.cs
+++ b/src/app/dev/DevToys.Api/Tool/IResourceManagerAssemblyIdentifier.cs
@@ -3,6 +3,7 @@
/// <summary>
/// Represents the factory for command line tool.
/// </summary>
+/// <remarks>
/// <example>
/// <code>
/// [Export(typeof(IResourceManagerAssemblyIdentifier))]
@@ -12,6 +13,7 @@
/// }
/// </code>
/// </example>
+/// </remarks>
public interface IResourceManagerAssemblyIdentifier
{
}
diff --git a/src/app/dev/DevToys.Api/Tool/Metadata/Attributes/AcceptedDataTypeNameAttribute.cs b/src/app/dev/DevToys.Api/Tool/Metadata/Attributes/AcceptedDataTypeNameAttribute.cs
new file mode 100644
index 000000000..210c52750
--- /dev/null
+++ b/src/app/dev/DevToys.Api/Tool/Metadata/Attributes/AcceptedDataTypeNameAttribute.cs
@@ -0,0 +1,19 @@
+namespace DevToys.Api;
+
+/// <summary>
+/// Defines a data type accepted by the <see cref="IGuiTool"/> as an input. This information is used to identify what tool can
+/// be recommended based on Smart Detection finding.
+/// The value of <see cref="DataTypeName"/> should match a name defined by a <see cref="DataTypeNameAttribute.DataTypeName"/> in a <see cref="IDataTypeDetector"/>.
+/// </summary>
+[MetadataAttribute]
+[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
+public sealed class AcceptedDataTypeNameAttribute : Attribute
+{
+ public string DataTypeName { get; }
+
+ public AcceptedDataTypeNameAttribute(string name)
+ {
+ Guard.IsNotEmpty(name);
+ DataTypeName = name;
+ }
+}
diff --git a/src/app/dev/DevToys.Api/Tool/Metadata/Attributes/AuthorAttribute.cs b/src/app/dev/DevToys.Api/Tool/Metadata/Attributes/AuthorAttribute.cs
deleted file mode 100644
index cdcd500d4..000000000
--- a/src/app/dev/DevToys.Api/Tool/Metadata/Attributes/AuthorAttribute.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace DevToys.Api;
-
-/// <summary>
-/// Defines the internal name of this component. This name can be used to explicitly request this component to be invoked.
-/// </summary>
-[MetadataAttribute]
-[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
-public sealed class AuthorAttribute : Attribute
-{
- public string Author { get; }
-
- public AuthorAttribute(string author)
- {
- Guard.IsNotEmpty(author);
- Author = author;
- }
-}
diff --git a/src/app/dev/DevToys.Api/Tool/Metadata/Attributes/CompactOverlaySizeAttribute.cs b/src/app/dev/DevToys.Api/Tool/Metadata/Attributes/CompactOverlaySizeAttribute.cs
index 1e4a4a3d1..40d43ef5e 100644
--- a/src/app/dev/DevToys.Api/Tool/Metadata/Attributes/CompactOverlaySizeAttribute.cs
+++ b/src/app/dev/DevToys.Api/Tool/Metadata/Attributes/CompactOverlaySizeAttribute.cs
@@ -1,4 +1,4 @@
-namespace DevToys.Api.Tool.Metadata.Attributes;
+namespace DevToys.Api;
/// <summary>
/// Indicates the size that the window should take in Compact Overlay mode when this <see cref="IGuiTool"/> is active.
diff --git a/src/app/dev/DevToys.Api/Tool/SmartDetection/DataDetectionResult.cs b/src/app/dev/DevToys.Api/Tool/SmartDetection/DataDetectionResult.cs
index 869a14523..9059e3f35 100644
--- a/src/app/dev/DevToys.Api/Tool/SmartDetection/DataDetectionResult.cs
+++ b/src/app/dev/DevToys.Api/Tool/SmartDetection/DataDetectionResult.cs
@@ -1,6 +1,6 @@
namespace DevToys.Api;
-public record DataDetectionResult(bool Succeess, object? Data)
+public record DataDetectionResult(bool Success, object? Data)
{
public readonly DataDetectionResult Unsuccessful = new(false, null);
}
diff --git a/src/app/dev/DevToys.Api/Tool/SmartDetection/IDataTypeDetector.cs b/src/app/dev/DevToys.Api/Tool/SmartDetection/IDataTypeDetector.cs
index 21e879db5..d67e59020 100644
--- a/src/app/dev/DevToys.Api/Tool/SmartDetection/IDataTypeDetector.cs
+++ b/src/app/dev/DevToys.Api/Tool/SmartDetection/IDataTypeDetector.cs
@@ -3,6 +3,7 @@
/// <summary>
/// Represents a way to detect the type of data coming from an external source such as the OS's clipboard.
/// </summary>
+/// <remarks>
/// <example>
/// <code>
/// [Export(typeof(IDataTypeDetector))]
@@ -14,16 +15,27 @@
/// }
/// </code>
/// </example>
+/// </remarks>
public interface IDataTypeDetector
{
/// <summary>
/// Tries to detect whether the given <paramref name="data"/> match the expected format known by this
/// <see cref="IDataTypeDetector"/>, often by trying to reading and/or parsing it.
- /// When the data successfully got parsed, output that parsed value to <see cref="DataDetectionResult.Data"/>.
/// </summary>
+ /// <remarks>
+ /// <para>
+ /// When the data successfully got parsed, pass the parsed value to <see cref="DataDetectionResult.Data"/>.
+ /// </para>
+ /// <para>
+ /// Ultimately, when detection is successful, the <see cref="DataDetectionResult.Data"/> will be
+ /// passed to <see cref="IGuiTool.OnDataReceived(string, object?)"/>.
+ /// </para>
+ /// </remarks>
/// <param name="data">The data to analyze, often coming from the OS's clipboard.</param>
- /// <returns>Returns a <see cref="DataDetectionResult"/> that indicates whether the data could be analyzed / parsed / read
+ /// <returns>
+ /// Returns a <see cref="DataDetectionResult"/> that indicates whether the data could be analyzed / parsed / read
/// correctly, along with the parsed data, if any change has been made to it during parsing (for example, string to
- /// integer conversion).</returns>
+ /// integer conversion).
+ /// </returns>
ValueTask<DataDetectionResult> TryDetectDataAsync(object data);
}
diff --git a/src/app/dev/DevToys.Core/Tools/GuiToolInstance.cs b/src/app/dev/DevToys.Core/Tools/GuiToolInstance.cs
index 9e7a64d33..14ed181d0 100644
--- a/src/app/dev/DevToys.Core/Tools/GuiToolInstance.cs
+++ b/src/app/dev/DevToys.Core/Tools/GuiToolInstance.cs
@@ -48,8 +48,6 @@ public sealed partial class GuiToolInstance : ObservableObject
public string InternalComponentName => _guiToolDefinition.Metadata.InternalComponentName;
- public string Author => _guiToolDefinition.Metadata.Author;
-
public string IconFontName => _guiToolDefinition.Metadata.IconFontName;
public string IconGlyph => _guiToolDefinition.Metadata.IconGlyph;
diff --git a/src/app/dev/DevToys.Core/Tools/GuiToolProvider.cs b/src/app/dev/DevToys.Core/Tools/GuiToolProvider.cs
index feb6c1e27..62dfcf1c4 100644
--- a/src/app/dev/DevToys.Core/Tools/GuiToolProvider.cs
+++ b/src/app/dev/DevToys.Core/Tools/GuiToolProvider.cs
@@ -26,7 +26,6 @@ public sealed partial class GuiToolProvider
new Lazy<IGuiTool, GuiToolMetadata>(
GuiToolMetadata.Create(
internalComponentName: "NoSearchResults",
- author: "N/A",
iconFontName: "FluentSystemIcons",
iconGlyph: "\uF3E9",
groupName: "N/A",
diff --git a/src/app/dev/DevToys.Core/Tools/Metadata/GuiToolMetadata.cs b/src/app/dev/DevToys.Core/Tools/Metadata/GuiToolMetadata.cs
index bced00516..a99a2e471 100644
--- a/src/app/dev/DevToys.Core/Tools/Metadata/GuiToolMetadata.cs
+++ b/src/app/dev/DevToys.Core/Tools/Metadata/GuiToolMetadata.cs
@@ -1,5 +1,4 @@
using DevToys.Api;
-using DevToys.Api.Tool.Metadata.Attributes;
namespace DevToys.Core.Tools.Metadata;
@@ -8,7 +7,6 @@ public sealed class GuiToolMetadata : IOrderableMetadata
{
internal static GuiToolMetadata Create(
string internalComponentName,
- string author,
string iconFontName,
string iconGlyph,
string groupName,
@@ -21,7 +19,6 @@ public sealed class GuiToolMetadata : IOrderableMetadata
new Dictionary<string, object>
{
{ nameof(NameAttribute.InternalComponentName), internalComponentName },
- { nameof(AuthorAttribute.Author), author },
{ nameof(ToolDisplayInformationAttribute.IconFontName), iconFontName },
{ nameof(ToolDisplayInformationAttribute.IconGlyph), iconGlyph },
{ nameof(ToolDisplayInformationAttribute.GroupName),groupName },
@@ -35,7 +32,6 @@ public sealed class GuiToolMetadata : IOrderableMetadata
public GuiToolMetadata(IDictionary<string, object> metadata)
{
InternalComponentName = metadata.GetValueOrDefault(nameof(NameAttribute.InternalComponentName)) as string ?? string.Empty;
- Author = metadata.GetValueOrDefault(nameof(AuthorAttribute.Author)) as string ?? string.Empty;
IconFontName = metadata.GetValueOrDefault(nameof(ToolDisplayInformationAttribute.IconFontName)) as string ?? string.Empty;
IconGlyph = metadata.GetValueOrDefault(nameof(ToolDisplayInformationAttribute.IconGlyph)) as string ?? string.Empty;
ResourceManagerAssemblyIdentifier = metadata.GetValueOrDefault(nameof(ToolDisplayInformationAttribute.ResourceManagerAssemblyIdentifier)) as string ?? string.Empty;
@@ -55,8 +51,8 @@ public sealed class GuiToolMetadata : IOrderableMetadata
CompactOverlayHeight = metadata.GetValueOrDefault(nameof(CompactOverlaySizeAttribute.CompactOverlayHeight)) as int?;
CompactOverlayWidth = metadata.GetValueOrDefault(nameof(CompactOverlaySizeAttribute.CompactOverlayWidth)) as int?;
TargetPlatforms = metadata.GetValueOrDefault(nameof(TargetPlatformAttribute.TargetPlatform)) as IReadOnlyList<Platform> ?? Array.Empty<Platform>();
+ AcceptedDataTypeNames = metadata.GetValueOrDefault(nameof(AcceptedDataTypeNameAttribute.DataTypeName)) as IReadOnlyList<string> ?? Array.Empty<string>();
Guard.IsNotNullOrWhiteSpace(InternalComponentName);
- Guard.IsNotNullOrWhiteSpace(Author);
Guard.IsNotNullOrWhiteSpace(IconFontName);
Guard.IsNotNullOrWhiteSpace(IconGlyph);
Guard.IsNotNullOrWhiteSpace(ShortDisplayTitleResourceName);
@@ -109,8 +105,6 @@ public sealed class GuiToolMetadata : IOrderableMetadata
public string InternalComponentName { get; }
- public string Author { get; }
-
public string IconFontName { get; }
public string IconGlyph { get; }
@@ -148,4 +142,6 @@ public sealed class GuiToolMetadata : IOrderableMetadata
public int? CompactOverlayWidth { get; }
public IReadOnlyList<Platform> TargetPlatforms { get; }
+
+ public IReadOnlyList<string> AcceptedDataTypeNames { get; }
}
diff --git a/src/app/dev/DevToys.MonacoEditor/highlightjs/HTMLUtils.cs b/src/app/dev/DevToys.MonacoEditor/highlightjs/HTMLUtils.cs
index 2c65673ed..2b2ffdb68 100644
--- a/src/app/dev/DevToys.MonacoEditor/highlightjs/HTMLUtils.cs
+++ b/src/app/dev/DevToys.MonacoEditor/highlightjs/HTMLUtils.cs
@@ -268,12 +268,14 @@ internal static class HtmlUtils
/// <summary>
/// Decode the HTML character entity to the corresponding Unicode character, return `nil` for invalid input.
/// </summary>
+ /// <remarks>
/// <example>
/// decode("&#64;") --> "@"
/// decode("&#x20ac;") --> "€"
/// decode("&lt;") --> "<"
/// decode("&foo;") --> null
/// </example>
+ /// </remarks>
internal static char? Decode(string entity)
{
if (entity.StartsWith("&#x", StringComparison.OrdinalIgnoreCase))
diff --git a/src/app/dev/DevToys.Tools/Sample/SampleToolFactory.cs b/src/app/dev/DevToys.Tools/Sample/SampleToolFactory.cs
index ec7f95dce..bf1053fb9 100644
--- a/src/app/dev/DevToys.Tools/Sample/SampleToolFactory.cs
+++ b/src/app/dev/DevToys.Tools/Sample/SampleToolFactory.cs
@@ -5,7 +5,6 @@ namespace DevToys.Tools.Sample;
[Export(typeof(ICommandLineTool))]
[Name("Sample tool")]
-[Author("John Doe")]
[CommandName(
Name = "base64",
Alias = "b64",
@@ -38,7 +37,6 @@ internal sealed class SampleCommandLineTool : ICommandLineTool
[Export(typeof(IGuiTool))]
[Name("Sample tool")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -57,11 +55,12 @@ internal sealed class SampleCommandLineTool : ICommandLineTool
internal sealed class SampleGuiTool : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool2")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -80,11 +79,12 @@ internal sealed class SampleGuiTool : IGuiTool
internal sealed class SampleGuiTool2 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool3")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -103,11 +103,12 @@ internal sealed class SampleGuiTool2 : IGuiTool
internal sealed class SampleGuiTool3 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool4")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -126,11 +127,12 @@ internal sealed class SampleGuiTool3 : IGuiTool
internal sealed class SampleGuiTool4 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool5")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -149,11 +151,12 @@ internal sealed class SampleGuiTool4 : IGuiTool
internal sealed class SampleGuiTool5 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool6")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -172,11 +175,12 @@ internal sealed class SampleGuiTool5 : IGuiTool
internal sealed class SampleGuiTool6 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool7")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -195,11 +199,12 @@ internal sealed class SampleGuiTool6 : IGuiTool
internal sealed class SampleGuiTool7 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool8")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -218,11 +223,12 @@ internal sealed class SampleGuiTool7 : IGuiTool
internal sealed class SampleGuiTool8 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool9")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -241,11 +247,12 @@ internal sealed class SampleGuiTool8 : IGuiTool
internal sealed class SampleGuiTool9 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool10")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -264,11 +271,12 @@ internal sealed class SampleGuiTool9 : IGuiTool
internal sealed class SampleGuiTool10 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool11")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -287,11 +295,12 @@ internal sealed class SampleGuiTool10 : IGuiTool
internal sealed class SampleGuiTool11 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool12")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -310,11 +319,12 @@ internal sealed class SampleGuiTool11 : IGuiTool
internal sealed class SampleGuiTool12 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool13")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -333,11 +343,12 @@ internal sealed class SampleGuiTool12 : IGuiTool
internal sealed class SampleGuiTool13 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool14")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -356,11 +367,12 @@ internal sealed class SampleGuiTool13 : IGuiTool
internal sealed class SampleGuiTool14 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool15")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -379,11 +391,12 @@ internal sealed class SampleGuiTool14 : IGuiTool
internal sealed class SampleGuiTool15 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool16")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -402,11 +415,12 @@ internal sealed class SampleGuiTool15 : IGuiTool
internal sealed class SampleGuiTool16 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("Sample tool17")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uE670",
@@ -425,6 +439,8 @@ internal sealed class SampleGuiTool16 : IGuiTool
internal sealed class SampleGuiTool17 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object? parsedData) { }
}
[Export(typeof(GuiToolGroup))]
diff --git a/src/app/dev/DevToys.Tools/Settings/SettingsGuiTool.cs b/src/app/dev/DevToys.Tools/Settings/SettingsGuiTool.cs
index d3e0748ae..82c37f45a 100644
--- a/src/app/dev/DevToys.Tools/Settings/SettingsGuiTool.cs
+++ b/src/app/dev/DevToys.Tools/Settings/SettingsGuiTool.cs
@@ -4,7 +4,6 @@ namespace DevToys.Tools.Settings;
[Export(typeof(IGuiTool))]
[Name("Settings")]
-[Author("Etienne Baudoux")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\uF6A9",
@@ -96,6 +95,10 @@ internal sealed class SettingsGuiTool : IGuiTool
Button().Text("Bottom Center button").OnClick(OnBottomCenterButtonClickAsync),
Button().Text("Bottom Right button")));
+ public void OnDataReceived(string dataTypeName, object? parsedData)
+ {
+ }
+
private ValueTask OnDummySettingChangedAsync(bool state)
{
return ValueTask.CompletedTask;
diff --git a/src/app/dev/platforms/desktop/DevToys.CLI/CommandLineToolMetadata.cs b/src/app/dev/platforms/desktop/DevToys.CLI/CommandLineToolMetadata.cs
index 6f86156e8..c49080017 100644
--- a/src/app/dev/platforms/desktop/DevToys.CLI/CommandLineToolMetadata.cs
+++ b/src/app/dev/platforms/desktop/DevToys.CLI/CommandLineToolMetadata.cs
@@ -7,8 +7,6 @@ internal sealed class CommandLineToolMetadata
{
public string InternalComponentName { get; }
- public string Author { get; }
-
public string Name { get; }
public string Alias { get; }
@@ -22,14 +20,12 @@ internal sealed class CommandLineToolMetadata
public CommandLineToolMetadata(IDictionary<string, object> metadata)
{
InternalComponentName = metadata.GetValueOrDefault(nameof(NameAttribute.InternalComponentName)) as string ?? string.Empty;
- Author = metadata.GetValueOrDefault(nameof(AuthorAttribute.Author)) as string ?? string.Empty;
Name = metadata.GetValueOrDefault(nameof(CommandNameAttribute.Name)) as string ?? string.Empty;
Alias = metadata.GetValueOrDefault(nameof(CommandNameAttribute.Alias)) as string ?? string.Empty;
DescriptionResourceName = metadata.GetValueOrDefault(nameof(CommandNameAttribute.DescriptionResourceName)) as string ?? string.Empty;
ResourceManagerBaseName = metadata.GetValueOrDefault(nameof(CommandNameAttribute.ResourceManagerBaseName)) as string ?? string.Empty;
TargetPlatforms = metadata.GetValueOrDefault(nameof(TargetPlatformAttribute.TargetPlatform)) as IReadOnlyList<Platform> ?? Array.Empty<Platform>();
Guard.IsNotNullOrWhiteSpace(InternalComponentName);
- Guard.IsNotNullOrWhiteSpace(Author);
Guard.IsNotNullOrWhiteSpace(Name);
}
}
diff --git a/src/app/dev/platforms/desktop/DevToys.CLI/CommandToICommandLineToolMap.cs b/src/app/dev/platforms/desktop/DevToys.CLI/CommandToICommandLineToolMap.cs
index 34325c691..cbebc9eae 100644
--- a/src/app/dev/platforms/desktop/DevToys.CLI/CommandToICommandLineToolMap.cs
+++ b/src/app/dev/platforms/desktop/DevToys.CLI/CommandToICommandLineToolMap.cs
@@ -68,6 +68,6 @@ internal sealed class CommandToICommandLineToolMap
? resourceManager.GetString(metadata.DescriptionResourceName)
: string.Empty;
- return $"{commandDescription} [author: {metadata.Author}]";
+ return commandDescription;
}
}
diff --git a/src/app/tests/DevToys.UnitTests/Mocks/Tools/MockIGuiTool.cs b/src/app/tests/DevToys.UnitTests/Mocks/Tools/MockIGuiTool.cs
index 22c9ad98a..44b51eac1 100644
--- a/src/app/tests/DevToys.UnitTests/Mocks/Tools/MockIGuiTool.cs
+++ b/src/app/tests/DevToys.UnitTests/Mocks/Tools/MockIGuiTool.cs
@@ -5,7 +5,6 @@ namespace DevToys.UnitTests.Mocks.Tools;
[Export(typeof(IGuiTool))]
[Name("MockTool2")]
[Order(After = "MockTool")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\u0108",
@@ -20,11 +19,12 @@ namespace DevToys.UnitTests.Mocks.Tools;
internal sealed class MockIGuiTool2 : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("MockTool")]
-[Author("John Doe")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = "\u0108",
@@ -39,4 +39,6 @@ internal sealed class MockIGuiTool2 : IGuiTool
internal sealed class MockIGuiTool : IGuiTool
{
public IUIElement View => null!;
+
+ public void OnDataReceived(string dataTypeName, object parsedData) { }
}