Skip to content

Commit

Permalink
[Feature] Filter menu by file type (#384), version 1.2.9.5
Browse files Browse the repository at this point in the history
Hofknecht committed May 25, 2022
1 parent e128420 commit 07ed93d
Showing 25 changed files with 178 additions and 22 deletions.
6 changes: 3 additions & 3 deletions Business/Menus.cs
Original file line number Diff line number Diff line change
@@ -488,7 +488,7 @@ static string[] GetDirectoriesInNetworkLocation(string networkLocationRootPath)
}
else if (!FileLnk.IsNetworkRoot(path))
{
files = Directory.GetFiles(path);
files = DirectoryBySearchPattern.GetFiles(path, Config.SearchPattern);
files = files.Concat(filesToAddToMainMenu).ToArray();
}

@@ -739,7 +739,7 @@ private static void AddFoldersToMainMenu(ref string[] directoriesToAddToMainMenu
else
{
directoriesToConcat = Directory.GetDirectories(pathAddToMainMenu);
filesToAddToConcat = Directory.GetFiles(pathAddToMainMenu);
filesToAddToConcat = DirectoryBySearchPattern.GetFiles(pathAddToMainMenu, Config.SearchPattern);
}

if (!onlyFiles)
@@ -764,7 +764,7 @@ private static void GetDirectoriesAndFilesRecursive(ref string[] directoriesToCo

try
{
filesToAddToConcat = filesToAddToConcat.Concat(Directory.GetFiles(pathAddToMainMenu)).ToArray();
filesToAddToConcat = filesToAddToConcat.Concat(DirectoryBySearchPattern.GetFiles(pathAddToMainMenu, Config.SearchPattern)).ToArray();
}
catch (Exception ex)
{
2 changes: 2 additions & 0 deletions Config/Config.cs
Original file line number Diff line number Diff line change
@@ -29,6 +29,8 @@ public static class Config

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()
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -39,5 +39,5 @@
// 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")]
16 changes: 16 additions & 0 deletions Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 9 additions & 0 deletions Resources/Languages/lang.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Resources/Languages/lang.cs-CZ.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions Resources/Languages/lang.de-DE.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions Resources/Languages/lang.es-ES.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions Resources/Languages/lang.fa-IR.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions Resources/Languages/lang.fr-FR.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions Resources/Languages/lang.it-IT.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions Resources/Languages/lang.ja-JP.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions Resources/Languages/lang.ko-KR.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions Resources/Languages/lang.nl-NL.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions Resources/Languages/lang.pt-BR.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions Resources/Languages/lang.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions Resources/Languages/lang.ru-RU.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions Resources/Languages/lang.tr-TR.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions Resources/Languages/lang.vi-VN.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions Resources/Languages/lang.zh-CN.resx
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 2 additions & 1 deletion UserInterface/AppContextMenu.cs
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ static void About_Click(object sender, EventArgs e)
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 @@ static void About_Click(object sender, EventArgs e)
* Ralf K.
* donaldaken
* Marc Speer
* boydfields
* Traditional_Tap3954
* Maximilian H.
";
58 changes: 55 additions & 3 deletions UserInterface/SettingsForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 16 additions & 13 deletions UserInterface/SettingsForm.cs
Original file line number Diff line number Diff line change
@@ -185,6 +185,7 @@ void Translate()
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 @@ void NumericUpDown_MouseWheel(object sender, MouseEventArgs e)
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 @@ void PossibilityToSelectFolderByWindowsContextMenu()
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 @@ private void ButtonExpertDefault_Click(object sender, EventArgs e)
numericUpDownTimeUntilClosesAfterEnterPressed.Value = 200;
checkBoxCacheMainMenu.Checked = true;
numericUpDownClearCacheIfMoreThanThisNumberOfItems.Value = 200;
textBoxSearchPattern.Text = string.Empty;
}

private void TextBoxColorsChanged(object sender, EventArgs e)
25 changes: 25 additions & 0 deletions Utilities/File/DirectoryBySearchPattern.cs
Original file line number Diff line number Diff line change
@@ -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();
}
}
}

0 comments on commit 07ed93d

Please sign in to comment.