Skip to content

Commit

Permalink
v5.6.16415.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ITHitBuild committed Jul 9, 2022
1 parent 0329171 commit abf8f9d
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem" Version="5.6.16382.0" />
<PackageReference Include="ITHit.FileSystem" Version="5.6.16415.0" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions Windows/Common/Core/Common.Windows.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="5.6.16382.0" />
<PackageReference Include="ITHit.FileSystem.Windows" Version="5.6.16382.0" />
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="5.6.16415.0" />
<PackageReference Include="ITHit.FileSystem.Windows" Version="5.6.16415.0" />
<ProjectReference Include="..\..\..\Common\Common.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem.Windows" Version="5.6.16382.0" />
<PackageReference Include="ITHit.FileSystem.Windows" Version="5.6.16415.0" />
<ProjectReference Include="..\..\..\Common\Common.csproj" />
<ProjectReference Include="..\Core\Common.Windows.Core.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="5.6.16382.0" />
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="5.6.16415.0" />
</ItemGroup>
<ItemGroup>
<None Update="log4net.config">
Expand Down
4 changes: 2 additions & 2 deletions Windows/VirtualDrive/VirtualDrive/VirtualDrive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ This is an advanced project with ETags support, Microsoft Office documents editi
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="5.6.16382.0" />
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="5.6.16382.0" />
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="5.6.16415.0" />
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="5.6.16415.0" />
<ProjectReference Include="..\..\..\Common\Common.csproj" />
<ProjectReference Include="..\..\Common\VirtualDrive\Common.Windows.VirtualDrive.csproj" />
<ProjectReference Include="..\VirtualDrive.ShellExtension\VirtualDrive.ShellExtension.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Copyright>IT HIT LTD.</Copyright>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="5.6.16382.0" />
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="5.6.16415.0" />
</ItemGroup>
<ItemGroup>
<None Update="log4net.config">
Expand Down
2 changes: 1 addition & 1 deletion Windows/WebDAVDrive/WebDAVDrive.UI/WebDAVDrive.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageReference Include="ITHitWebDAVClient" Version="5.3.3490" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem.Windows" Version="5.6.16382.0" />
<PackageReference Include="ITHit.FileSystem.Windows" Version="5.6.16415.0" />
<ProjectReference Include="..\..\..\Common\Common.csproj" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Windows/WebDAVDrive/WebDAVDrive/RemoteStorageMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private async Task CreatedAsync(string remoteStoragePath)
// Because of the on-demand population the file or folder placeholder may not exist in the user file system.
// We do not want to send extra requests to the remote storage if the parent folder is offline.
if (Directory.Exists(userFileSystemParentPath)
&& !new DirectoryInfo(userFileSystemParentPath).Attributes.HasFlag(System.IO.FileAttributes.Offline)
&& !new DirectoryInfo(userFileSystemParentPath).Attributes.HasFlag(FileAttributes.Offline)
&& !FsPath.Exists(userFileSystemPath))
{
IHierarchyItem remoteStorageItem = await Program.DavClient.GetItemAsync(new Uri(remoteStoragePath));
Expand Down
50 changes: 29 additions & 21 deletions Windows/WebDAVDrive/WebDAVDrive/VirtualFileSystemItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ public async Task LockAsync(LockMode lockMode, IOperationContext operationContex
// Save the lock token and other lock info received from the remote storage on the client.
// Supply the lock-token as part of each remote storage update in IFile.WriteAsync() method.

LockInfo lockInfo = await Program.DavClient.LockAsync(new Uri(RemoteStoragePath), LockScope.Exclusive, false, null, TimeSpan.MaxValue, cancellationToken);
// Here we set lock owner name to loged-in user for demo purposes.
string lockOwner = Environment.UserName;
LockInfo lockInfo = await Program.DavClient.LockAsync(new Uri(RemoteStoragePath), LockScope.Exclusive, false, lockOwner, TimeSpan.MaxValue, cancellationToken);
ServerLockInfo serverLockInfo = new ServerLockInfo
{
LockToken = lockInfo.LockToken.LockToken,
Expand All @@ -274,11 +276,14 @@ public async Task LockAsync(LockMode lockMode, IOperationContext operationContex
};

// Save lock-token and lock-mode.
PlaceholderItem placeholder = Engine.Placeholders.GetItem(UserFileSystemPath);
await placeholder.Properties.AddOrUpdateAsync("LockInfo", serverLockInfo);
await placeholder.Properties.AddOrUpdateAsync("LockMode", lockMode);
if (Engine.Placeholders.TryGetItem(UserFileSystemPath, out PlaceholderItem placeholder))
{
await placeholder.Properties.AddOrUpdateAsync("LockInfo", serverLockInfo);
await placeholder.Properties.AddOrUpdateAsync("LockMode", lockMode);
placeholder.UpdateUI();

Logger.LogDebug("Locked in the remote storage successfully", UserFileSystemPath, default, operationContext);
Logger.LogDebug("Locked in the remote storage successfully", UserFileSystemPath, default, operationContext);
}
}


Expand Down Expand Up @@ -308,25 +313,28 @@ public async Task UnlockAsync(IOperationContext operationContext = null, Cancell
Logger.LogMessage($"{nameof(ILock)}.{nameof(UnlockAsync)}()", UserFileSystemPath, default, operationContext);

// Read the lock-token.
PlaceholderItem placeholder = Engine.Placeholders.GetItem(UserFileSystemPath);
string lockToken = (await placeholder.Properties["LockInfo"].GetValueAsync<ServerLockInfo>())?.LockToken;
if (Engine.Placeholders.TryGetItem(UserFileSystemPath, out PlaceholderItem placeholder))
{
string lockToken = (await placeholder.Properties["LockInfo"].GetValueAsync<ServerLockInfo>())?.LockToken;

LockUriTokenPair[] lockTokens = new LockUriTokenPair[] { new LockUriTokenPair(new Uri(RemoteStoragePath), lockToken)};
LockUriTokenPair[] lockTokens = new LockUriTokenPair[] { new LockUriTokenPair(new Uri(RemoteStoragePath), lockToken) };

// Unlock the item in the remote storage.
try
{
await Program.DavClient.UnlockAsync(new Uri(RemoteStoragePath), lockTokens, cancellationToken);
Logger.LogDebug("Unlocked in the remote storage successfully", UserFileSystemPath, default, operationContext);
}
catch (ITHit.WebDAV.Client.Exceptions.ConflictException)
{
Logger.LogDebug("The item is already unlocked.", UserFileSystemPath, default, operationContext);
}
// Unlock the item in the remote storage.
try
{
await Program.DavClient.UnlockAsync(new Uri(RemoteStoragePath), lockTokens, cancellationToken);
Logger.LogDebug("Unlocked in the remote storage successfully", UserFileSystemPath, default, operationContext);
}
catch (ITHit.WebDAV.Client.Exceptions.ConflictException)
{
Logger.LogDebug("The item is already unlocked.", UserFileSystemPath, default, operationContext);
}

// Delete lock-mode and lock-token info.
placeholder.Properties.Remove("LockInfo");
placeholder.Properties.Remove("LockMode");
// Delete lock-mode and lock-token info.
placeholder.Properties.Remove("LockInfo");
placeholder.Properties.Remove("LockMode");
placeholder.UpdateUI();
}
}

}
Expand Down
2 changes: 1 addition & 1 deletion Windows/WebDAVDrive/WebDAVDrive/VirtualFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public async Task<byte[]> CreateFolderAsync(IFolderMetadata folderMetadata, IInS
Uri newFolderUri = new Uri(new Uri(RemoteStoragePath), folderMetadata.Name);
await Program.DavClient.CreateFolderAsync(newFolderUri, null, cancellationToken);

// WebDAV server sypically does not provide eTags for folders.
// WebDAV server typically does not provide eTags for folders.
// Store ETag (if any) unlil the next update here.
//PlaceholderItem placeholder = Engine.Placeholders.GetItem(userFileSystemNewItemPath);
//await placeholder.Properties.AddOrUpdateAsync("ETag", eTag);
Expand Down
4 changes: 2 additions & 2 deletions Windows/WebDAVDrive/WebDAVDrive/WebDAVDrive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="5.6.16382.0" />
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="5.6.16382.0" />
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="5.6.16415.0" />
<PackageReference Include="ITHit.FileSystem.Windows.ShellExtension" Version="5.6.16415.0" />
<ProjectReference Include="..\..\Common\VirtualDrive\Common.Windows.VirtualDrive.csproj" />
<ProjectReference Include="..\WebDAVDrive.ShellExtension\WebDAVDrive.ShellExtension.csproj" />
<ProjectReference Include="..\WebDAVDrive.UI\WebDAVDrive.UI.csproj" />
Expand Down

0 comments on commit abf8f9d

Please sign in to comment.