Skip to content

Commit eebd302

Browse files
committed
v1.1
1 parent 98435f6 commit eebd302

File tree

8 files changed

+215
-12
lines changed

8 files changed

+215
-12
lines changed

License.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
MIT License
3+
4+
Copyright (C) 2017-2020 Frank Skare (stax76)
5+
6+
Permission is hereby granted, free of charge, to any person
7+
obtaining a copy of this software and ssociated documentation
8+
files (the "Software"), to deal in the Software without restriction,
9+
including without limitation the rights to use, copy, modify, merge,
10+
publish, distribute, sublicense, and/or sell copies of the Software,
11+
and to permit persons to whom the Software is furnished to do so,
12+
subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be
15+
included in all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
24+
THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,19 @@ Voidtools Everything frontend with dark mode.
1010
### Requirements
1111

1212
- [Voidtools Everything installation](https://www.voidtools.com/downloads)
13-
- [.NET 5 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-desktop-5.0.0-windows-x64-installer)
13+
- [.NET 5 Desktop Runtime installation](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-desktop-5.0.0-windows-x64-installer)
14+
15+
### Usage
16+
17+
ESC key closes the app.
18+
19+
Up key restores the search text from the last session.
20+
21+
Double-click shows the file in File Explorer.
22+
23+
Right-click opens the files native shell context menu.
24+
25+
F1 key shows the about dialog.
1426

1527
### Theme
1628

src/Everything.NET.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<Description>Everything frontend with dark UI.</Description>
1414
<AssemblyName>EverythingNET</AssemblyName>
1515
<RootNamespace>EverythingNET</RootNamespace>
16+
<Version>1.1.0</Version>
1617
</PropertyGroup>
1718

1819
<ItemGroup>

src/License.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
MIT License
3+
4+
Copyright (C) 2017-2020 Frank Skare (stax76)
5+
6+
Permission is hereby granted, free of charge, to any person
7+
obtaining a copy of this software and ssociated documentation
8+
files (the "Software"), to deal in the Software without restriction,
9+
including without limitation the rights to use, copy, modify, merge,
10+
publish, distribute, sublicense, and/or sell copies of the Software,
11+
and to permit persons to whom the Software is furnished to do so,
12+
subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be
15+
included in all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
24+
THE USE OR OTHER DEALINGS IN THE SOFTWARE.

src/RegistryHelp.cs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+

2+
using System;
3+
using Microsoft.Win32;
4+
using System.Windows.Forms;
5+
6+
public class RegistryHelp
7+
{
8+
public static string ApplicationKey { get; } = @"HKCU\Software\" + Application.ProductName;
9+
10+
public static void SetValue(string path, string name, object value)
11+
{
12+
using (RegistryKey regKey = GetRootKey(path).CreateSubKey(path.Substring(5), RegistryKeyPermissionCheck.ReadWriteSubTree))
13+
regKey.SetValue(name, value);
14+
}
15+
16+
public static string GetString(string path, string name, string defaultValue = "")
17+
{
18+
object value = GetValue(path, name, defaultValue);
19+
return !(value is string) ? defaultValue : value.ToString();
20+
}
21+
22+
public static int GetInt(string path, string name, int defaultValue = 0)
23+
{
24+
object value = GetValue(path, name, defaultValue);
25+
return !(value is int) ? defaultValue : (int)value;
26+
}
27+
28+
public static object GetValue(string path, string name, object defaultValue = null)
29+
{
30+
using (RegistryKey regKey = GetRootKey(path).OpenSubKey(path.Substring(5)))
31+
return regKey == null ? null : regKey.GetValue(name, defaultValue);
32+
}
33+
34+
public static void RemoveKey(string path)
35+
{
36+
try
37+
{
38+
GetRootKey(path).DeleteSubKeyTree(path.Substring(5), false);
39+
}
40+
catch { }
41+
}
42+
43+
public static void RemoveValue(string path, string name)
44+
{
45+
try
46+
{
47+
using (RegistryKey regKey = GetRootKey(path).OpenSubKey(path.Substring(5), true))
48+
if (regKey != null)
49+
regKey.DeleteValue(name, false);
50+
}
51+
catch { }
52+
}
53+
54+
static RegistryKey GetRootKey(string path)
55+
{
56+
switch (path.Substring(0, 4))
57+
{
58+
case "HKLM": return Registry.LocalMachine;
59+
case "HKCU": return Registry.CurrentUser;
60+
case "HKCR": return Registry.ClassesRoot;
61+
default: throw new Exception();
62+
}
63+
}
64+
}

src/View.xaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
Title="Everything.NET"
1212
Height="450"
1313
Width="800"
14-
WindowStartupLocation="CenterScreen">
14+
WindowStartupLocation="CenterScreen"
15+
Activated="Window_Activated"
16+
SizeChanged="Window_SizeChanged">
1517

1618
<Window.Resources>
1719
<local:SizeConverter x:Key="SizeConverter" />
@@ -29,7 +31,8 @@
2931
Margin="20"
3032
Padding="2"
3133
FontSize="14"
32-
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" >
34+
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"
35+
PreviewKeyDown="SearchTextBox_PreviewKeyDown" >
3336
</TextBox>
3437

3538
<DataGrid AutoGenerateColumns="False"
@@ -42,8 +45,8 @@
4245
MouseRightButtonUp="DataGrid_MouseRightButtonUp">
4346

4447
<DataGrid.Columns>
45-
<DataGridTextColumn Header="Name" Width="250" Binding="{Binding Name}" />
46-
<DataGridTextColumn Header="Directory" Width="300" Binding="{Binding Directory}" />
48+
<DataGridTextColumn x:Name="NameColumn" Header="Name" Width="250" Binding="{Binding Name}" />
49+
<DataGridTextColumn x:Name="DirectoryColumn" Header="Directory" Width="300" Binding="{Binding Directory}" />
4750
<DataGridTextColumn Header="Size" Binding="{Binding Size, Converter={StaticResource SizeConverter}}" />
4851
<DataGridTextColumn Header="Modified Date" Binding="{Binding Date, StringFormat=\{0:g\}, ConverterCulture={x:Static glob:CultureInfo.CurrentCulture}}" />
4952
</DataGrid.Columns>

src/View.xaml.cs

Lines changed: 76 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11

2-
using Shell;
32
using System;
3+
using System.ComponentModel;
44
using System.Diagnostics;
55
using System.IO;
6+
using System.Threading;
7+
using System.Threading.Tasks;
68
using System.Windows;
79
using System.Windows.Controls;
810
using System.Windows.Input;
11+
using System.Windows.Interop;
912
using System.Windows.Media;
1013

14+
using Shell;
15+
1116
namespace EverythingNET
1217
{
1318
public partial class View : Window
1419
{
20+
ViewModel ViewModel;
21+
1522
public View()
1623
{
1724
InitializeComponent();
18-
DataContext = new ViewModel();
25+
ViewModel = new ViewModel();
26+
DataContext = ViewModel;
1927
}
2028

2129
void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
@@ -42,7 +50,7 @@ void DataGrid_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
4250
row.IsSelected = true;
4351
}
4452

45-
private void DataGrid_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
53+
void DataGrid_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
4654
{
4755
DataGrid grid = sender as DataGrid;
4856

@@ -55,12 +63,76 @@ private void DataGrid_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
5563
{
5664
ShellContextMenu menu = new ShellContextMenu();
5765
FileInfo[] files = { new FileInfo(file) };
58-
IntPtr handle = new System.Windows.Interop.WindowInteropHelper(this).Handle;
66+
IntPtr handle = new WindowInteropHelper(this).Handle;
5967
Point screenPos = PointToScreen(Mouse.GetPosition(this));
6068
System.Drawing.Point screenPos2 = new System.Drawing.Point((int)screenPos.X, (int)screenPos.Y);
6169
menu.ShowContextMenu(handle, files, screenPos2);
70+
Task.Run(() => {
71+
Thread.Sleep(2000);
72+
ViewModel.Update();
73+
});
74+
}
75+
}
76+
}
77+
78+
protected override void OnKeyDown(KeyEventArgs e)
79+
{
80+
base.OnKeyDown(e);
81+
82+
if (e.Key == Key.Escape)
83+
Close();
84+
85+
if (e.Key == Key.F1)
86+
{
87+
using (var proc = Process.GetCurrentProcess())
88+
{
89+
string txt = "Everything.NET\n\nCopyright (C) 2020 Frank Skare (stax76)\n\nVersion " +
90+
FileVersionInfo.GetVersionInfo(proc.MainModule.FileName).FileVersion.ToString() +
91+
"\n\n" + "MIT License";
92+
93+
MessageBox.Show(txt);
94+
}
95+
}
96+
}
97+
98+
protected override void OnClosing(CancelEventArgs e)
99+
{
100+
base.OnClosing(e);
101+
102+
if (!string.IsNullOrEmpty(ViewModel.SearchText))
103+
RegistryHelp.SetValue(RegistryHelp.ApplicationKey, "LastText", ViewModel.SearchText);
104+
}
105+
106+
protected override void OnStateChanged(EventArgs e)
107+
{
108+
base.OnStateChanged(e);
109+
110+
}
111+
112+
void SearchTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
113+
{
114+
if (e.Key == Key.Up)
115+
{
116+
string last = RegistryHelp.GetString(RegistryHelp.ApplicationKey, "LastText");
117+
118+
if (!string.IsNullOrEmpty(last))
119+
{
120+
SearchTextBox.Text = last;
121+
SearchTextBox.CaretIndex = 1000;
62122
}
63123
}
64124
}
125+
126+
void Window_Activated(object sender, EventArgs e)
127+
{
128+
if (!string.IsNullOrEmpty(ViewModel.SearchText))
129+
ViewModel.Update();
130+
}
131+
132+
void Window_SizeChanged(object sender, SizeChangedEventArgs e)
133+
{
134+
NameColumn.Width = ActualWidth * 0.25;
135+
DirectoryColumn.Width = ActualWidth * 0.5;
136+
}
65137
}
66138
}

src/ViewModel.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@ public string SearchText {
3434
}
3535
}
3636

37-
void TypeAssistant_Idled(string text) => Update(text);
37+
void TypeAssistant_Idled(string text)
38+
{
39+
Update();
40+
}
3841

39-
void Update(string text)
42+
public void Update()
4043
{
41-
List<Item> items = Model.GetItems(text);
44+
List<Item> items = Model.GetItems(SearchText);
4245
Application.Current.Dispatcher.Invoke(() => Items = items);
4346
}
4447
}

0 commit comments

Comments
 (0)