Skip to content

Commit 1a88a37

Browse files
committed
1.0
1 parent c653550 commit 1a88a37

File tree

8 files changed

+155
-26
lines changed

8 files changed

+155
-26
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11

2-
Used Theme:
2+
# Dark Everything Frontend
3+
4+
Simple Everything frontend with dark UI!
5+
6+
### Screenshot
7+
8+
![-](Screenshot.png)
9+
10+
### Requirements
11+
12+
- [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)
14+
15+
### Theme
316

417
https://github.com/DanPristupov/WpfExpressionBlendTheme
18+
19+
### Download
20+
21+
https://github.com/stax76/Everything-Frontend/releases

Screenshot.png

248 KB
Loading

src/Everything Frontend.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
55
<TargetFramework>net5.0-windows</TargetFramework>
6+
<OutDir>$(SolutionDir)\bin</OutDir>
67
<UseWPF>true</UseWPF>
78
<ApplicationIcon>Everything.ico</ApplicationIcon>
89
<Authors>Frank Skare (stax76)</Authors>
910
<Copyright>Copyright (C) 2020 Frank Skare (stax76)</Copyright>
1011
<Product>Everything Frontend</Product>
11-
<Description>Everything Frontend with dark mode.</Description>
12+
<Description>Simple Everything frontend with dark mode.</Description>
1213
<AssemblyName>EverythingFrontend</AssemblyName>
1314
<RootNamespace>EverythingFrontend</RootNamespace>
1415
</PropertyGroup>

src/Item.cs

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,59 @@ namespace EverythingFrontend
55
{
66
class Item
77
{
8-
public string Name { get; set; }
9-
public string Directory { get; set; }
10-
public long Size { get; set; }
11-
public DateTime Date { get; set; }
8+
public Item(uint index)
9+
{
10+
Index = index;
11+
}
12+
13+
string NameValue;
14+
15+
public string Name {
16+
get {
17+
if (!WasInitialized)
18+
Init();
19+
return NameValue;
20+
}
21+
}
22+
23+
string DirectoryValue;
24+
25+
public string Directory {
26+
get {
27+
if (!WasInitialized)
28+
Init();
29+
return DirectoryValue;
30+
}
31+
}
32+
33+
long SizeValue;
34+
35+
public long Size {
36+
get {
37+
if (!WasInitialized)
38+
Init();
39+
return SizeValue;
40+
}
41+
}
42+
43+
DateTime DateValue;
44+
45+
public DateTime Date {
46+
get {
47+
if (!WasInitialized)
48+
Init();
49+
return DateValue;
50+
}
51+
}
52+
53+
public uint Index { get; }
54+
55+
bool WasInitialized;
56+
57+
void Init()
58+
{
59+
Model.Init(Index, ref NameValue, ref DirectoryValue, ref SizeValue, ref DateValue);
60+
WasInitialized = true;
61+
}
1262
}
1363
}

src/Model.cs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ class Model
1212
public static List<Item> GetItems(string searchText)
1313
{
1414
List<Item> items = new List<Item>();
15-
StringBuilder sb = new StringBuilder(500);
15+
16+
if (searchText.Length < 2)
17+
return items;
18+
1619
Everything_SetSearch(searchText);
1720

1821
Everything_SetRequestFlags(
@@ -24,26 +27,27 @@ public static List<Item> GetItems(string searchText)
2427
Everything_Query(true);
2528
uint count = Everything_GetNumResults();
2629

27-
if (count > 1000)
28-
count = 1000;
29-
30-
for (uint i = 0; i < count; i++)
31-
{
32-
Everything_GetResultFullPathName(i, sb, (uint)sb.Capacity);
33-
string path = sb.ToString();
34-
Everything_GetResultSize(i, out var size);
35-
Everything_GetResultDateModified(i, out var fileTime);
36-
37-
items.Add(new Item() {
38-
Directory = Path.GetDirectoryName(path),
39-
Name = Path.GetFileName(path),
40-
Size = size,
41-
Date = DateTime.FromFileTime(fileTime)
42-
});
43-
}
30+
for (uint i = 0; i < count; i++)
31+
items.Add(new Item(i));
32+
4433
return items;
4534
}
4635

36+
public static void Init(uint index, ref string name, ref string directory, ref long size, ref DateTime date)
37+
{
38+
StringBuilder sb = new StringBuilder(500);
39+
Everything_GetResultFullPathName(index, sb, (uint)sb.Capacity);
40+
string path = sb.ToString();
41+
Everything_GetResultSize(index, out var size2);
42+
Everything_GetResultDateModified(index, out var fileTime);
43+
directory = Path.GetDirectoryName(path);
44+
name = Path.GetFileName(path);
45+
size = size2;
46+
47+
if (fileTime != -1)
48+
date = DateTime.FromFileTime(fileTime);
49+
}
50+
4751
const int EVERYTHING_REQUEST_FILE_NAME = 0x00000001;
4852
const int EVERYTHING_REQUEST_PATH = 0x00000002;
4953
const int EVERYTHING_REQUEST_SIZE = 0x00000010;

src/SizeConverter.cs

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

2+
using System;
3+
using System.Globalization;
4+
using System.Windows.Data;
5+
6+
namespace EverythingFrontend
7+
{
8+
public class SizeConverter : IValueConverter
9+
{
10+
public double Length { get; set; }
11+
12+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
13+
{
14+
long bytes = (long)value;
15+
16+
if (bytes == -1)
17+
return "";
18+
19+
if (bytes < 1024)
20+
return bytes + " B";
21+
22+
if (bytes < 1024 * 1024)
23+
return System.Convert.ToInt32(bytes / 1024.0) + " KB";
24+
25+
if (bytes < 1024 * 1024 * 1024)
26+
return (bytes / 1024.0 / 1024.0).ToString("F2") + " MB";
27+
28+
return (bytes / 1024.0 / 1024.0 / 1024.0).ToString("F2") + " GB";
29+
}
30+
31+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
32+
{
33+
throw new NotImplementedException();
34+
}
35+
}
36+
}

src/View.xaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
xmlns:local="clr-namespace:EverythingFrontend"
78
xmlns:glob="clr-namespace:System.Globalization;assembly=mscorlib"
89
Style="{StaticResource {x:Type Window}}"
910
mc:Ignorable="d"
1011
Title="Everything"
1112
Height="450"
1213
Width="800"
1314
WindowStartupLocation="CenterScreen">
15+
16+
<Window.Resources>
17+
<local:SizeConverter x:Key="SizeConverter" />
18+
</Window.Resources>
1419

1520
<Grid FocusManager.FocusedElement="{Binding ElementName=SearchTextBox}">
1621

@@ -29,12 +34,13 @@
2934

3035
<DataGrid AutoGenerateColumns="False"
3136
Grid.Row="1"
32-
ItemsSource="{Binding Items}">
37+
IsReadOnly="True"
38+
ItemsSource="{Binding Items}" MouseDoubleClick="DataGrid_MouseDoubleClick">
3339

3440
<DataGrid.Columns>
3541
<DataGridTextColumn Header="Name" Width="250" Binding="{Binding Name}" />
3642
<DataGridTextColumn Header="Directory" Width="300" Binding="{Binding Directory}" />
37-
<DataGridTextColumn Header="Size" Binding="{Binding Size}" />
43+
<DataGridTextColumn Header="Size" Binding="{Binding Size, Converter={StaticResource SizeConverter}}" />
3844
<DataGridTextColumn Header="Modified Date" Binding="{Binding Date, StringFormat=\{0:g\}, ConverterCulture={x:Static glob:CultureInfo.CurrentCulture}}" />
3945
</DataGrid.Columns>
4046
</DataGrid>

src/View.xaml.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11

2+
using System.Diagnostics;
3+
using System.IO;
24
using System.Windows;
5+
using System.Windows.Controls;
6+
using System.Windows.Input;
37

48
namespace EverythingFrontend
59
{
@@ -10,5 +14,16 @@ public View()
1014
InitializeComponent();
1115
DataContext = new ViewModel();
1216
}
17+
18+
private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
19+
{
20+
DataGrid grid = sender as DataGrid;
21+
22+
if (grid.SelectedItem != null)
23+
{
24+
Item item = grid.SelectedItem as Item;
25+
Process.Start("explorer.exe", "/n, /select, \"" + Path.Combine(item.Directory, item.Name) + "\"");
26+
}
27+
}
1328
}
1429
}

0 commit comments

Comments
 (0)