Skip to content

Commit

Permalink
修复对话框显示不全的bug;优化设为默认的操作逻辑;更新build.cmd;更新readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
DearVa committed Sep 5, 2022
1 parent 08f9d26 commit e027ef3
Show file tree
Hide file tree
Showing 15 changed files with 128 additions and 76 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ jobs:
- name: Setup VSTest
uses: darenm/Setup-VSTest@v1

# Build Explorer Proxy
- name: Build Explorer Proxy
run: MSBuild .\ExplorerProxy\ExplorerProxy.csproj /property:Configuration=Release,Platform=x64

# Install the .NET workload
- name: Install .NET
uses: actions/setup-dotnet@main
Expand All @@ -91,13 +87,16 @@ jobs:
- name: Execute unit tests
run: dotnet test

# Create the app package by building and packaging the Windows Application Packaging project
- name: Create the app package
# Build Explorer Proxy
- name: Build Explorer Proxy
run: |
dotnet publish ExplorerEx -c Release -r win-x64
MSBuild .\ExplorerProxy\ExplorerProxy.csproj /property:Configuration=Release,Platform=x64
copy .\ExplorerProxy\bin\x64\Release\ExplorerProxy.dll .\ExplorerEx\bin\Release\net6.0-windows\win-x64\publish
copy .\ExplorerProxy\bin\x64\Release\Interop.SHDocVw.dll .\ExplorerEx\bin\Release\net6.0-windows\win-x64\publish
# Create the app package by building and packaging the Windows Application Packaging project
- name: Create the app package
run: dotnet publish ExplorerEx -c Release -r win-x64

# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload build artifacts
Expand Down
5 changes: 4 additions & 1 deletion Build.cmd
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
dotnet publish ExplorerEx -c Release -r win-x64
dotnet publish ExplorerEx -c Release -r win-x64
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe .\ExplorerProxy\ExplorerProxy.csproj /property:Configuration=Release,Platform=x64
copy .\ExplorerProxy\bin\x64\Release\ExplorerProxy.dll .\ExplorerEx\bin\Release\net6.0-windows\win-x64\publish
copy .\ExplorerProxy\bin\x64\Release\Interop.SHDocVw.dll .\ExplorerEx\bin\Release\net6.0-windows\win-x64\publish
47 changes: 37 additions & 10 deletions ExplorerEx/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
Expand Down Expand Up @@ -302,10 +303,11 @@ public static class CommonSettings {
}

private static bool SetExplorerExAsDefault_OnChanging(object? o) {
var executingAsm = Assembly.GetExecutingAssembly();
var executingPath = Path.GetDirectoryName(executingAsm.Location)!;
if (o is true) {
var executingAsm = Assembly.GetExecutingAssembly();
var executingPath = Path.GetDirectoryName(executingAsm.Location)!;
ConfigHelper.Save("Path", Path.ChangeExtension(executingAsm.Location, ".exe"));
// 务必检查两个dll的有效性
var proxyDllPath = Path.Combine(executingPath, "ExplorerProxy.dll");
if (!File.Exists(proxyDllPath)) {
ContentDialog.Error("#SetExplorerExAsDefaultFailProxyNotFound".L());
Expand Down Expand Up @@ -344,26 +346,51 @@ public static class CommonSettings {
return false;
}
var setRegString = new StreamReader(stream).ReadToEnd().Replace("REPLACE_HERE", proxyDllPath.Replace('\\', '/'));
var regFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Set ExplorerEx Proxy.reg");
var regFilePath = Path.Combine(executingPath, "SetExplorerExProxy.reg");
File.WriteAllText(regFilePath, setRegString);
Process.Start(new ProcessStartInfo {
FileName = "regedit",
Arguments = "/S " + regFilePath,
UseShellExecute = true
});
} catch {
ContentDialog.Error("#SetExplorerExAsDefaultFailReg".L());
return false;
}
} else {
if (ContentDialog.Ask("#UnsetExplorerExAsDefaultInstructions".L(), "PleaseReadCarefully".L()) != ContentDialog.ContentDialogResult.Primary) {
return true;
}
try {
// 先尝试自动运行Reg
using var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ExplorerEx.Assets.DeleteExplorerExProxy.reg");
if (stream == null) {
ContentDialog.Error("#UnsetExplorerExAsDefaultFailReg".L());
return false;
}
var regFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Delete ExplorerEx Proxy.reg");
using var fs = new FileStream(regFilePath, FileMode.Create);
stream.CopyTo(fs);
var regFilePath = Path.Combine(executingPath, "UnsetExplorerExProxy.reg");
using (var fs = new FileStream(regFilePath, FileMode.Create)) {
stream.CopyTo(fs);
}
Process.Start(new ProcessStartInfo {
FileName = "regedit",
Arguments = "/S " + regFilePath,
UseShellExecute = true
});
} catch {
ContentDialog.Error("#UnsetExplorerExAsDefaultFailReg".L());
// 自动运行失败,改为手动运行
if (ContentDialog.Ask("#UnsetExplorerExAsDefaultInstructions".L(), "PleaseReadCarefully".L()) != ContentDialog.ContentDialogResult.Primary) {
return true;
}
try {
using var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ExplorerEx.Assets.DeleteExplorerExProxy.reg");
if (stream == null) {
ContentDialog.Error("#UnsetExplorerExAsDefaultFailReg".L());
return false;
}
var regFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Delete ExplorerEx Proxy.reg");
using var fs = new FileStream(regFilePath, FileMode.Create);
stream.CopyTo(fs);
} catch {
ContentDialog.Error("#UnsetExplorerExAsDefaultFailReg".L());
}
}
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions ExplorerEx/Strings/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -731,12 +731,12 @@ After you click "OK", a file named "Delete ExplorerEx Proxy.reg" will be created
<value>The file has been created on the desktop. Please confirm whether it exists. If it does NOT exist, you can click "Cancel" to abort, and your default file manager will NOT be changed.</value>
</data>
<data name="#SetExplorerExAsDefaultInstructions2" xml:space="preserve">
<value>Next, after you click "OK", a file named "Set ExplorerEx Proxy.reg" will be created on the desktop. You just need to double-click to open it and select "OK" in the pop-up dialog box to set explorerex as the default file manager, and then delete the file. Please note that do not move the installation directory of this program after setting, otherwise it will become invalid.
<value>Next, after you click "OK", the registry editor may ask you for administrator permission. Please allow me to pass. Please note that do not move the installation directory of this program after setting, otherwise it will become invalid.

Enjoy it :)</value>
</data>
<data name="#UnsetExplorerExAsDefaultInstructions" xml:space="preserve">
<value>Remember "Delete ExplorerEx Proxy.reg"? You can double-click it to open it at any time, and select "OK" in the pop-up dialog box to restore it to the default.
<value>Failed to reset automatically. Remember "Delete ExplorerEx Proxy.reg"? You can double-click it to open it at any time, and select "OK" in the pop-up dialog box to restore it to the default.

Can't find it? Don't worry, click "yes" and I will regenerate one on the desktop.</value>
</data>
Expand Down
4 changes: 2 additions & 2 deletions ExplorerEx/Strings/Resources.zh.resx
Original file line number Diff line number Diff line change
Expand Up @@ -778,12 +778,12 @@ ExplorerEx [-h|--help] [-r|--runInBackground] [-o|--openInNewWindow] [-d|--requi
<value>文件已经在桌面上创建,请确认是否存在。如果不存在,你可以点击“取消”来中止,你的默认文件管理器将不会被更改。</value>
</data>
<data name="#SetExplorerExAsDefaultInstructions2" xml:space="preserve">
<value>接下来,当你点击“好”之后,桌面上会创建一个名为“Set ExplorerEx Proxy.reg”的文件。你只需要双击打开它,并在弹出的对话框中选择“确定”,即可将ExplorerEx设置为默认的文件管理器,之后即可删除该文件。请注意,设置之后请勿再移动本程序的安装目录,否则会失效。
<value>接下来,当你点击“好”之后,注册表编辑器可能会向你索要管理员权限,请允许通过。请注意,设置之后请勿再移动本程序的安装目录,否则会失效。

尽情享受吧~</value>
</data>
<data name="#UnsetExplorerExAsDefaultInstructions" xml:space="preserve">
<value>还记得“Delete ExplorerEx Proxy.reg”吗?你可以随时双击打开它,并在弹出的对话框中选择“确定”来恢复为默认。
<value>自动设置失败了,还记得“Delete ExplorerEx Proxy.reg”吗?你可以随时双击打开它,并在弹出的对话框中选择“确定”来恢复为默认。

已经找不到了吗?别担心,点击“是”我会重新生成一个在桌面上。</value>
</data>
Expand Down
12 changes: 6 additions & 6 deletions ExplorerEx/View/Controls/ContentDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@

<Border Grid.Row="1" DockPanel.Dock="Bottom" Background="{DynamicResource BorderBrush}" BorderBrush="{DynamicResource SecondaryBorderBrush}" BorderThickness="0,1,0,0">
<DockPanel HorizontalAlignment="Stretch" Margin="25,10">
<Button x:Name="PrimaryButton" TabIndex="0" Content="{Binding PrimaryButtonText, Mode=OneWay}" MinWidth="100" MaxWidth="200"
<Button x:Name="PrimaryButton" TabIndex="0" Content="{Binding PrimaryButtonText, Mode=OneWay}" MinWidth="140" MaxWidth="200"
Visibility="{Binding PrimaryButtonText, Converter={StaticResource Object2VisibilityConverter}, Mode=OneWay}"
IsEnabled="{Binding IsPrimaryButtonEnabled, Mode=OneWay}" Command="{Binding PrimaryButtonCommand, Mode=OneWay}"
DockPanel.Dock="Left" Style="{StaticResource ButtonPrimary}" Click="ContentDialogPrimaryButton_OnClick" IsDefault="True"/>
<Button x:Name="SecondaryButton" TabIndex="1" Content="{Binding SecondaryButtonText, Mode=OneWay}" MinWidth="100" MaxWidth="200"
Visibility="{Binding SecondaryButtonText, Converter={StaticResource Object2VisibilityConverter}, Mode=OneWay}"
DockPanel.Dock="Left" Style="{StaticResource ButtonPrimary}" Click="ContentDialogPrimaryButton_OnClick" IsDefault="True" FontSize="14"/>
<Button x:Name="SecondaryButton" TabIndex="1" Content="{Binding SecondaryButtonText, Mode=OneWay}" MinWidth="140" MaxWidth="200"
Visibility="{Binding SecondaryButtonText, Converter={StaticResource Object2VisibilityConverter}, Mode=OneWay}" FontSize="14"
Command="{Binding SecondaryButtonCommand, Mode=OneWay}" Click="ContentDialogSecondaryButton_OnClick" Background="{DynamicResource SecondaryRegionBrush}"/>
<Button TabIndex="2" Content="{Binding CancelButtonText, Mode=OneWay}" MinWidth="100" MaxWidth="200"
<Button TabIndex="2" Content="{Binding CancelButtonText, Mode=OneWay}" MinWidth="140" MaxWidth="200"
Visibility="{Binding CancelButtonText, Converter={StaticResource Object2VisibilityConverter}, Mode=OneWay}"
DockPanel.Dock="Right" HorizontalAlignment="Right" Command="{Binding CancelButtonCommand, Mode=OneWay}"
DockPanel.Dock="Right" HorizontalAlignment="Right" Command="{Binding CancelButtonCommand, Mode=OneWay}" FontSize="14"
Click="ContentDialogCancelButton_OnClick" IsCancel="True" Background="{DynamicResource SecondaryRegionBrush}"/>
</DockPanel>
</Border>
Expand Down
39 changes: 27 additions & 12 deletions ExplorerEx/View/Controls/ContentDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,22 @@ public partial class ContentDialog {

public object Content {
get => GetValue(ContentProperty);
set => SetValue(ContentProperty, value);
set {
if (value is string s) {
// 套一层文本框
SetValue(ContentProperty, new ScrollViewer {
Content = new TextBlock {
Text = s,
TextWrapping = TextWrapping.Wrap,
MaxWidth = 600,
FontSize = 14
},
HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled
});
} else {
SetValue(ContentProperty, value);
}
}
}

public static readonly DependencyProperty PrimaryButtonTextProperty = DependencyProperty.Register(
Expand Down Expand Up @@ -117,30 +132,30 @@ public partial class ContentDialog {
public ContentDialog() {
dispatcherFrame = new DispatcherFrame();

var cubicEase = new CubicEase {
EasingMode = EasingMode.EaseOut
var cubicEaseInOut = new CubicEase {
EasingMode = EasingMode.EaseInOut
};
var cubicEaseIn = new CubicEase {
EasingMode = EasingMode.EaseIn
};
opacityInAnimation = new DoubleAnimation(1d, TimeSpan.FromMilliseconds(200d)) {
EasingFunction = cubicEase
EasingFunction = cubicEaseInOut
};
opacityOutAnimation = new DoubleAnimation(0d, TimeSpan.FromMilliseconds(200d)) {
EasingFunction = cubicEase
EasingFunction = cubicEaseIn
};
scaleInAnimation = new DoubleAnimation(0.8d, 1d, TimeSpan.FromMilliseconds(240d)) {
EasingFunction = new BackEase {
EasingMode = EasingMode.EaseOut,
Amplitude = 1.05d
}
scaleInAnimation = new DoubleAnimation(0.8d, 1d, TimeSpan.FromMilliseconds(200d)) {
EasingFunction = cubicEaseInOut
};
scaleInAnimation.Completed += (_, _) => {
ContentPresenter.Focus();
Shown?.Invoke();
};
scaleXOutAnimation = new DoubleAnimation(1d, 1.2d, TimeSpan.FromMilliseconds(200d)) {
EasingFunction = cubicEase
EasingFunction = cubicEaseIn
};
scaleYOutAnimation = new DoubleAnimation(1d, 1.2d, TimeSpan.FromMilliseconds(200d)) {
EasingFunction = cubicEase
EasingFunction = cubicEaseIn
};
scaleYOutAnimation.Completed += (_, _) => {
dispatcherFrame.Continue = false;
Expand Down
Binary file removed Images/ExplorerCantAddFile.jpg
Binary file not shown.
Binary file added Images/SplitScreen.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Images/SplitScreen.png
Binary file not shown.
Binary file added Images/SuperBookmarks.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Images/SuperBookmarks.png
Binary file not shown.
Binary file added Images/ThemeCustom.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 14 additions & 12 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,29 @@ Some time ago, when I was working on Minecraft mod, I needed to switch frequentl

### Features:

* **Swift.** My standard is that a middle-end computer (such as i5 Series CPU or AMD CPU with the same performance) can open a folder within 500ms. Even a folder with a large number of files like C:\Windows\system32 (I just looked at it, there were 4778 files) still needs to be opened quickly.
* **Swift** My standard is that a middle-end computer (such as i5 Series CPU or AMD CPU with the same performance) can open a folder within 500ms. Even a folder with a large number of files like C:\Windows\system32 (I just looked at it, there were 4778 files) still needs to be opened quickly.

* **Multi-Tabbed.** It supports dragging files onto tabs, copying, moving, creating shortcuts, etc. You can also drag a tab to split the screen, just like in Visual Studio Code.
* **Multi-Tabbed** It supports dragging files onto tabs, copying, moving, creating shortcuts, etc. You can also drag a tab to split the screen, just like in Visual Studio Code.

![SplitScreen](https://github.com/DearVa/ExplorerEx/blob/master/Images/SplitScreen.png)
![SplitScreen.gif](https://raw.githubusercontent.com/DearVa/ExplorerEx/master/Images/SplitScreen.gif)

* **Fast preview.** You can hold Alt and point to a video, a music, a picture even a text file. Then a preview Window will show up, letting you to preview the content of it. You can scroll your mouse to fast forward and rewind.
* **Fast preview** You can hold Alt and point to a video, a music, a picture even a text file. Then a preview Window will show up, letting you to preview the content of it. You can scroll your mouse to fast forward and rewind.

![FastPreview0](https://github.com/DearVa/ExplorerEx/blob/master/Images/FastPreview0.png)

![FastPreview1](https://github.com/DearVa/ExplorerEx/blob/master/Images/FastPreview1.png)

* **Super bookmarks.** Windows built-in file manager not only cannot comment and add files, but also has only one "quick access" column, which cannot be classified. ExplorerEx can collect folders and even files directly! You can also add tags and categories to facilitate search, just like the Microsoft Edge or Google Chorme!
* **Super bookmarks** Windows built-in file manager not only cannot comment and add files, but also has only one "quick access" column, which cannot be classified. ExplorerEx can collect folders and even files directly! You can also add tags and categories to facilitate search, just like the Microsoft Edge or Google Chorme!

![Explorer can't](https://github.com/DearVa/ExplorerEx/blob/master/Images/ExplorerCantAddFile.jpg)
![SuperBookmarks.gif](https://raw.githubusercontent.com/DearVa/ExplorerEx/master/Images/SuperBookmarks.gif)

![ExplorerEx Can](https://github.com/DearVa/ExplorerEx/blob/master/Images/SuperBookmarks.png)
* **Modern UI** I'm using HandyControl: [欢迎使用HandyControl | HandyOrg](https://handyorg.github.io/handycontrol/) to build my UI. I will modify it to make it tend to the fluent UI style of Windows 11. You can custom the theme and change background image.

* **Modern UI**. I'm using HandyControl: [欢迎使用HandyControl | HandyOrg](https://handyorg.github.io/handycontrol/) to build my UI. I will modify it to make it tend to the fluent UI style of windows 11, and add some amazing animations (on the premise of fast response).
![ThemeCustom](https://raw.githubusercontent.com/DearVa/ExplorerEx/master/Images/ThemeCustom.png)

* **Humanized**. For ordinary users, the interface is simple and easy to understand. For users who are familiar with computers, there are also advanced functions such as creating symbol links and not prompting when modifying file extension names. Users can customize them in settings or other places.
* **Humanized** For ordinary users, the interface is simple and easy to understand. For users who are familiar with computers, there are also advanced functions such as creating symbol links and not prompting when modifying file extension names. Users can customize them in settings or other places.

* **Set as Default** ExplorerEx could set itself as the default file manager through a [BHO Plug-in](https://github.com/DearVa/ExplorerEx/tree/master/ExplorerProxy) which has little impact on the system, and any third-party software that opens the default Explorer can jump to ExplorerEx without any window flicker.


### Road map
Expand All @@ -59,13 +60,14 @@ Some time ago, when I was working on Minecraft mod, I needed to switch frequentl
✓ File drag&drop
✓ Free split screen
✓ Super bookmarks
Fast preview
File view switching
zip support
Fast preview
File view switching
zip support
→ bitlocker support
→ OneDrive and network drives

#### Advanced function development
✓ Set as default
→ Private space (File Locker)
→ File label (Alias, Colorful tags)
→ fastcopy (Multi-thread copy)
Expand Down

0 comments on commit e027ef3

Please sign in to comment.