Skip to content

Commit

Permalink
We don't need no stinkin runtimeclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed Feb 4, 2025
1 parent 04eff48 commit 042ddab
Show file tree
Hide file tree
Showing 154 changed files with 514 additions and 315 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal CopyPathCommand(string fullname)
{
_fullname = fullname;
Name = "Copy path";
Icon = new("\ue8c8");
Icon = new IconInfo("\ue8c8");
}

public override CommandResult Invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal OpenExplorerCommand(string fullname)
{
_fullname = fullname;
Name = "Open path";
Icon = new("\uec50");
Icon = new IconInfo("\uec50");
}

public override CommandResult Invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal OpenFileCommand(string fullname, string path)
_fullname = fullname;
_path = path;
Name = "Open file";
Icon = new("\ue8e5");
Icon = new IconInfo("\ue8e5");
}

public override CommandResult Invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
using Windows.UI.ApplicationSettings;
using static EverythingExtension.NativeMethods;

namespace EverythingExtension;
Expand All @@ -20,10 +15,9 @@ internal sealed partial class EverythingExtensionPage : DynamicListPage
{
public EverythingExtensionPage()
{
Icon = new(File.Exists("C:\\Program Files\\Everything\\Everything.exe") ?
Icon = new IconInfo(File.Exists("C:\\Program Files\\Everything\\Everything.exe") ?
"C:\\Program Files\\Everything\\Everything.exe" :
"C:\\Program Files (x86)\\Everything\\Everything.exe"
);
"C:\\Program Files (x86)\\Everything\\Everything.exe");
Name = "Everything";

Everything_SetRequestFlags(Request.FILE_NAME | Request.PATH);
Expand Down Expand Up @@ -57,9 +51,11 @@ public override IListItem[] GetItems()
(uint)EverythingErrors.EVERYTHING_ERROR_INVALIDCALL => "Invalid call",
_ => "Unexpected error",
};
List<ListItem> items = new List<ListItem>();
items.Add(new ListItem(new NoOpCommand() { Name = "Failed to query. Error was:" }));
items.Add(new ListItem(new NoOpCommand()) { Title = message, Subtitle = $"0x{lastError:X8}" });
List<ListItem> items =
[
new ListItem(new NoOpCommand() { Name = "Failed to query. Error was:" }),
new ListItem(new NoOpCommand()) { Title = message, Subtitle = $"0x{lastError:X8}" },
];
if (lastError == (uint)EverythingErrors.EVERYTHING_ERROR_IPC)
{
items.Add(new ListItem(new NoOpCommand() { Name = "(Are you sure Everything is running?)" }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal CommentCommand(NewsPost post)
{
_post = post;
Name = "Open comments";
Icon = new("\ue8f2"); // chat bubbles
Icon = new IconInfo("\ue8f2"); // chat bubbles
}

public override CommandResult Invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal LinkCommand(NewsPost post)
{
_post = post;
Name = "Open link";
Icon = new("\uE8A7");
Icon = new IconInfo("\uE8A7");
}

public override CommandResult Invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal sealed partial class HackerNewsPage : ListPage
{
public HackerNewsPage()
{
Icon = new("https://news.ycombinator.com/favicon.ico");
Icon = new IconInfo("https://news.ycombinator.com/favicon.ico");
Name = "Hacker News";
AccentColor = ColorHelpers.FromRgb(255, 102, 0);
IsLoading = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal sealed partial class MastodonExtensionPage : ListPage

public MastodonExtensionPage()
{
Icon = new("https://mastodon.social/packs/media/icons/android-chrome-36x36-4c61fdb42936428af85afdbf8c6a45a8.png");
Icon = new IconInfo("https://mastodon.social/packs/media/icons/android-chrome-36x36-4c61fdb42936428af85afdbf8c6a45a8.png");
Name = "Mastodon";
ShowDetails = true;
HasMoreItems = true;
Expand All @@ -45,20 +45,20 @@ private void AddPosts(List<MastodonStatus> posts)
{
Title = p.Account.DisplayName, // p.ContentAsPlainText(),
Subtitle = $"@{p.Account.Username}",
Icon = new(p.Account.Avatar),
Icon = new IconInfo(p.Account.Avatar),

// *
Tags = [
new Tag()
{
Icon = new("\ue734"), // FavoriteStar
Icon = new IconInfo("\ue734"), // FavoriteStar
Background = ColorHelpers.FromRgb(255, 255, 0), // Yellow
Foreground = ColorHelpers.FromRgb(64, 64, 0), // Dark Yellow
Text = p.Favorites.ToString(CultureInfo.CurrentCulture),
},
new Tag()
{
Icon = new("\ue8ee"), // RepeatAll
Icon = new IconInfo("\ue8ee"), // RepeatAll
Background = ColorHelpers.FromRgb(86, 58, 204), // Mastodon color
Foreground = ColorHelpers.FromRgb(255, 255, 255), // White
Text = p.Boosts.ToString(CultureInfo.CurrentCulture),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private async Task UpdateProperties()
if (properties == null)
{
var a = (TogglePlayMediaCommand)this.Command;
a.Icon = new(string.Empty);
a.Icon = new IconInfo(string.Empty);
a.Name = "No media playing";

return;
Expand All @@ -57,12 +57,12 @@ private async Task UpdateProperties()
var internalAction = (TogglePlayMediaCommand)this.Command;
if (status == GlobalSystemMediaTransportControlsSessionPlaybackStatus.Paused)
{
internalAction.Icon = new("\ue768"); // play
internalAction.Icon = new IconInfo("\ue768"); // play
internalAction.Name = "Paused";
}
else if (status == GlobalSystemMediaTransportControlsSessionPlaybackStatus.Playing)
{
internalAction.Icon = new("\ue769"); // pause
internalAction.Icon = new IconInfo("\ue769"); // pause
internalAction.Name = "Playing";
}

Expand Down
4 changes: 2 additions & 2 deletions src/modules/cmdpal/Exts/Menus/MenusCommandsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ internal sealed partial class WindowMenusPage : ListPage
public WindowMenusPage(WindowData window)
{
_window = window;
Icon = new(string.Empty);
Icon = new IconInfo(string.Empty);
Name = window.Title;
ShowDetails = false;
}
Expand All @@ -192,7 +192,7 @@ internal sealed partial class AllWindowsPage : ListPage

public AllWindowsPage()
{
Icon = new("\uf0b5"); // ChecklistMirrored
Icon = new IconInfo("\uf0b5"); // ChecklistMirrored
Name = "Open Windows";
ShowDetails = false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/cmdpal/Exts/Menus/Pages/MenusPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal sealed partial class MenusPage : ListPage
{
public MenusPage()
{
Icon = new(string.Empty);
Icon = new IconInfo(string.Empty);
Name = "Menus from the open windows";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public AllAppsCommandProvider()
{
Id = "AllApps";
DisplayName = "Installed apps";
Icon = new("\ue71d");
Icon = new IconInfo("\ue71d");

_listItem = new(Page) { Subtitle = "Search installed apps" };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public AllAppsPage()
{
StringMatcher.Instance = new StringMatcher();
this.Name = "All Apps";
this.Icon = new("\ue71d");
this.Icon = new IconInfo("\ue71d");
this.ShowDetails = true;
this.IsLoading = true;
this.PlaceholderText = "Search installed apps...";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;

namespace Microsoft.CmdPal.Ext.Apps.Programs;
Expand All @@ -11,7 +10,7 @@ internal sealed partial class AppListItem : ListItem
{
private readonly AppItem _app;
private static readonly Tag _appTag = new("App");
private static readonly IconInfo _openPathIcon = new("\ue838");
private static readonly IconInfo _openPathIcon = new IconInfo("\ue838");

public AppListItem(AppItem app)
: base(new AppCommand(app))
Expand All @@ -24,7 +23,7 @@ public AppListItem(AppItem app)
Details = new Details()
{
Title = this.Title,
HeroImage = Command?.Icon ?? new(string.Empty),
HeroImage = ((AppCommand)Command!).Icon ?? new IconInfo(string.Empty),
Body = "### App",
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal sealed partial class AddBookmarkPage : FormPage

public AddBookmarkPage()
{
this.Icon = new("\ued0e");
this.Icon = new IconInfo("\ued0e");
this.Name = "Add a Bookmark";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal sealed partial class BookmarkPlaceholderPage : FormPage
public BookmarkPlaceholderPage(string name, string url, string type)
{
Name = name;
Icon = new(UrlCommand.IconFromUrl(url, type));
Icon = new IconInfo(UrlCommand.IconFromUrl(url, type));
_bookmarkPlaceholder = new BookmarkPlaceholderForm(name, url, type);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public BookmarksCommandProvider()
{
Id = "Bookmarks";
DisplayName = "Bookmarks";
Icon = new("\uE718"); // Pin
Icon = new IconInfo("\uE718"); // Pin

_addNewCommand.AddedCommand += AddNewCommand_AddedCommand;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public CalculatorCommandProvider()
{
Id = "Calculator";
DisplayName = "Calculator";
Icon = new("\ue8ef"); // Calculator
Icon = new IconInfo("\ue8ef"); // Calculator
}

public override ICommandItem[] TopLevelCommands() => [_listItem];
Expand All @@ -41,7 +41,7 @@ public sealed partial class CalculatorListPage : DynamicListPage

public CalculatorListPage()
{
Icon = new("\ue8ef"); // Calculator
Icon = new IconInfo("\ue8ef"); // Calculator
Name = "Calculator";
PlaceholderText = "Type an equation...";
Id = "com.microsoft.cmdpal.calculator";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal CopyPathCommand(IndexerItem item)
{
this._item = item;
this.Name = Resources.Indexer_Command_CopyPath;
this.Icon = new("\uE8c8");
this.Icon = new IconInfo("\uE8c8");
}

public override CommandResult Invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal OpenFileCommand(IndexerItem item)
{
this._item = item;
this.Name = Resources.Indexer_Command_OpenFile;
this.Icon = new("\uE8E5");
this.Icon = new IconInfo("\uE8E5");
}

public override CommandResult Invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal OpenInConsoleCommand(IndexerItem item)
{
this._item = item;
this.Name = Resources.Indexer_Command_OpenPathInConsole;
this.Icon = new("\uE756");
this.Icon = new IconInfo("\uE756");
}

public override CommandResult Invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal OpenPropertiesCommand(IndexerItem item)
{
this._item = item;
this.Name = Resources.Indexer_Command_OpenProperties;
this.Icon = new("\uE90F");
this.Icon = new IconInfo("\uE90F");
}

public override CommandResult Invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal OpenWithCommand(IndexerItem item)
{
this._item = item;
this.Name = Resources.Indexer_Command_OpenWith;
this.Icon = new("\uE7AC");
this.Icon = new IconInfo("\uE7AC");
}

public override CommandResult Invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal ShowFileInFolderCommand(IndexerItem item)
{
this._item = item;
this.Name = Resources.Indexer_Command_ShowInFolder;
this.Icon = new("\uE838");
this.Icon = new IconInfo("\uE838");
}

public override CommandResult Invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal sealed partial class IndexerPage : DynamicListPage, IDisposable
public IndexerPage()
{
Id = "com.microsoft.indexer.fileSearch";
Icon = new("\uEC50");
Icon = new IconInfo("\uEC50");
Name = Resources.Indexer_Title;
PlaceholderText = Resources.Indexer_PlaceholderText;

Expand Down Expand Up @@ -96,7 +96,7 @@ private void FetchItems(int limit)
FullPath = result.LaunchUri,
})
{
Icon = new(result.IsFolder ? "\uE838" : "\uE8E5"),
Icon = new IconInfo(result.IsFolder ? "\uE838" : "\uE8E5"),
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ internal CopyRegistryInfoCommand(RegistryEntry entry, CopyType typeToCopy)
if (typeToCopy == CopyType.Key)
{
Name = Resources.CopyKeyNamePath;
Icon = new("\xE8C8"); // Copy Icon
Icon = new IconInfo("\xE8C8"); // Copy Icon
_stringToCopy = entry.GetRegistryKey();
}
else if (typeToCopy == CopyType.ValueData)
{
Name = Resources.CopyValueData;
Icon = new("\xF413"); // CopyTo Icon
Icon = new IconInfo("\xF413"); // CopyTo Icon
_stringToCopy = entry.GetValueData();
}
else if (typeToCopy == CopyType.ValueName)
{
Name = Resources.CopyValueName;
Icon = new("\xE8C8"); // Copy Icon
Icon = new IconInfo("\xE8C8"); // Copy Icon
_stringToCopy = entry.GetValueNameWithKey();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal sealed partial class OpenKeyInEditorCommand : InvokableCommand
internal OpenKeyInEditorCommand(RegistryEntry entry)
{
Name = Resources.OpenKeyInRegistryEditor;
Icon = new("\xE8A7"); // OpenInNewWindow icon
Icon = new IconInfo("\xE8A7"); // OpenInNewWindow icon
_entry = entry;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public RegistryCommandsProvider()
{
Id = "Windows.Registry";
DisplayName = $"Windows Registry";
Icon = new("\uE74C"); // OEM
Icon = new IconInfo("\uE74C"); // OEM
}

public override ICommandItem[] TopLevelCommands()
Expand Down
Loading

1 comment on commit 042ddab

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@check-spelling-bot Report

🔴 Please review

See the 📜action log or 📝 job summary for details.

Unrecognized words (1)

IIcon

These words are not needed and should be removed AVery mtu rsdk

To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:zadjii-msft/PowerToys.git repository
on the dev/migrie/f/rename-the-world branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.24/apply.pl' |
perl - 'https://github.com/zadjii-msft/PowerToys/actions/runs/13143541567/attempts/1'
Errors (1)

See the 📜action log or 📝 job summary for details.

❌ Errors Count
❌ ignored-expect-variant 5

See ❌ Event descriptions for more information.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

Please sign in to comment.