diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index cc17ede..ef0aa8d 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -6,7 +6,7 @@
x64
- 0.2.8
+ 0.2.9
X-Filer
X-Filer
diff --git a/src/Plugins/XFiler.Base/XFiler.Base.csproj b/src/Plugins/XFiler.Base/XFiler.Base.csproj
index 825e67e..7e86106 100644
--- a/src/Plugins/XFiler.Base/XFiler.Base.csproj
+++ b/src/Plugins/XFiler.Base/XFiler.Base.csproj
@@ -1,7 +1,7 @@
-
+
all
diff --git a/src/SDK/XFiler.SDK/Behaviors/RegistryContextMenuBehavior.cs b/src/SDK/XFiler.SDK/Behaviors/RegistryContextMenuBehavior.cs
index 29edd8b..64e2466 100644
--- a/src/SDK/XFiler.SDK/Behaviors/RegistryContextMenuBehavior.cs
+++ b/src/SDK/XFiler.SDK/Behaviors/RegistryContextMenuBehavior.cs
@@ -39,16 +39,7 @@ public static bool GetRootItem(DependencyObject element)
public static readonly DependencyProperty SelectedItemsContainerProperty = DependencyProperty.Register(
nameof(SelectedItemsContainer), typeof(ObjectReference), typeof(RegistryContextMenuBehavior),
new PropertyMetadata(default(ObjectReference)));
-
- //private static void PropsChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
- //{
- // if (d is RegistryContextMenuBehavior behavior)
- // {
- // if (behavior.NativeContextMenuLoader != null && behavior.FileInfoModel != null)
- // behavior.LoadNativeContextMenuItems(behavior.NativeContextMenuLoader, behavior.FileInfoModel);
- // }
- //}
-
+
#endregion
#region Public Properties
diff --git a/src/SDK/XFiler.SDK/Helpers/NativeContextMenuLoaderReference.cs b/src/SDK/XFiler.SDK/Helpers/NativeContextMenuLoaderReference.cs
index 701e764..4ce7162 100644
--- a/src/SDK/XFiler.SDK/Helpers/NativeContextMenuLoaderReference.cs
+++ b/src/SDK/XFiler.SDK/Helpers/NativeContextMenuLoaderReference.cs
@@ -17,7 +17,12 @@ public INativeContextMenuLoader NativeContextMenuLoader
set => SetValue(NativeContextMenuLoaderProperty, value);
}
+ public IReadOnlyList AddItems => NativeContextMenuLoader.AddItems;
+
public ICommand InvokeCommand => NativeContextMenuLoader.InvokeCommand;
+ public ICommand InvokeAddNewItemsCommand => NativeContextMenuLoader.InvokeAddNewItemsCommand;
+
+ public void Init() => NativeContextMenuLoader?.Init();
public IReadOnlyList CreateMenuItems(IEnumerable selectedItems)
{
diff --git a/src/SDK/XFiler.SDK/Services/ContextMenu/IAddNewContextMenuModel.cs b/src/SDK/XFiler.SDK/Services/ContextMenu/IAddNewContextMenuModel.cs
new file mode 100644
index 0000000..17f1754
--- /dev/null
+++ b/src/SDK/XFiler.SDK/Services/ContextMenu/IAddNewContextMenuModel.cs
@@ -0,0 +1,12 @@
+using System.Windows.Controls;
+
+namespace XFiler.SDK;
+
+public interface IAddNewContextMenuModel
+{
+ string Extension { get; }
+ string Name { get; }
+ byte[]? Data { get; }
+ string? Template { get; }
+ Image? Icon { get; }
+}
\ No newline at end of file
diff --git a/src/SDK/XFiler.SDK/Services/IRegistryContextMenuLoader.cs b/src/SDK/XFiler.SDK/Services/ContextMenu/INativeContextMenuLoader.cs
similarity index 57%
rename from src/SDK/XFiler.SDK/Services/IRegistryContextMenuLoader.cs
rename to src/SDK/XFiler.SDK/Services/ContextMenu/INativeContextMenuLoader.cs
index 2c171f6..85af453 100644
--- a/src/SDK/XFiler.SDK/Services/IRegistryContextMenuLoader.cs
+++ b/src/SDK/XFiler.SDK/Services/ContextMenu/INativeContextMenuLoader.cs
@@ -1,21 +1,15 @@
using System.Collections.Generic;
using System.Windows.Input;
-using System.Windows.Media;
namespace XFiler.SDK;
public interface INativeContextMenuLoader
{
+ IReadOnlyList AddItems { get; }
ICommand InvokeCommand { get; }
+ ICommand InvokeAddNewItemsCommand { get; }
- IReadOnlyList CreateMenuItems(IEnumerable selectedItems);
-}
-
-public interface IRegistryContextMenuModel
-{
- string Name { get; }
+ void Init();
- ImageSource? Icon { get; }
-
- IReadOnlyList? Children { get; }
+ IReadOnlyList CreateMenuItems(IEnumerable selectedItems);
}
\ No newline at end of file
diff --git a/src/SDK/XFiler.SDK/Services/ContextMenu/IRegistryContextMenuModel.cs b/src/SDK/XFiler.SDK/Services/ContextMenu/IRegistryContextMenuModel.cs
new file mode 100644
index 0000000..476551e
--- /dev/null
+++ b/src/SDK/XFiler.SDK/Services/ContextMenu/IRegistryContextMenuModel.cs
@@ -0,0 +1,13 @@
+using System.Collections.Generic;
+using System.Windows.Media;
+
+namespace XFiler.SDK;
+
+public interface IRegistryContextMenuModel
+{
+ string Name { get; }
+
+ ImageSource? Icon { get; }
+
+ IReadOnlyList? Children { get; }
+}
\ No newline at end of file
diff --git a/src/SDK/XFiler.SDK/Services/IDriveDetector.cs b/src/SDK/XFiler.SDK/Services/IDriveDetector.cs
index 582436c..259c71d 100644
--- a/src/SDK/XFiler.SDK/Services/IDriveDetector.cs
+++ b/src/SDK/XFiler.SDK/Services/IDriveDetector.cs
@@ -1,15 +1,16 @@
using System;
-namespace XFiler.SDK
+namespace XFiler.SDK;
+
+public interface IDriveDetector
+{
+ event Action DriveChanged;
+
+ void Init();
+}
+
+public enum EventType
{
- public interface IDriveDetector
- {
- event Action DriveChanged;
- }
-
- public enum EventType
- {
- Added = 2,
- Removed = 3
- }
+ Added = 2,
+ Removed = 3
}
\ No newline at end of file
diff --git a/src/SDK/XFiler.SDK/Services/IFileOperations.cs b/src/SDK/XFiler.SDK/Services/IFileOperations.cs
index 272bd25..9a47466 100644
--- a/src/SDK/XFiler.SDK/Services/IFileOperations.cs
+++ b/src/SDK/XFiler.SDK/Services/IFileOperations.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.IO;
+using System.Threading.Tasks;
namespace XFiler.SDK;
@@ -19,4 +20,8 @@ void Delete(IReadOnlyList items, DirectoryInfo targetDirectory,
void CreateFolder(string targetFolder, string name = "Новая папка");
void CreateEmptyTextFile(string targetFolder, string name = "Новый текстовый документ");
-}
\ No newline at end of file
+
+ Task CreateFile(string targetFolder, string name, string extension);
+
+ Task CreateFileFromTemplate(string targetFolder, string name, string extension, string template);
+}
\ No newline at end of file
diff --git a/src/SDK/XFiler.SDK/Services/ILaunchAtStartupService.cs b/src/SDK/XFiler.SDK/Services/ILaunchAtStartupService.cs
index 83fecd6..7b3ff2f 100644
--- a/src/SDK/XFiler.SDK/Services/ILaunchAtStartupService.cs
+++ b/src/SDK/XFiler.SDK/Services/ILaunchAtStartupService.cs
@@ -1,7 +1,6 @@
-namespace XFiler.SDK
+namespace XFiler.SDK;
+
+public interface ILaunchAtStartupService
{
- public interface ILaunchAtStartupService
- {
- void Init();
- }
+ void Init();
}
\ No newline at end of file
diff --git a/src/SDK/XFiler.SDK/Services/IRestartService.cs b/src/SDK/XFiler.SDK/Services/IRestartService.cs
index af844aa..5c3f634 100644
--- a/src/SDK/XFiler.SDK/Services/IRestartService.cs
+++ b/src/SDK/XFiler.SDK/Services/IRestartService.cs
@@ -1,9 +1,8 @@
-namespace XFiler.SDK
+namespace XFiler.SDK;
+
+public interface IRestartService
{
- public interface IRestartService
- {
- void RestartApplication();
+ void RestartApplication();
- const string RestartKey = "/restart";
- }
+ const string RestartKey = "/restart";
}
\ No newline at end of file
diff --git a/src/SDK/XFiler.SDK/Services/IStorage.cs b/src/SDK/XFiler.SDK/Services/IStorage.cs
index 8c8795e..e4dc8a7 100644
--- a/src/SDK/XFiler.SDK/Services/IStorage.cs
+++ b/src/SDK/XFiler.SDK/Services/IStorage.cs
@@ -13,10 +13,6 @@ public interface IStorage
string DbDirectory { get; }
string Bookmarks { get; }
-
- string ContextMenuFolder { get; }
-
- string ContextMenuTxtFile { get; }
-
- string ContextMenuTxtFile2 { get; }
+
+ string ExtensionsDirectory { get; }
}
\ No newline at end of file
diff --git a/src/SDK/XFiler.SDK/XFiler.SDK.csproj b/src/SDK/XFiler.SDK/XFiler.SDK.csproj
index a1ba8a4..4612ed2 100644
--- a/src/SDK/XFiler.SDK/XFiler.SDK.csproj
+++ b/src/SDK/XFiler.SDK/XFiler.SDK.csproj
@@ -1,9 +1,9 @@
-
+
-
+
all
diff --git a/src/Themes/XFiler.GoogleChromeStyle/XFiler.GoogleChromeStyle.csproj b/src/Themes/XFiler.GoogleChromeStyle/XFiler.GoogleChromeStyle.csproj
index cb2232a..016c34a 100644
--- a/src/Themes/XFiler.GoogleChromeStyle/XFiler.GoogleChromeStyle.csproj
+++ b/src/Themes/XFiler.GoogleChromeStyle/XFiler.GoogleChromeStyle.csproj
@@ -1,9 +1,9 @@
-
-
-
+
+
+
diff --git a/src/XFiler/App.xaml.cs b/src/XFiler/App.xaml.cs
index c19b3e5..ddcf6d9 100644
--- a/src/XFiler/App.xaml.cs
+++ b/src/XFiler/App.xaml.cs
@@ -1,8 +1,7 @@
-using System.IO;
-using System.Text;
-using Autofac;
+using Autofac;
using Hardcodet.Wpf.TaskbarNotification;
using SingleInstanceHelper;
+using System.Text;
using XFiler.TrayIcon;
namespace XFiler;
@@ -35,9 +34,9 @@ protected override void OnStartup(StartupEventArgs e)
Host.Resolve().Init();
Host.Resolve().Init();
Host.Resolve().Init();
-
- Host.Resolve().DriveChanged += OnDriveChanged;
-
+ Host.Resolve().Init();
+ Host.Resolve().Init();
+
LoadNotifyIconResourceDictionary();
_trayIcon = FindResource("TrayIcon") as TaskbarIcon
@@ -99,20 +98,7 @@ private void LoadNotifyIconResourceDictionary()
is ResourceDictionary resourceDict)
resources.Add(resourceDict);
}
-
- private void OnDriveChanged(EventType type, string driveName)
- {
- if (type == EventType.Added)
- {
- DirectoryInfo info = new(driveName);
-
- var tab = Host.Resolve>().Invoke().CreateExplorerTab(info);
-
- if (tab != null)
- Host.Resolve().OpenTabInNewWindow(tab);
- }
- }
-
+
private void ShowArgs(IEnumerable args)
{
StringBuilder sb = new();
diff --git a/src/XFiler/Behaviors/AddNewContextMenuBehavior.cs b/src/XFiler/Behaviors/AddNewContextMenuBehavior.cs
new file mode 100644
index 0000000..d8320f8
--- /dev/null
+++ b/src/XFiler/Behaviors/AddNewContextMenuBehavior.cs
@@ -0,0 +1,116 @@
+using System.Windows.Controls;
+using Microsoft.Xaml.Behaviors;
+
+namespace XFiler;
+
+internal sealed class AddNewContextMenuBehavior : Behavior