Skip to content

Commit deb13fb

Browse files
committed
v8.1.26901.0
1 parent f771db5 commit deb13fb

Some content is hidden

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

55 files changed

+279
-124
lines changed

Common/Common.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<Platforms>AnyCPU;x64</Platforms>
1111
</PropertyGroup>
1212
<ItemGroup>
13-
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.1.26791.0-Beta2" />
14-
<PackageReference Include="ITHit.FileSystem" Version="8.1.26791.0-Beta2" />
13+
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.1.26901.0" />
14+
<PackageReference Include="ITHit.FileSystem" Version="8.1.26901.0" />
1515
</ItemGroup>
1616
</Project>

Common/CustomColumnIds.cs

+5
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,10 @@ public enum CustomColumnIds
3434
/// Metadata ETag column ID.
3535
/// </summary>
3636
MetadataETag = 7,
37+
38+
/// <summary>
39+
/// Remote storage item ID.
40+
/// </summary>
41+
Id = 8
3742
}
3843
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
2222
</ItemGroup>
2323
<ItemGroup>
24-
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="8.1.26791.0-Beta2" />
25-
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.1.26791.0-Beta2" />
24+
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="8.1.26901.0" />
25+
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.1.26901.0" />
2626
<ProjectReference Include="..\..\..\Common\Common.csproj" />
2727
</ItemGroup>
2828
</Project>

Windows/Common/Core/FsPath.cs

+18
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@ public static bool IsFolder(string path)
2626
return (attributes & FileAttributes.Directory) == FileAttributes.Directory;
2727
}
2828

29+
/// <summary>
30+
/// Tries to determine if the provided path points to the file or folder.
31+
/// </summary>
32+
/// <param name="path">Path to the file or folder.</param>
33+
/// <param name="isFolder">True if the path is folder. False - otherwise.</param>
34+
/// <returns>True if this method successeds. False - otherwise.</returns>
35+
public static bool TryIsFolder(string path, out bool isFolder)
36+
{
37+
if (WindowsFileSystemItem.TryGetAttributes(path, out FileAttributes? attributes))
38+
{
39+
isFolder = (attributes & FileAttributes.Directory) == FileAttributes.Directory;
40+
return true;
41+
}
42+
43+
isFolder = false;
44+
return false;
45+
}
46+
2947
/// <summary>
3048
/// Returns true if a file or folder exists under the specified path. False - otherwise.
3149
/// </summary>

Windows/Common/Core/LogFormatter.cs

+26
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using ITHit.FileSystem.Windows;
1414
using ITHit.FileSystem.Windows.Package;
1515
using Windows.Storage.Search;
16+
using System.Text;
1617

1718
namespace ITHit.FileSystem.Samples.Common.Windows
1819
{
@@ -314,6 +315,31 @@ public static string FormatBytes(long length)
314315
double num = Math.Round(bytes / Math.Pow(1024, place), 1);
315316
return (Math.Sign(length) * num).ToString() + suf[place];
316317
}
318+
319+
public static string IdToSting(byte[] remoteStorageItemId)
320+
{
321+
if (remoteStorageItemId == null)
322+
return null;
323+
324+
switch(remoteStorageItemId.Length)
325+
{
326+
case 8:
327+
return BitConverter.ToInt64(remoteStorageItemId, 0).ToString();
328+
case 16:
329+
return new Guid(remoteStorageItemId).ToString();
330+
default:
331+
// Try parse URI
332+
string uriStrId = Encoding.UTF8.GetString(remoteStorageItemId);
333+
if (Uri.TryCreate(uriStrId, UriKind.RelativeOrAbsolute, out Uri uriId))
334+
{
335+
return uriId.Segments.Last();
336+
}
337+
else
338+
{
339+
return uriStrId;
340+
}
341+
}
342+
}
317343
}
318344

319345
static class StringExtensions

Windows/Common/Core/Registrar.cs

+1
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ private static async Task<StorageProviderSyncRootInfo> RegisterAsync(string sync
330330
proDefinitions.Add(new StorageProviderItemPropertyDefinition { DisplayNameResource = "Lock Expires" , Id = (int)CustomColumnIds.LockExpirationDate });
331331
proDefinitions.Add(new StorageProviderItemPropertyDefinition { DisplayNameResource = "Content ETag" , Id = (int)CustomColumnIds.ContentETag });
332332
proDefinitions.Add(new StorageProviderItemPropertyDefinition { DisplayNameResource = "Metadata ETag", Id = (int)CustomColumnIds.MetadataETag });
333+
proDefinitions.Add(new StorageProviderItemPropertyDefinition { DisplayNameResource = "ID" , Id = (int)CustomColumnIds.Id });
333334

334335

335336
ValidateStorageProviderSyncRootInfo(storageInfo);

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

+2-2
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="8.1.26791.0-Beta2" />
17-
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.1.26791.0-Beta2" />
16+
<PackageReference Include="ITHit.FileSystem.Windows.AppHelper" Version="8.1.26901.0" />
17+
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.1.26901.0" />
1818
<ProjectReference Include="..\..\..\Common\Common.csproj" />
1919
<ProjectReference Include="..\Core\Common.Windows.Core.csproj" />
2020
</ItemGroup>

Windows/Common/VirtualDrive/VirtualEngineBase.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ private void Engine_ItemsChanged(Engine sender, ItemsChangeEventArgs e)
9292
{
9393
foreach (ChangeEventItem item in e.Items)
9494
{
95-
// Save custom properties received from the remote storage here
96-
// they will be displayed in Windows Explorer columns.
95+
// Save custom properties received from the remote storage here.
96+
// They will be displayed in Windows Explorer columns.
9797
if (e.Direction == SyncDirection.Incoming && e.Result.IsSuccess)
9898
{
9999
switch (e.OperationType)

Windows/VirtualDrive/VirtualDrive.ShellExtension/Program.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ static async Task Main(string[] args)
1212
{
1313
try
1414
{
15-
using (var server = new LocalServer())
15+
using (var server = new LocalServerRpc())
1616
{
1717
server.RegisterClass<ThumbnailProviderRpc>();
1818
server.RegisterClass<ContextMenuVerbRpc>();
1919
server.RegisterClass<StorageProviderCopyHookRpc>();
2020
server.RegisterWinRTClass<IStorageProviderItemPropertySource, CustomStateProviderRpc>();
2121
server.RegisterWinRTClass<IStorageProviderUriSource, UriSourceRpc>();
2222

23-
await server.Run();
23+
await server.RunAsync();
2424
}
2525
}
2626
catch (Exception ex)

Windows/VirtualDrive/VirtualDrive.ShellExtension/VirtualDrive.ShellExtension.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
2020
</ItemGroup>
2121
<ItemGroup>
22-
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="8.1.26791.0-Beta2" />
22+
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="8.1.26901.0" />
2323
</ItemGroup>
2424
<ItemGroup>
2525
<None Update="log4net.config">

Windows/VirtualDrive/VirtualDrive/RemoteStorageMonitor.cs

+12-13
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ private async void ChangedAsync(object sender, FileSystemEventArgs e)
132132

133133
// This check is only required because we can not prevent circular calls because of the simplicity of this example.
134134
// In your real-life application you will not send updates from server back to client that issued the update.
135-
if (FsPath.Exists(userFileSystemPath)
136-
&& IsModified(userFileSystemPath, remoteStoragePath))
135+
if (IsModified(userFileSystemPath, remoteStoragePath))
137136
{
138137
FileSystemInfo remoteStorageItem = FsPath.GetFileSystemItem(remoteStoragePath);
139138
if (remoteStorageItem != null)
@@ -226,26 +225,26 @@ public void Dispose()
226225
/// <returns>True if file is modified. False - otherwise.</returns>
227226
internal static bool IsModified(string userFileSystemPath, string remoteStoragePath)
228227
{
229-
if (FsPath.IsFolder(userFileSystemPath) && FsPath.IsFolder(remoteStoragePath))
230-
{
231-
return false;
232-
}
233-
234-
FileInfo fiUserFileSystem = new FileInfo(userFileSystemPath);
235-
FileInfo fiRemoteStorage = new FileInfo(remoteStoragePath);
236-
237-
// This check is to prevent circular calls. In you real app you wouuld not send notifications to the client that generated the event.
238-
if (fiUserFileSystem.LastWriteTimeUtc >= fiRemoteStorage.LastWriteTimeUtc)
228+
if (!FsPath.TryIsFolder(userFileSystemPath, out bool isFolder1) || isFolder1 || !FsPath.TryIsFolder(remoteStoragePath, out bool isFolder2) || isFolder2)
239229
{
240230
return false;
241231
}
242232

243233
try
244234
{
235+
FileInfo fiUserFileSystem = new FileInfo(userFileSystemPath);
236+
FileInfo fiRemoteStorage = new FileInfo(remoteStoragePath);
237+
238+
// This check is to prevent circular calls. In your real app you would not send notifications to the client that generated the event.
239+
if (fiUserFileSystem.LastWriteTimeUtc >= fiRemoteStorage.LastWriteTimeUtc)
240+
{
241+
return false;
242+
}
243+
245244
if (fiUserFileSystem.Length == fiRemoteStorage.Length)
246245
{
247246
// Verify that the file is not offline,
248-
// therwise the file will be hydrated when the file stream is opened.
247+
// otherwise the file will be hydrated when the file stream is opened.
249248
if (fiUserFileSystem.Attributes.HasFlag(System.IO.FileAttributes.Offline)
250249
|| fiUserFileSystem.Attributes.HasFlag(System.IO.FileAttributes.Offline))
251250
{

Windows/VirtualDrive/VirtualDrive/ShellExtension/ShellExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ internal static LocalServer StartComServer(bool shellExtensionsComServerRpcEnabl
4646
return null;
4747
}
4848

49-
LocalServer server = new LocalServer();
49+
LocalServer server = new LocalServerIntegrarted();
5050

5151
server.RegisterClass<ThumbnailProviderIntegrated>();
5252
server.RegisterClass<ContextMenuVerbIntegrated>();

Windows/VirtualDrive/VirtualDrive/VirtualDrive.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This is an advanced project with ETags support, Microsoft Office documents editi
4040
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
4141
</ItemGroup>
4242
<ItemGroup>
43-
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="8.1.26791.0-Beta2" />
43+
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="8.1.26901.0" />
4444
<ProjectReference Include="..\..\..\Common\Common.csproj" />
4545
<ProjectReference Include="..\..\Common\VirtualDrive\Common.Windows.VirtualDrive.csproj" />
4646
</ItemGroup>
Binary file not shown.

Windows/VirtualDrive/VirtualDrive/VirtualFile.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public async Task CloseCompletionAsync(IOperationContext operationContext, IResu
4242
}
4343

4444
/// <inheritdoc/>
45-
public async Task<IFileMetadata> ReadAsync(Stream output, long offset, long length, ITransferDataOperationContext operationContext, ITransferDataResultContext resultContext, CancellationToken cancellationToken)
45+
public async Task<IFileMetadata> ReadAsync(Stream output, long offset, long length, IFileMetadata metadata, ITransferDataOperationContext operationContext, ITransferDataResultContext resultContext, CancellationToken cancellationToken)
4646
{
4747
// On Windows this method has a 60 sec timeout.
4848
// To process longer requests and reset the timout timer write to the output stream or call the resultContext.ReportProgress() or resultContext.ReturnData() methods.

Windows/VirtualFileSystem/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ await registrar.RegisterSyncRootAsync(
8989
commands.RemoteStorageMonitor = Engine.RemoteStorageMonitor;
9090
consoleProcessor.Commands.TryAdd(Guid.Empty, commands);
9191

92-
// Here we disable incoming sync. To get changes using pooling call IncomingPooling.ProcessAsync()
92+
// Here we disable incoming sync. To get changes from your remote storage using pooling, call the IncomingPooling.ProcessAsync() method.
9393
Engine.SyncService.IncomingSyncMode = ITHit.FileSystem.Synchronization.IncomingSyncMode.Disabled;
9494

9595
// Set the remote storage item ID for the root item. It will be passed to the IEngine.GetFileSystemItemAsync()

Windows/VirtualFileSystem/RemoteStorageMonitor.cs

+11-12
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ private async void ChangedAsync(object sender, FileSystemEventArgs e)
132132

133133
// This check is only required because we can not prevent circular calls because of the simplicity of this example.
134134
// In your real-life application you will not send updates from server back to client that issued the update.
135-
if (FsPath.Exists(userFileSystemPath)
136-
&& IsModified(userFileSystemPath, remoteStoragePath))
135+
if (IsModified(userFileSystemPath, remoteStoragePath))
137136
{
138137
FileSystemInfo remoteStorageItem = FsPath.GetFileSystemItem(remoteStoragePath);
139138
if (remoteStorageItem != null)
@@ -226,22 +225,22 @@ public void Dispose()
226225
/// <returns>True if file is modified. False - otherwise.</returns>
227226
internal static bool IsModified(string userFileSystemPath, string remoteStoragePath)
228227
{
229-
if (FsPath.IsFolder(userFileSystemPath) && FsPath.IsFolder(remoteStoragePath))
230-
{
231-
return false;
232-
}
233-
234-
FileInfo fiUserFileSystem = new FileInfo(userFileSystemPath);
235-
FileInfo fiRemoteStorage = new FileInfo(remoteStoragePath);
236-
237-
// This check is to prevent circular calls. In your real app you would not send notifications to the client that generated the event.
238-
if (fiUserFileSystem.LastWriteTimeUtc >= fiRemoteStorage.LastWriteTimeUtc)
228+
if (!FsPath.TryIsFolder(userFileSystemPath, out bool isFolder1) || isFolder1 || !FsPath.TryIsFolder(remoteStoragePath, out bool isFolder2) || isFolder2)
239229
{
240230
return false;
241231
}
242232

243233
try
244234
{
235+
FileInfo fiUserFileSystem = new FileInfo(userFileSystemPath);
236+
FileInfo fiRemoteStorage = new FileInfo(remoteStoragePath);
237+
238+
// This check is to prevent circular calls. In your real app you would not send notifications to the client that generated the event.
239+
if (fiUserFileSystem.LastWriteTimeUtc >= fiRemoteStorage.LastWriteTimeUtc)
240+
{
241+
return false;
242+
}
243+
245244
if (fiUserFileSystem.Length == fiRemoteStorage.Length)
246245
{
247246
// Verify that the file is not offline,

Windows/VirtualFileSystem/VirtualFile.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public async Task CloseCompletionAsync(IOperationContext operationContext, IResu
4343

4444

4545
/// <inheritdoc/>
46-
public async Task<IFileMetadata> ReadAsync(Stream output, long offset, long length, ITransferDataOperationContext operationContext, ITransferDataResultContext resultContext, CancellationToken cancellationToken)
46+
public async Task<IFileMetadata> ReadAsync(Stream output, long offset, long length, IFileMetadata metadata, ITransferDataOperationContext operationContext, ITransferDataResultContext resultContext, CancellationToken cancellationToken)
4747
{
4848
// On Windows this method has a 60 sec timeout.
4949
// To process longer requests and reset the timout timer write to the output stream or call the resultContext.ReportProgress() or resultContext.ReturnData() methods.

Windows/VirtualFileSystem/VirtualFileSystem.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ This project does not support ETags, locking, Microsoft Office documents editing
3535
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.7" />
3636
</ItemGroup>
3737
<ItemGroup>
38-
<PackageReference Include="ITHit.FileSystem.Windows.AppHelper" Version="8.1.26791.0-Beta2" />
38+
<PackageReference Include="ITHit.FileSystem.Windows.AppHelper" Version="8.1.26901.0" />
3939
<ProjectReference Include="..\Common\Core\Common.Windows.Core.csproj" />
4040
</ItemGroup>
4141
<ItemGroup>

Windows/WebDAVDrive/WebDAVDrive.ShellExtension/Program.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ static async Task Main(string[] args)
1212
{
1313
try
1414
{
15-
using (var server = new LocalServer())
15+
using (var server = new LocalServerRpc())
1616
{
1717
server.RegisterClass<ThumbnailProviderRpc>();
1818
server.RegisterClass<ContextMenuVerbRpc>();
1919
server.RegisterWinRTClass<IStorageProviderItemPropertySource, CustomStateProviderRpc>();
2020

21-
await server.Run();
21+
await server.RunAsync();
2222
}
2323
}
2424
catch (Exception ex)

Windows/WebDAVDrive/WebDAVDrive.ShellExtension/WebDAVDrive.ShellExtension.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Copyright>IT HIT LTD.</Copyright>
1313
</PropertyGroup>
1414
<ItemGroup>
15-
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="8.1.26791.0-Beta2" />
15+
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="8.1.26901.0" />
1616
</ItemGroup>
1717
<ItemGroup>
1818
<None Update="log4net.config">

Windows/WebDAVDrive/WebDAVDrive.UI/TrayUI.cs

+11-15
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,25 @@ public static void RemoveTray(Guid instanceId)
6363

6464
public async Task StartAsync(CancellationToken cancellationToken = default)
6565
{
66-
await Task.Run(async () => { await StartUIAsync(cancellationToken); }, cancellationToken);
66+
Task.Run(() => { StartProcessingTraysQueue(cancellationToken); }, cancellationToken);
6767
}
6868

69-
private static async Task StartUIAsync(CancellationToken cancellationToken)
70-
{
71-
// Run task to cteate trays.
72-
Task.Run(async () => { await StartProcessingTraysQueueAsync(cancellationToken); }, cancellationToken);
73-
74-
Application.Run();
75-
}
76-
77-
private static async Task StartProcessingTraysQueueAsync(CancellationToken cancellationToken)
69+
private static void StartProcessingTraysQueue(CancellationToken cancellationToken)
7870
{
7971
while (!cancellationToken.IsCancellationRequested)
8072
{
8173
TrayData trayData = newTraysData.Take(cancellationToken); // Blocks if the queue is empty.
74+
Task.Run(() =>
75+
{
76+
WindowsTrayInterface windowsTrayInterface = new WindowsTrayInterface(trayData.ProductName, trayData.WebDavServerPath, trayData.IconsFolderPath, trayData.Commands);
77+
trays.TryAdd(trayData.InstanceId, windowsTrayInterface);
8278

83-
WindowsTrayInterface windowsTrayInterface = new WindowsTrayInterface(trayData.ProductName, trayData.WebDavServerPath, trayData.IconsFolderPath, trayData.Commands);
84-
// Listen to engine notifications to change menu and icon states.
85-
trayData.Engine.StateChanged += windowsTrayInterface.Engine_StateChanged;
86-
trayData.Engine.SyncService.StateChanged += windowsTrayInterface.SyncService_StateChanged;
79+
// Listen to engine notifications to change menu and icon states.
80+
trayData.Engine.StateChanged += windowsTrayInterface.Engine_StateChanged;
81+
trayData.Engine.SyncService.StateChanged += windowsTrayInterface.SyncService_StateChanged;
8782

88-
trays.TryAdd(trayData.InstanceId, windowsTrayInterface);
83+
Application.Run();
84+
});
8985
}
9086

9187
// Clear the queue.

Windows/WebDAVDrive/WebDAVDrive.UI/WebDAVDrive.UI.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<ItemGroup>
1919
<PackageReference Include="log4net" Version="2.0.15" />
2020
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2210.55" />
21-
<PackageReference Include="ITHitWebDAVClient" Version="7.1.4970" />
21+
<PackageReference Include="ITHitWebDAVClient" Version="7.1.5036" />
2222
</ItemGroup>
2323

2424
<ItemGroup>

0 commit comments

Comments
 (0)