[Feature] Filter menu by file type (#384), version 1.2.9.5

This commit is contained in:
Markus Hofknecht 2022-05-25 17:08:11 +02:00
parent e12842085e
commit 07ed93d29e
25 changed files with 178 additions and 22 deletions

View file

@ -488,7 +488,7 @@ namespace SystemTrayMenu.Business
}
else if (!FileLnk.IsNetworkRoot(path))
{
files = Directory.GetFiles(path);
files = DirectoryBySearchPattern.GetFiles(path, Config.SearchPattern);
files = files.Concat(filesToAddToMainMenu).ToArray();
}
@ -739,7 +739,7 @@ namespace SystemTrayMenu.Business
else
{
directoriesToConcat = Directory.GetDirectories(pathAddToMainMenu);
filesToAddToConcat = Directory.GetFiles(pathAddToMainMenu);
filesToAddToConcat = DirectoryBySearchPattern.GetFiles(pathAddToMainMenu, Config.SearchPattern);
}
if (!onlyFiles)
@ -764,7 +764,7 @@ namespace SystemTrayMenu.Business
try
{
filesToAddToConcat = filesToAddToConcat.Concat(Directory.GetFiles(pathAddToMainMenu)).ToArray();
filesToAddToConcat = filesToAddToConcat.Concat(DirectoryBySearchPattern.GetFiles(pathAddToMainMenu, Config.SearchPattern)).ToArray();
}
catch (Exception ex)
{

View file

@ -29,6 +29,8 @@ namespace SystemTrayMenu
public static string Path => Settings.Default.PathDirectory;
public static string SearchPattern => Settings.Default.SearchPattern;
public static bool AlwaysOpenByPin { get; internal set; }
public static void Initialize()

View file

@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.9.5")]
[assembly: AssemblyFileVersion("1.2.9.5")]
[assembly: AssemblyVersion("1.2.9.6")]
[assembly: AssemblyFileVersion("1.2.9.6")]

View file

@ -1338,5 +1338,21 @@ namespace SystemTrayMenu.Properties
this["ColorDarkModeIcons"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Configuration.SettingsProviderAttribute(typeof(CustomSettingsProvider))]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string SearchPattern
{
get
{
return ((string)(this["SearchPattern"]));
}
set
{
this["SearchPattern"] = value;
}
}
}
}

View file

@ -90,6 +90,7 @@ Reviews
[soluciones.link](https://soluciones.link/windows/systemtraymenu-es-una-alternativa-gratuita-del-menu-de-inicio-para-windows-11-10/) |
[de.moyens.net](https://de.moyens.net/windows/systemtraymenu-ist-eine-kostenlose-startmenue-alternative-fuer-windows-11-10/) |
[windowsreport.com](https://windowsreport.com/windows-11-free-start-menu-replacement/) |
[onmsft.com](https://www.onmsft.com/how-to/how-to-edit-windows-11-start-menu-layout) |
[starchart.cc](https://starchart.cc/hofknecht/systemtraymenu.svg)
FAQ
@ -281,6 +282,7 @@ Thanks for ideas, reporting issues and contributing!
#372 [not-nef](https://github.com/not-nef),
#376 Michelle H.,
#377 [SoenkeHob](https://github.com/SoenkeHob),
#384 [boydfields](https://github.com/boydfields)
Donations
------------------
@ -329,5 +331,6 @@ PayPal/GitHub Sponsors - Thank you!
* Ralf K.
* [donaldaken](https://github.com/donaldaken)
* Marc Speer
* [boydfields](https://github.com/boydfields)
* [Traditional_Tap3954](https://www.reddit.com/user/Traditional_Tap3954/)
* Maximilian H.

View file

@ -465,6 +465,15 @@ namespace SystemTrayMenu.Resources.Languages {
}
}
/// <summary>
/// Looks up a localized string similar to Filter menu by file type e.g.: *.exe|*.dll.
/// </summary>
internal static string Filter_menu_by_file_type_e_g_____exe___dll {
get {
return ResourceManager.GetString("Filter menu by file type e.g.: *.exe|*.dll", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Folder.
/// </summary>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>Posouvání přejetím</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>Filtrovat nabídku podle typu souboru, např.: *.exe|*.dll</value>
</data>
</root>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>Per Wischen scrollen</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>Menü nach Dateityp filtern, z. B.: *.exe|*.dll</value>
</data>
</root>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>Desplazarse mediante deslizar</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>Filtre el menú por tipo de archivo, por ejemplo: *.exe|*.dll</value>
</data>
</root>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>از طریق سوایپ پیمایش کنید</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>فیلتر منو بر اساس نوع فایل به عنوان مثال: *.exe|*.dll</value>
</data>
</root>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>Faire défiler par balayage</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>Menu Filtrer par type de fichier, par exemple : *.exe|*.dll</value>
</data>
</root>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>Scorri tramite swipe</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>Filtra il menu per tipo di file, ad es.: *.exe|*.dll</value>
</data>
</root>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>スワイプでスクロール</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>ファイルタイプでメニューをフィルタリングします。例:*。exe | * .dll</value>
</data>
</root>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>스와이프로 스크롤</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>파일 유형별 필터 메뉴 예: *.exe|*.dll</value>
</data>
</root>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>Scrollen door te vegen</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>Filter menu op bestandstype bijv.: *.exe|*.dll</value>
</data>
</root>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>Rolar através de furto</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>Filtrar menu por tipo de arquivo, por exemplo: *.exe|*.dll</value>
</data>
</root>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>Scroll via swipe</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>Filter menu by file type e.g.: *.exe|*.dll</value>
</data>
</root>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>Прокрутите свайпом</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>Меню фильтра по типу файла, например: *.exe|*.dll</value>
</data>
</root>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>Kaydırarak kaydırın</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>Menüyü dosya türüne göre filtreleyin, örneğin: *.exe|*.dll</value>
</data>
</root>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>Cuộn qua vuốt</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>Trình đơn lọc theo loại tệp, ví dụ: * .exe | * .dll</value>
</data>
</root>

View file

@ -486,4 +486,7 @@
<data name="Scroll via swipe" xml:space="preserve">
<value>通过滑动滚动</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>按文件类型过滤菜单,例如:*.exe|*.dll</value>
</data>
</root>

View file

@ -115,7 +115,7 @@ namespace SystemTrayMenu.Helper
aboutBox.AppMoreInfo += "#262 terencemcdonnell, #269 petersnows25, #272 Peter M., #273 #274 ParasiteDelta, #275 #276 #278 donaldaken, ";
aboutBox.AppMoreInfo += "#277 Jan S., #282 akuznets, #283 #284 #289 RuSieg, #285 #286 dao-net, #288 William P., #294 #295 #296 Stefan Mahrer, ";
aboutBox.AppMoreInfo += "#225 #297 #299 #317 #321 #324 #330 chip33, #298 phanirithvij, #306 wini2, #370 dna5589, #372 not-nef, #376 Michelle H. ";
aboutBox.AppMoreInfo += "#377 SoenkeHob" + Environment.NewLine;
aboutBox.AppMoreInfo += "#377 SoenkeHob, #377 boydfields" + Environment.NewLine;
aboutBox.AppMoreInfo += @"
Sponsors - Thank you!
------------------
@ -124,6 +124,7 @@ Sponsors - Thank you!
* Ralf K.
* donaldaken
* Marc Speer
* boydfields
* Traditional_Tap3954
* Maximilian H.
";

View file

@ -133,6 +133,9 @@ namespace SystemTrayMenu.UserInterface
this.buttonDefaultFolders = new System.Windows.Forms.Button();
this.tabPageExpert = new System.Windows.Forms.TabPage();
this.tableLayoutPanelExpert = new System.Windows.Forms.TableLayoutPanel();
this.groupBoxSearchPattern = new System.Windows.Forms.GroupBox();
this.tableLayoutPanelSearchPattern = new System.Windows.Forms.TableLayoutPanel();
this.textBoxSearchPattern = new System.Windows.Forms.TextBox();
this.groupBoxCache = new System.Windows.Forms.GroupBox();
this.tableLayoutPanelCache = new System.Windows.Forms.TableLayoutPanel();
this.checkBoxCacheMainMenu = new System.Windows.Forms.CheckBox();
@ -376,6 +379,8 @@ namespace SystemTrayMenu.UserInterface
this.tableLayoutPanelAddSampleStartMenuFolder.SuspendLayout();
this.tabPageExpert.SuspendLayout();
this.tableLayoutPanelExpert.SuspendLayout();
this.groupBoxSearchPattern.SuspendLayout();
this.tableLayoutPanelSearchPattern.SuspendLayout();
this.groupBoxCache.SuspendLayout();
this.tableLayoutPanelCache.SuspendLayout();
this.tableLayoutPanelClearCacheIfMoreThanThisNumberOfItems.SuspendLayout();
@ -1916,14 +1921,16 @@ namespace SystemTrayMenu.UserInterface
this.tableLayoutPanelExpert.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanelExpert.ColumnCount = 1;
this.tableLayoutPanelExpert.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelExpert.Controls.Add(this.groupBoxSearchPattern, 0, 3);
this.tableLayoutPanelExpert.Controls.Add(this.groupBoxCache, 0, 2);
this.tableLayoutPanelExpert.Controls.Add(this.groupBoxStaysOpen, 0, 1);
this.tableLayoutPanelExpert.Controls.Add(this.groupBoxOpenSubmenus, 0, 0);
this.tableLayoutPanelExpert.Controls.Add(this.buttonExpertDefault, 0, 3);
this.tableLayoutPanelExpert.Controls.Add(this.buttonExpertDefault, 0, 4);
this.tableLayoutPanelExpert.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanelExpert.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanelExpert.Name = "tableLayoutPanelExpert";
this.tableLayoutPanelExpert.RowCount = 4;
this.tableLayoutPanelExpert.RowCount = 5;
this.tableLayoutPanelExpert.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelExpert.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelExpert.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelExpert.RowStyles.Add(new System.Windows.Forms.RowStyle());
@ -1931,6 +1938,44 @@ namespace SystemTrayMenu.UserInterface
this.tableLayoutPanelExpert.Size = new System.Drawing.Size(408, 407);
this.tableLayoutPanelExpert.TabIndex = 1;
//
// groupBoxSearchPattern
//
this.groupBoxSearchPattern.AutoSize = true;
this.groupBoxSearchPattern.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.groupBoxSearchPattern.Controls.Add(this.tableLayoutPanelSearchPattern);
this.groupBoxSearchPattern.Location = new System.Drawing.Point(3, 312);
this.groupBoxSearchPattern.MaximumSize = new System.Drawing.Size(400, 0);
this.groupBoxSearchPattern.MinimumSize = new System.Drawing.Size(400, 0);
this.groupBoxSearchPattern.Name = "groupBoxSearchPattern";
this.groupBoxSearchPattern.Padding = new System.Windows.Forms.Padding(3, 3, 3, 6);
this.groupBoxSearchPattern.Size = new System.Drawing.Size(400, 54);
this.groupBoxSearchPattern.TabIndex = 2;
this.groupBoxSearchPattern.TabStop = false;
this.groupBoxSearchPattern.Text = "groupBoxSearchPattern";
//
// tableLayoutPanelSearchPattern
//
this.tableLayoutPanelSearchPattern.AutoSize = true;
this.tableLayoutPanelSearchPattern.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanelSearchPattern.ColumnCount = 1;
this.tableLayoutPanelSearchPattern.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelSearchPattern.Controls.Add(this.textBoxSearchPattern, 0, 0);
this.tableLayoutPanelSearchPattern.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanelSearchPattern.Location = new System.Drawing.Point(3, 19);
this.tableLayoutPanelSearchPattern.Name = "tableLayoutPanelSearchPattern";
this.tableLayoutPanelSearchPattern.RowCount = 1;
this.tableLayoutPanelSearchPattern.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelSearchPattern.Size = new System.Drawing.Size(394, 29);
this.tableLayoutPanelSearchPattern.TabIndex = 0;
//
// textBoxSearchPattern
//
this.textBoxSearchPattern.Location = new System.Drawing.Point(3, 3);
this.textBoxSearchPattern.Name = "textBoxSearchPattern";
this.textBoxSearchPattern.Size = new System.Drawing.Size(350, 23);
this.textBoxSearchPattern.TabIndex = 1;
this.textBoxSearchPattern.TabStop = false;
//
// groupBoxCache
//
this.groupBoxCache.AutoSize = true;
@ -2230,7 +2275,7 @@ namespace SystemTrayMenu.UserInterface
//
this.buttonExpertDefault.AutoSize = true;
this.buttonExpertDefault.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.buttonExpertDefault.Location = new System.Drawing.Point(9, 318);
this.buttonExpertDefault.Location = new System.Drawing.Point(9, 378);
this.buttonExpertDefault.Margin = new System.Windows.Forms.Padding(9, 9, 3, 9);
this.buttonExpertDefault.MinimumSize = new System.Drawing.Size(75, 25);
this.buttonExpertDefault.Name = "buttonExpertDefault";
@ -4666,6 +4711,10 @@ namespace SystemTrayMenu.UserInterface
this.tabPageExpert.PerformLayout();
this.tableLayoutPanelExpert.ResumeLayout(false);
this.tableLayoutPanelExpert.PerformLayout();
this.groupBoxSearchPattern.ResumeLayout(false);
this.groupBoxSearchPattern.PerformLayout();
this.tableLayoutPanelSearchPattern.ResumeLayout(false);
this.tableLayoutPanelSearchPattern.PerformLayout();
this.groupBoxCache.ResumeLayout(false);
this.groupBoxCache.PerformLayout();
this.tableLayoutPanelCache.ResumeLayout(false);
@ -5114,5 +5163,8 @@ namespace SystemTrayMenu.UserInterface
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.CheckBox checkBoxSwipeScrolling;
private System.Windows.Forms.CheckBox checkBoxDragDropItems;
private System.Windows.Forms.GroupBox groupBoxSearchPattern;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelSearchPattern;
private System.Windows.Forms.TextBox textBoxSearchPattern;
}
}

View file

@ -185,6 +185,7 @@ namespace SystemTrayMenu.UserInterface
groupBoxCache.Text = Translator.GetText("Cache");
checkBoxCacheMainMenu.Text = Translator.GetText("Cache main menu");
labelClearCacheIfMoreThanThisNumberOfItems.Text = Translator.GetText("Clear cache if more than this number of items");
groupBoxSearchPattern.Text = Translator.GetText("Filter menu by file type e.g.: *.exe|*.dll");
buttonExpertDefault.Text = Translator.GetText("Default");
tabPageCustomize.Text = Translator.GetText("Customize");
@ -465,6 +466,8 @@ namespace SystemTrayMenu.UserInterface
checkBoxCacheMainMenu.Checked = Settings.Default.CacheMainMenu;
numericUpDownClearCacheIfMoreThanThisNumberOfItems.Value = Settings.Default.ClearCacheIfMoreThanThisNumberOfItems;
textBoxSearchPattern.Text = Settings.Default.SearchPattern;
checkBoxRoundCorners.Checked = Settings.Default.RoundCorners;
checkBoxUseFading.Checked = Settings.Default.UseFading;
checkBoxDarkModeAlwaysOn.Checked = Settings.Default.IsDarkModeAlwaysOn;
@ -867,28 +870,27 @@ namespace SystemTrayMenu.UserInterface
Settings.Default.SortFolderAndFilesByDate = radioButtonSortByDate.Checked;
Settings.Default.ShowOnlyAsSearchResult = checkBoxShowOnlyAsSearchResult.Checked;
SaveFolders();
Settings.Default.GenerateShortcutsToDrives = checkBoxGenerateShortcutsToDrives.Checked;
Settings.Default.CacheMainMenu = checkBoxCacheMainMenu.Checked;
Settings.Default.ClearCacheIfMoreThanThisNumberOfItems = (int)numericUpDownClearCacheIfMoreThanThisNumberOfItems.Value;
void SaveFolders()
Settings.Default.PathsAddToMainMenu = string.Empty;
foreach (DataGridViewRow row in dataGridViewFolders.Rows)
{
Settings.Default.PathsAddToMainMenu = string.Empty;
foreach (DataGridViewRow row in dataGridViewFolders.Rows)
{
string pathAddToMainMenu = row.Cells[0].Value.ToString();
bool recursiv = (bool)row.Cells[1].Value;
bool onlyFiles = (bool)row.Cells[2].Value;
Settings.Default.PathsAddToMainMenu += $"{pathAddToMainMenu} recursiv:{recursiv} onlyFiles:{onlyFiles}|";
}
string pathAddToMainMenu = row.Cells[0].Value.ToString();
bool recursiv = (bool)row.Cells[1].Value;
bool onlyFiles = (bool)row.Cells[2].Value;
Settings.Default.PathsAddToMainMenu += $"{pathAddToMainMenu} recursiv:{recursiv} onlyFiles:{onlyFiles}|";
}
Settings.Default.GenerateShortcutsToDrives = checkBoxGenerateShortcutsToDrives.Checked;
Settings.Default.StaysOpenWhenItemClicked = checkBoxStayOpenWhenItemClicked.Checked;
Settings.Default.StaysOpenWhenFocusLost = checkBoxStayOpenWhenFocusLost.Checked;
Settings.Default.TimeUntilCloses = (int)numericUpDownTimeUntilClose.Value;
Settings.Default.TimeUntilOpens = (int)numericUpDownTimeUntilOpens.Value;
Settings.Default.StaysOpenWhenFocusLostAfterEnterPressed = checkBoxStayOpenWhenFocusLostAfterEnterPressed.Checked;
Settings.Default.TimeUntilClosesAfterEnterPressed = (int)numericUpDownTimeUntilClosesAfterEnterPressed.Value;
Settings.Default.CacheMainMenu = checkBoxCacheMainMenu.Checked;
Settings.Default.ClearCacheIfMoreThanThisNumberOfItems = (int)numericUpDownClearCacheIfMoreThanThisNumberOfItems.Value;
Settings.Default.SearchPattern = textBoxSearchPattern.Text;
Settings.Default.RoundCorners = checkBoxRoundCorners.Checked;
Settings.Default.UseFading = checkBoxUseFading.Checked;
@ -1191,6 +1193,7 @@ namespace SystemTrayMenu.UserInterface
numericUpDownTimeUntilClosesAfterEnterPressed.Value = 200;
checkBoxCacheMainMenu.Checked = true;
numericUpDownClearCacheIfMoreThanThisNumberOfItems.Value = 200;
textBoxSearchPattern.Text = string.Empty;
}
private void TextBoxColorsChanged(object sender, EventArgs e)

View file

@ -0,0 +1,25 @@
// <copyright file="DirectoryBySearchPattern.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
// see also: https://www.codeproject.com/Articles/2532/Obtaining-and-managing-file-and-folder-icons-using.
namespace SystemTrayMenu.Utilities
{
using System.Collections.Generic;
public static class DirectoryBySearchPattern
{
public static string[] GetFiles(string path, string searchPatternCombined)
{
string[] searchPatterns = searchPatternCombined.Split('|');
List<string> files = new List<string>();
foreach (string searchPattern in searchPatterns)
{
files.AddRange(System.IO.Directory.GetFiles(path, searchPattern));
}
files.Sort();
return files.ToArray();
}
}
}