Skip to content

Commit bb9d3d2

Browse files
committed
v9.1.29632.0
1 parent a21b8c5 commit bb9d3d2

57 files changed

Lines changed: 2442 additions & 470 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Common/Common.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<Compile Remove="FolderMetadataExt.cs" />
1616
</ItemGroup>
1717
<ItemGroup>
18-
<PackageReference Include="ITHit.FileSystem.Windows" Version="9.0.29552.0" />
19-
<PackageReference Include="ITHit.FileSystem" Version="9.0.29552.0" />
18+
<PackageReference Include="ITHit.FileSystem.Windows" Version="9.1.29632.0" />
19+
<PackageReference Include="ITHit.FileSystem" Version="9.1.29632.0" />
2020
</ItemGroup>
2121
</Project>

Common/Settings.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,10 @@ public class Settings
5656
/// Get or set the custom columns for the file system items.
5757
/// </summary>
5858
public Dictionary<int, string> CustomColumns { get; set; }
59+
60+
/// <summary>
61+
/// Refresh Windows Explorer when navigating to a folder. Default is true.
62+
/// </summary>
63+
public bool RefreshExplorerOnFolderNavigation { get; set; } = true;
5964
}
6065
}

Windows/Common/Core/Common.Windows.Core.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
<Compile Remove="Logger.cs" />
1717
</ItemGroup>
1818
<ItemGroup>
19-
<PackageReference Include="log4net" Version="3.0.3" />
19+
<PackageReference Include="log4net" Version="3.3.1" />
2020
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
2121
</ItemGroup>
2222
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
2323
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.26100.1742" />
2424
</ItemGroup>
2525
<ItemGroup>
26-
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="9.0.29552.0" />
27-
<PackageReference Include="ITHit.FileSystem.Windows" Version="9.0.29552.0" />
26+
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="9.1.29632.0" />
27+
<PackageReference Include="ITHit.FileSystem.Windows" Version="9.1.29632.0" />
2828
<ProjectReference Include="..\..\..\Common\Common.csproj" />
2929
</ItemGroup>
3030
</Project>

Windows/Common/Core/Registrar.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ public async Task<StorageProviderSyncRootInfo> RegisterSyncRootAsync(string sync
8080
return syncRoot;
8181
}
8282

83+
public void SetDriveName(string syncRootId, string displayName)
84+
{
85+
ShellExtensionRegistrar.SetDriveName(syncRootId, displayName);
86+
}
87+
8388
/*
8489
/// <summary>
8590
/// Unregisters sync root, shell extensions, deletes all synced items.
@@ -329,6 +334,7 @@ private static async Task<StorageProviderSyncRootInfo> RegisterAsync(string sync
329334

330335
// The read-only attribute is used to indicate that the item is being locked by another user. Do NOT include it into InSyncPolicy.
331336
storageInfo.InSyncPolicy = StorageProviderInSyncPolicy.Default;
337+
storageInfo.HardlinkPolicy = StorageProviderHardlinkPolicy.Allowed;
332338

333339
// Adds columns to Windows File Manager.
334340
// Show/hide columns in the "More..." context menu on the columns header in Windows Explorer.

Windows/Common/VirtualDrive/Common.Windows.VirtualDrive.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<Compile Remove="IVirtualFolder.cs" />
1414
</ItemGroup>
1515
<ItemGroup>
16-
<PackageReference Include="ITHit.FileSystem.Windows.AppHelper" Version="9.0.29552.0" />
17-
<PackageReference Include="ITHit.FileSystem.Windows" Version="9.0.29552.0" />
16+
<PackageReference Include="ITHit.FileSystem.Windows.AppHelper" Version="9.1.29632.0" />
17+
<PackageReference Include="ITHit.FileSystem.Windows" Version="9.1.29632.0" />
1818
<ProjectReference Include="..\..\..\Common\Common.csproj" />
1919
<ProjectReference Include="..\Core\Common.Windows.Core.csproj" />
2020
</ItemGroup>

Windows/Common/VirtualDrive/CustomDataExtensions.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static bool TryGetCurrentUserLockToken(this ICustomData properties, out s
6666
{
6767
if (properties.TryGetActiveLockInfo(out ServerLockInfo lockInfo))
6868
{
69-
if (properties.GetEngine().IsCurrentUser(lockInfo.Owner))
69+
if (properties.IsLockedByThisDevice(lockInfo))
7070
{
7171
lockToken = lockInfo.LockToken;
7272
return true;
@@ -76,14 +76,27 @@ public static bool TryGetCurrentUserLockToken(this ICustomData properties, out s
7676
return false;
7777
}
7878

79+
/// <summary>
80+
/// Determines whether the item is locked by this device.
81+
/// </summary>
82+
/// <param name="properties">Custom data attached to the item.</param>
83+
/// <param name="lockInfo">Lock info.</param>
84+
public static bool IsLockedByThisDevice(this ICustomData properties, ServerLockInfo lockInfo)
85+
{
86+
return properties.TryGetValue("ThisDeviceLockToken", out IDataItem deviceLockToken) &&
87+
lockInfo.LockToken.Equals(deviceLockToken.GetValue<string>(), StringComparison.InvariantCultureIgnoreCase) ||
88+
properties.GetEngine().IsCurrentUser(lockInfo.Owner);
89+
}
90+
7991
/// <summary>
8092
/// Sets lock info.
8193
/// </summary>
8294
/// <param name="properties">Custom data attached to the item.</param>
8395
/// <param name="serverLockInfo">Lock info.</param>
84-
public static void SetLockInfo(this ICustomData properties, ServerLockInfo serverLockInfo)
96+
public static void SetThisDeviceLockInfo(this ICustomData properties, ServerLockInfo serverLockInfo)
8597
{
8698
properties.AddOrUpdate("LockInfo", serverLockInfo);
99+
properties.AddOrUpdate("ThisDeviceLockToken", serverLockInfo.LockToken);
87100
}
88101

89102
/// <summary>

Windows/Common/VirtualDrive/VirtualEngineBase.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ public override async Task<bool> FilterAsync(SyncDirection direction, OperationT
278278
return true;
279279
}
280280

281+
if (await new AdobeInDesignFilter().FilterAsync(direction, operationType, path, itemType, newPath, operationContext))
282+
{
283+
return true;
284+
}
285+
281286
if (await new PhotoshopFilter().FilterAsync(direction, operationType, path, itemType, newPath, operationContext))
282287
{
283288
return true;

Windows/VirtualDrive/App.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ await registrar.RegisterSyncRootAsync(
171171
engine.AutoLock = settings.AutoLock;
172172
engine.MaxTransferConcurrentRequests = settings.MaxTransferConcurrentRequests.Value;
173173
engine.MaxOperationsConcurrentRequests = settings.MaxOperationsConcurrentRequests.Value;
174+
engine.RefreshExplorerOnFolderNavigation = settings.RefreshExplorerOnFolderNavigation;
174175

175176
// Set the remote storage item ID for the root item. It will be passed to the IEngine.GetFileSystemItemAsync()
176177
// method as a remoteStorageItemId parameter when a root folder is requested.

Windows/VirtualDrive/VirtualDrive.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,12 @@
228228
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.3916" />
229229
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.241114003" />
230230
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
231+
<PackageReference Include="System.Security.Cryptography.Xml" Version="9.0.15" />
231232
</ItemGroup>
232233
<ItemGroup>
233-
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="9.0.29552.0" />
234-
<PackageReference Include="ITHit.FileSystem.Windows.WinUI" Version="9.0.29552.0" />
234+
<PackageReference Include="ITHit.FileSystem.Windows.Explorer" Version="9.1.29632.0" />
235+
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="9.1.29632.0" />
236+
<PackageReference Include="ITHit.FileSystem.Windows.WinUI" Version="9.1.29632.0" />
235237
<ProjectReference Include="..\..\Common\Common.csproj" />
236238
<ProjectReference Include="..\Common\VirtualDrive\Common.Windows.VirtualDrive.csproj" />
237239
</ItemGroup>

Windows/VirtualDrive/VirtualEngine.cs

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
using System.Threading.Tasks;
2-
using System.Threading;
3-
41
using ITHit.FileSystem;
52
using ITHit.FileSystem.Samples.Common.Windows;
3+
using ITHit.FileSystem.Windows.Explorer;
4+
using System;
5+
using System.Collections.Concurrent;
6+
using System.Collections.Generic;
7+
using System.Threading;
8+
using System.Threading.Tasks;
69

710
namespace VirtualDrive
811
{
@@ -50,9 +53,48 @@ public override async Task<IFileSystemItem> GetFileSystemItemAsync(byte[] remote
5053
}
5154
}
5255

56+
private ConcurrentDictionary<string, DateTime> FoldersWithColumns = new ConcurrentDictionary<string, DateTime>();
57+
58+
/// <summary>
59+
/// Updates Windows Explorer columns.
60+
/// This method is called when user navigates to a new folder or listing occures in Windows Explorer.
61+
/// </summary>
62+
/// <param name="sender"></param>
63+
/// <param name="path">Path for which navigation or listing occured.</param>
64+
private void UpdateExplorerColumns(object sender, string path)
65+
{
66+
if (string.IsNullOrWhiteSpace(path))
67+
return;
68+
69+
// Add columns only one time for each folder.
70+
if (!FoldersWithColumns.TryAdd(path, DateTime.UtcNow))
71+
return;
72+
73+
try
74+
{
75+
var allWindows = WindowsExplorer.GetExplorerWindows(path);
76+
77+
foreach (var window in allWindows)
78+
{
79+
if (window.TryAddColumns(new[] { new ColumnListItem("System.FileAttributes") }).IsSuccess &&
80+
window.TrySetViewMode(FolderViewMode.Details).IsSuccess)
81+
{
82+
window.TryRefresh();
83+
}
84+
}
85+
}
86+
catch (Exception ex)
87+
{
88+
Logger?.LogError($"Failed to update Explorer columns for path: {path}", path, null, ex);
89+
}
90+
}
91+
92+
5393
/// <inheritdoc/>
5494
public override async Task StartAsync(bool processModified = true, CancellationToken cancellationToken = default)
5595
{
96+
WindowsExplorer.FolderNavigation += UpdateExplorerColumns;
97+
WindowsExplorer.FolderListing += UpdateExplorerColumns;
5698
await base.StartAsync(processModified, cancellationToken);
5799
await RemoteStorageMonitor.StartAsync();
58100
}
@@ -62,6 +104,8 @@ public override async Task StopAsync()
62104
{
63105
await base.StopAsync();
64106
await RemoteStorageMonitor.StopAsync();
107+
WindowsExplorer.FolderNavigation -= UpdateExplorerColumns;
108+
WindowsExplorer.FolderListing -= UpdateExplorerColumns;
65109
}
66110

67111
private bool disposedValue;

0 commit comments

Comments
 (0)