Skip to content

Commit b81929b

Browse files
committed
v3.1.7115.0-Beta
1 parent 9c7ec78 commit b81929b

29 files changed

+93
-90
lines changed

Common/Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
<Description>Contains functionality common for all Virtual Drive samples, both for Windows and macOS.</Description>
99
</PropertyGroup>
1010
<ItemGroup>
11-
<PackageReference Include="ITHit.FileSystem" Version="3.0.7021.0-Beta" />
11+
<PackageReference Include="ITHit.FileSystem" Version="3.1.7115.0-Beta" />
1212
</ItemGroup>
1313
</Project>

Common/FileSystemItemMetadataExt.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ namespace ITHit.FileSystem.Samples.Common
1212
/// </summary>
1313
public class FileSystemItemMetadataExt : IFileSystemItemMetadata
1414
{
15+
/// <inheritdoc/>
16+
public string ItemId { get; set; }
17+
1518
///<inheritdoc/>
1619
public string Name { get; set; }
1720

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This sample implements a virtual file system for Mac with synchronization suppor
3131

3232
<a href="https://github.com/ITHit/UserFileSystemSamples/tree/master/Windows/VirtualDrive/">
3333
<p>
34-
This is a virtual drive implementation with Microsoft Office documents editing support and automatic Microsoft Office documents locking. It also demonstrates custom column support in Windows File Manager.&nbsp;To simulate the remote storage, this sample i <span>...</span>
34+
This is a virtual drive implementation with thumbnail support, Microsoft Office documents editing support, and automatic Microsoft Office documents locking. It also demonstrates custom column support in Windows File Manager.&nbsp;To simulate the remote st <span>...</span>
3535
</p>
3636
</a>
3737
</li>

Windows/Common/Common.Windows.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
1313
</ItemGroup>
1414
<ItemGroup>
15-
<PackageReference Include="ITHit.FileSystem.Windows" Version="3.0.7021.0-Beta" />
15+
<PackageReference Include="ITHit.FileSystem.Windows" Version="3.1.7115.0-Beta" />
1616
<ProjectReference Include="..\..\Common\Common.csproj" />
1717
</ItemGroup>
1818
</Project>

Windows/Common/CustomDataManager.cs renamed to Windows/Common/ExternalDataManager.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@
1111
namespace ITHit.FileSystem.Samples.Common.Windows
1212
{
1313
/// <summary>
14-
/// Manages custom data associated with the item.
14+
/// Manages custom data associated with the item stored outside of the item,
15+
/// such as item ID, custom Windows Explorer columns, locks, ETags.
1516
/// </summary>
1617
/// <remarks>
17-
/// We can not store custom data inside placeholder because of the MS Office transactional save,
18-
/// which renames and deletes the file, so all custom data is lost with it.
18+
/// This class stores all custom data associated with the item outside of the placeholder.
19+
/// We can not store item ID and custom data inside placeholder (using <see cref="IFileSystemItemMetadata.CustomData"/>
20+
/// and <see cref="ITHit.FileSystem.Windows.PlaceholderItem.GetCustomData"/>) because of the MS Office transactional save,
21+
/// which renames and deletes the file, so all custom data is lost.
1922
/// </remarks>
20-
public class CustomDataManager
23+
public class ExternalDataManager
2124
{
2225
/// <summary>
2326
/// Path in user file system with which this custom data corresponds.
@@ -57,7 +60,7 @@ public class CustomDataManager
5760
/// <summary>
5861
/// Creates instance of this class.
5962
/// </summary>
60-
public CustomDataManager(
63+
public ExternalDataManager(
6164
string userFileSystemPath,
6265
string serverDataFolderPath,
6366
string userFileSystemRootPath,
@@ -77,8 +80,9 @@ public CustomDataManager(
7780
/// Indicates if the item was saved to the remote storage.
7881
/// </summary>
7982
/// <remarks>
83+
/// MS Office transactional save, deletes and recreates the file.
8084
/// To detect if this is a new file we must store some marker ouside of the file,
81-
/// for the marker to survive MS Office transactional save, which deletes and recreates the file.
85+
/// for the marker to survive the transactional save operation.
8286
/// </remarks>
8387
public bool IsNew
8488
{

Windows/VirtualDrive/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
<h1 class="d-xl-block d-none">Virtual Drive Sample in .NET, C#</h1>
3-
<p>This is a virtual drive implementation with Microsoft Office documents editing support and automatic Microsoft Office documents locking. It also demonstrates custom column support in Windows File Manager.&nbsp;To simulate the remote storage, this sample is using a folder in the local file system on the same machine.&nbsp;This sample supports all basic synchronization features provided that is provided by the <a title="Virtual File System Sample for Windows" href="https://www.userfilesystem.com/examples/virtual_file_system/">Virtual File System</a> sample: folders&nbsp;on-demand listing, files on-demand content loading, selective offline files support, hydration progress. The sample is written in C#/.NET.</p>
3+
<p>This is a virtual drive implementation with thumbnail support, Microsoft Office documents editing support, and automatic Microsoft Office documents locking. It also demonstrates custom column support in Windows File Manager.&nbsp;To simulate the remote storage, this sample is using a folder in the local file system on the same machine.&nbsp;This sample supports all basic synchronization features provided that is provided by the <a title="Virtual File System Sample for Windows" href="https://www.userfilesystem.com/examples/virtual_file_system/">Virtual File System</a> sample: folders&nbsp;on-demand listing, files on-demand content loading, selective offline files support, hydration progress. The sample is written in C#/.NET.</p>
44
<p><span>You can download this sample and a trial license in the&nbsp;</span><a title="Download" href="https://www.userfilesystem.com/download/">product download area</a>&nbsp;as well as you can clone it from<span>&nbsp;</span><a title="Virtual Drive Sample in .NET, C#" href="https://github.com/ITHit/UserFileSystemSamples/tree/master/Windows/VirtualDrive">GitHub</a><span>.&nbsp;</span></p>
55
<p><span class="warn">This sample is provided with IT Hit User File System v3 Beta and later versions.</span></p>
66
<h2 class="heading-link" id="nav_requirements">Requirements<a class="list-link d-inline" href="https://www.userfilesystem.com/examples/virtual_file_system/#nav_requirements"></a></h2>
@@ -17,10 +17,12 @@
1717
<p>To run the example, you will need a valid IT Hit User File System Engine for .NET License. You can download the license in&nbsp;the&nbsp;<a title="IT Hit User File System for .NET Download" href="https://www.userfilesystem.com/download/">product download area</a>.&nbsp;Note that the Engine is fully functional with a trial license and does not have any limitations. The trial license is valid for one month and the engine will stop working after this. You can check the expiration date inside the license file.&nbsp;Download the license file and specify its content in&nbsp;<span class="code">License</span>&nbsp;field in&nbsp;<span class="code">appsettings.json</span>&nbsp;file.</p>
1818
<p>You can also run the sample&nbsp;without explicitly specifying a license&nbsp;for 5 days. In this case,&nbsp;the&nbsp;Engine will automatically request the trial license from the IT Hit website https://www.userfilesystem.com. Make sure it is accessible via firewalls if any. After 5 days the Engine will stop working. To extend the trial period you will need to download a license in a&nbsp;<a title="IT Hit User File System for .NET Download" href="https://www.userfilesystem.com/download/">product download area</a>&nbsp;and specify it in&nbsp;<span class="code">appsettings.json</span></p>
1919
<h2 class="heading-link" id="nav_runningthesample">Running the Sample<a class="list-link d-inline" href="https://www.userfilesystem.com/examples/virtual_file_system/#nav_runningthesample"></a></h2>
20-
<p>To run the sample open the project in Visual Studio and run the project in a debug mode. When starting in the debug mode, it will automatically create a folder in which the virtual file system will reside, register the virtual drive with the platform and then open&nbsp;two instances of Windows File Manager, one of which will show a virtual drive and another a folder simulating remote storage.&nbsp;</p>
20+
<p>To run the sample open the project in Visual Studio and run the project in debug mode. When starting in the debug mode, it will automatically create a folder in which the virtual file system will reside, register the virtual drive with the platform and then open&nbsp;two instances of Windows File Manager, one of which will show a virtual drive and another a folder simulating remote storage.&nbsp;</p>
2121
<p>You can find more about running and stopping the sample as well as about basic synchronization features in the&nbsp;<a title="Virtual File System Sample for Windows" href="https://www.userfilesystem.com/examples/virtual_file_system/">Virtual File System</a>&nbsp;sample description.&nbsp;</p>
22+
<h2>Thumbnails Support</h2>
23+
<p><span>The Virtual Drive sample provides a separate project with thumbnail provider implementation in the COM object. It loads thumbnails from files located in the remote storage simulation folder and displays them in Windows Explorer. You will adapt this project to load thumbnails from your real remote storage.</span></p>
2224
<h2>Microsoft Office Editing Support</h2>
23-
<p>The major difference between the Virtual Drive sample and the <a title="Virtual File System Sample for Windows" href="https://www.userfilesystem.com/examples/virtual_file_system/">Virtual File System</a> sample is its support for Microsoft Office Documents editing. This sample<span>&nbsp;supports synchronization of the MS Office documents, avoiding the creation of the temporary files in the remote storage as well as it does not rename or delete the document in your remote storage during MS Office transactional save operation, preserving all data associated with a file in your remote storage.</span></p>
25+
<p>Another major difference between the Virtual Drive sample and the <a title="Virtual File System Sample for Windows" href="https://www.userfilesystem.com/examples/virtual_file_system/">Virtual File System</a> sample is its support for Microsoft Office Documents editing. This sample<span>&nbsp;supports synchronization of the MS Office documents, avoiding the creation of the temporary files in the remote storage as well as it does not rename or delete the document in your remote storage during MS Office transactional save operation, preserving all data associated with a file in your remote storage.</span></p>
2426
<p><span>This sample automatically locks the Microsoft Office document in the remote storage when a document is being opened for editing and automatically unlocks the document when the file is closed. When the document is opened you will see the lock icon&nbsp;<img id="__mcenew" alt="Lock icon" src="https://www.userfilesystem.com/media/2071/locked.png" rel="120785"> in the Status column in Windows File Manager:</span></p>
2527
<p><span>&nbsp;<img id="__mcenew" alt="Virtual Drive sample shows lock icon for Microsoft Office documents" src="https://www.userfilesystem.com/media/2133/virtualdrivemsoffice.png" rel="122441"></span></p>
2628
<p><span>The information about the lock (lock-token, etc.) is being saved on the client machine when the document is locked.</span>&nbsp;When a document is modified on the client,&nbsp;all changes to the document are being saved on the local drive, without being sent to the remote storage. You will see the not In-Sync icon&nbsp;<img id="__mcenew" alt="" src="https://www.userfilesystem.com/media/1987/notinsyncfile.png" rel="118450"> being displayed when you modify and save the document. The updated document content is sent to the remote storage when the document is closed, together with the lock-token and eTag.&nbsp;</p>

Windows/VirtualDrive/VirtualDrive/MsOfficeDocsMonitor.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,9 @@ private async void DeletedAsync(object sender, FileSystemEventArgs e)
102102
/// </summary>
103103
private async void RenamedAsync(object sender, RenamedEventArgs e)
104104
{
105-
// If the item and was previusly filtered by EngineWindows.FilterAsync(),
106-
// for example temp MS Office file was renamed SGE4274H->file.xlsx,
105+
// If the item was previously filtered by EngineWindows.FilterAsync(),
106+
// for example temp MS Office file was renamed SGE4274H -> file.xlsx,
107107
// we need to convert the file to a pleaceholder and upload it to the remote storage.
108-
// We must also
109108

110109
LogMessage("Renamed", e.OldFullPath, e.FullPath);
111110

@@ -125,7 +124,7 @@ private async void RenamedAsync(object sender, RenamedEventArgs e)
125124
else
126125
{
127126
LogMessage("Converting to placeholder", userFileSystemNewPath);
128-
PlaceholderItem.ConvertToPlaceholder(userFileSystemNewPath, null, false);
127+
PlaceholderItem.ConvertToPlaceholder(userFileSystemNewPath, null, null, false);
129128
await engine.ClientNotifications(userFileSystemNewPath, this).UpdateAsync();
130129
await engine.CustomDataManager(userFileSystemNewPath).RefreshCustomColumnsAsync();
131130
}

Windows/VirtualDrive/VirtualDrive/Program.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Program
3434
/// </summary>
3535
public static VirtualEngine Engine;
3636

37-
static async Task<int> Main(string[] args)
37+
static async Task Main(string[] args)
3838
{
3939
// Load Settings.
4040
IConfiguration configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json", false, true).Build();
@@ -63,6 +63,9 @@ static async Task<int> Main(string[] args)
6363

6464
await Registrar.RegisterAsync(SyncRootId, Settings.UserFileSystemRootPath, Settings.ProductName,
6565
Path.Combine(Settings.IconsFolderPath, "Drive.ico"));
66+
67+
// Register thumbnail provider.
68+
ThumbnailInstaller.Register();
6669
}
6770
else
6871
{
@@ -88,9 +91,6 @@ await Registrar.RegisterAsync(SyncRootId, Settings.UserFileSystemRootPath, Setti
8891
// Start processing OS file system calls.
8992
await Engine.StartAsync();
9093

91-
// Register thumbnail provider
92-
ThumbnailInstaller.Register();
93-
9494
#if DEBUG
9595
// Opens Windows File Manager with user file system folder and remote storage folder.
9696
ShowTestEnvironment();
@@ -143,8 +143,6 @@ await Registrar.RegisterAsync(SyncRootId, Settings.UserFileSystemRootPath, Setti
143143
{
144144
log.Info("\n\nAll downloaded file / folder placeholders remain in file system. Restart the application to continue managing files.\n");
145145
}
146-
147-
return 1;
148146
}
149147

150148
#if DEBUG
-363 Bytes
Binary file not shown.
-1.34 KB
Binary file not shown.

0 commit comments

Comments
 (0)