Skip to content

Commit 5958ef8

Browse files
committed
v7.1.23457.0-Beta
1 parent 715f084 commit 5958ef8

File tree

12 files changed

+57
-36
lines changed

12 files changed

+57
-36
lines changed

Common/Common.csproj

Lines changed: 2 additions & 2 deletions
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="7.1.23321.0-Beta" />
14-
<PackageReference Include="ITHit.FileSystem" Version="7.1.23321.0-Beta" />
13+
<PackageReference Include="ITHit.FileSystem.Windows" Version="7.1.23457.0-Beta" />
14+
<PackageReference Include="ITHit.FileSystem" Version="7.1.23457.0-Beta" />
1515
</ItemGroup>
1616
</Project>

Common/FileSystemItemMetadataExt.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Collections.Generic;
55
using System.IO;
66
using System.Text;
7+
using System.Threading.Tasks;
78

89
namespace ITHit.FileSystem.Samples.Common
910
{
@@ -53,9 +54,13 @@ public class FileSystemItemMetadataExt : IFileSystemItemMetadata, IChangedItem
5354
/// </summary>
5455
public IEnumerable<FileSystemItemPropertyData> CustomProperties { get; set; } = new FileSystemItemPropertyData[] { };
5556

56-
/// <summary>
57-
/// Type of change.
58-
/// </summary>
57+
///<inheritdoc/>
5958
public Change ChangeType { get; set; }
59+
60+
///<inheritdoc/>
61+
public Func<Task> BeforeAction { get; set; }
62+
63+
///<inheritdoc/>
64+
public Func<Task> AfterAction { get; set; }
6065
}
6166
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
2121
</ItemGroup>
2222
<ItemGroup>
23-
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="7.1.23321.0-Beta" />
24-
<PackageReference Include="ITHit.FileSystem.Windows" Version="7.1.23321.0-Beta" />
23+
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="7.1.23457.0-Beta" />
24+
<PackageReference Include="ITHit.FileSystem.Windows" Version="7.1.23457.0-Beta" />
2525
<ProjectReference Include="..\..\..\Common\Common.csproj" />
2626
</ItemGroup>
2727
</Project>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<Compile Remove="IVirtualFolder.cs" />
1414
</ItemGroup>
1515
<ItemGroup>
16-
<PackageReference Include="ITHit.FileSystem.Windows" Version="7.1.23321.0-Beta" />
16+
<PackageReference Include="ITHit.FileSystem.Windows" Version="7.1.23457.0-Beta" />
1717
<ProjectReference Include="..\..\..\Common\Common.csproj" />
1818
<ProjectReference Include="..\Core\Common.Windows.Core.csproj" />
1919
</ItemGroup>

Windows/Common/VirtualDrive/PlaceholderItemExtensions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static async Task<bool> IsModifiedAsync(this PlaceholderItem placeholder,
3535
/// as well as any additional custom data required by the client.
3636
/// </summary>
3737
/// <param name="placeholder">User file system placeholder item.</param>
38-
/// <param name="remoteStorageItem">Remote storage item metadata.</param>
38+
/// <param name="metadata">Remote storage item metadata.</param>
3939
/// <returns>A task object that can be awaited.</returns>
4040
public static async Task SavePropertiesAsync(this PlaceholderItem placeholder, FileSystemItemMetadataExt metadata)
4141
{
@@ -50,7 +50,8 @@ public static async Task SavePropertiesAsync(this PlaceholderItem placeholder, F
5050
}
5151

5252
// Save eTag.
53-
if (metadata.ETag != null)
53+
// Update eTag only for offline files. For online files eTag is updated in IFile.ReadAsync.
54+
if (metadata.ETag != null && System.IO.File.GetAttributes(placeholder.Path).HasFlag(System.IO.FileAttributes.Offline))
5455
{
5556
placeholder.SetETag(metadata.ETag);
5657
}

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

Lines changed: 1 addition & 1 deletion
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="7.1.23321.0-Beta" />
22+
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="7.1.23457.0-Beta" />
2323
</ItemGroup>
2424
<ItemGroup>
2525
<None Update="log4net.config">

Windows/VirtualDrive/VirtualDrive/VirtualDrive.csproj

Lines changed: 1 addition & 1 deletion
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="7.1.23321.0-Beta" />
43+
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="7.1.23457.0-Beta" />
4444
<ProjectReference Include="..\..\..\Common\Common.csproj" />
4545
<ProjectReference Include="..\..\Common\VirtualDrive\Common.Windows.VirtualDrive.csproj" />
4646
</ItemGroup>

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

Lines changed: 1 addition & 1 deletion
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="7.1.23321.0-Beta" />
15+
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="7.1.23457.0-Beta" />
1616
</ItemGroup>
1717
<ItemGroup>
1818
<None Update="log4net.config">

Windows/WebDAVDrive/WebDAVDrive/RemoteStorageMonitor.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,22 @@ public override bool Filter(WebSocketMessage webSocketMessage)
4040
Logger.LogDebug($"EventType: {webSocketMessage.EventType}", webSocketMessage.ItemPath, webSocketMessage.TargetPath);
4141

4242
string userFileSystemPath = Mapping.ReverseMapPath(remoteStoragePath);
43+
string userFileSystemParentPath = Path.GetDirectoryName(userFileSystemPath);
4344
switch (webSocketMessage.EventType)
4445
{
4546
case "created":
47+
// Verify that parent folder exists and is not offline.
48+
49+
return !((Directory.Exists(userFileSystemParentPath) && !new DirectoryInfo(userFileSystemParentPath).Attributes.HasFlag(FileAttributes.Offline)) ||
50+
engine.Placeholders.IsPinned(userFileSystemParentPath));
4651
case "deleted":
4752
// Verify that parent folder exists and is not offline.
48-
string userFileSystemParentPath = Path.GetDirectoryName(userFileSystemPath);
4953
return !Directory.Exists(userFileSystemParentPath)
5054
|| new DirectoryInfo(userFileSystemParentPath).Attributes.HasFlag(FileAttributes.Offline);
5155

5256
case "moved":
5357
// Verify that source exists OR target folder exists and is not offline.
58+
// TODO: incorrect condition
5459
if (File.Exists(userFileSystemPath))
5560
{
5661
return false;
@@ -61,7 +66,7 @@ public override bool Filter(WebSocketMessage webSocketMessage)
6166
string userFileSystemNewPath = Mapping.ReverseMapPath(remoteStorageNewPath);
6267
string userFileSystemNewParentPath = Path.GetDirectoryName(userFileSystemNewPath);
6368
return !Directory.Exists(userFileSystemNewParentPath)
64-
|| new DirectoryInfo(userFileSystemNewParentPath).Attributes.HasFlag(FileAttributes.Offline);
69+
|| (new DirectoryInfo(userFileSystemNewParentPath).Attributes.HasFlag(FileAttributes.Offline) && (((int)new DirectoryInfo(userFileSystemNewParentPath).Attributes & (int)FileAttributesExt.Pinned) == 0));
6570
}
6671

6772
case "updated":
@@ -73,13 +78,5 @@ public override bool Filter(WebSocketMessage webSocketMessage)
7378

7479
return true;
7580
}
76-
77-
public override async Task SavePropertiesAsync(IFileSystemItemMetadata metadata, string userFileSystemPath)
78-
{
79-
if (engine.Placeholders.TryGetItem(userFileSystemPath, out PlaceholderItem placeholderItem))
80-
{
81-
await placeholderItem.SavePropertiesAsync(metadata as ITHit.FileSystem.Samples.Common.FileSystemItemMetadataExt);
82-
}
83-
}
8481
}
8582
}

Windows/WebDAVDrive/WebDAVDrive/RemoteStorageMonitorBase.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ internal RemoteStorageMonitorBase(string webSocketServerUrl, ILogger logger)
100100
this.webSocketServerUrl = webSocketServerUrl;
101101
}
102102

103-
/// <summary>
104-
/// Called to save item properties.
105-
/// </summary>
106-
public abstract Task SavePropertiesAsync(IFileSystemItemMetadata metadata, string userFileSystemPath);
107-
108103
/// <summary>
109104
/// Verifies that the WebSockets message is for the item that exists
110105
/// in the user file system and should be updated.
@@ -252,7 +247,7 @@ private async Task ProcessAsync()
252247
{
253248
try
254249
{
255-
await ServerNotifications.ProcessChangesAsync(SavePropertiesAsync);
250+
await ServerNotifications.ProcessChangesAsync();
256251
}
257252
catch (Exception ex)
258253
{

0 commit comments

Comments
 (0)