Skip to content

Commit cbd5a1c

Browse files
committed
v3.2.8936.0
1 parent 9e4a543 commit cbd5a1c

File tree

14 files changed

+142
-102
lines changed

14 files changed

+142
-102
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.2.8901.0" />
11+
<PackageReference Include="ITHit.FileSystem" Version="3.2.8936.0" />
1212
</ItemGroup>
1313
</Project>

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.2.8901.0" />
15+
<PackageReference Include="ITHit.FileSystem.Windows" Version="3.2.8936.0" />
1616
<ProjectReference Include="..\..\Common\Common.csproj" />
1717
</ItemGroup>
1818
</Project>

Windows/UserFileSystemSamples.sln

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ Global
117117
{51F6CFCC-AB57-40DD-AADA-6299A2C6B941}.Release|x64.Build.0 = Release|Any CPU
118118
{51F6CFCC-AB57-40DD-AADA-6299A2C6B941}.Release|x86.ActiveCfg = Release|Any CPU
119119
{51F6CFCC-AB57-40DD-AADA-6299A2C6B941}.Release|x86.Build.0 = Release|Any CPU
120-
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
121-
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
120+
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Debug|Any CPU.ActiveCfg = Debug|x64
121+
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Debug|Any CPU.Build.0 = Debug|x64
122122
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Debug|ARM.ActiveCfg = Debug|Any CPU
123123
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Debug|ARM.Build.0 = Debug|Any CPU
124124
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Debug|ARM64.ActiveCfg = Debug|Any CPU
125125
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Debug|ARM64.Build.0 = Debug|Any CPU
126-
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Debug|x64.ActiveCfg = Debug|Any CPU
127-
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Debug|x64.Build.0 = Debug|Any CPU
126+
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Debug|x64.ActiveCfg = Debug|x64
127+
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Debug|x64.Build.0 = Debug|x64
128128
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Debug|x86.ActiveCfg = Debug|Any CPU
129129
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Debug|x86.Build.0 = Debug|Any CPU
130130
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -137,14 +137,14 @@ Global
137137
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Release|x64.Build.0 = Release|Any CPU
138138
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Release|x86.ActiveCfg = Release|Any CPU
139139
{648FB01F-0C4A-409E-A48A-E6722F626AB8}.Release|x86.Build.0 = Release|Any CPU
140-
{1E765516-497B-4546-8C38-DB452915ACBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
141-
{1E765516-497B-4546-8C38-DB452915ACBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
140+
{1E765516-497B-4546-8C38-DB452915ACBF}.Debug|Any CPU.ActiveCfg = Debug|x64
141+
{1E765516-497B-4546-8C38-DB452915ACBF}.Debug|Any CPU.Build.0 = Debug|x64
142142
{1E765516-497B-4546-8C38-DB452915ACBF}.Debug|ARM.ActiveCfg = Debug|Any CPU
143143
{1E765516-497B-4546-8C38-DB452915ACBF}.Debug|ARM.Build.0 = Debug|Any CPU
144144
{1E765516-497B-4546-8C38-DB452915ACBF}.Debug|ARM64.ActiveCfg = Debug|Any CPU
145145
{1E765516-497B-4546-8C38-DB452915ACBF}.Debug|ARM64.Build.0 = Debug|Any CPU
146-
{1E765516-497B-4546-8C38-DB452915ACBF}.Debug|x64.ActiveCfg = Debug|Any CPU
147-
{1E765516-497B-4546-8C38-DB452915ACBF}.Debug|x64.Build.0 = Debug|Any CPU
146+
{1E765516-497B-4546-8C38-DB452915ACBF}.Debug|x64.ActiveCfg = Debug|x64
147+
{1E765516-497B-4546-8C38-DB452915ACBF}.Debug|x64.Build.0 = Debug|x64
148148
{1E765516-497B-4546-8C38-DB452915ACBF}.Debug|x86.ActiveCfg = Debug|Any CPU
149149
{1E765516-497B-4546-8C38-DB452915ACBF}.Debug|x86.Build.0 = Debug|Any CPU
150150
{1E765516-497B-4546-8C38-DB452915ACBF}.Release|Any CPU.ActiveCfg = Release|Any CPU

Windows/VirtualDrive/VirtualDrive.Package/VirtualDrive.Package.wapproj

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,36 @@
4848
<DefaultLanguage>en-US</DefaultLanguage>
4949
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
5050
<EntryPointProjectUniqueName>..\VirtualDrive\VirtualDrive.csproj</EntryPointProjectUniqueName>
51+
<GenerateAppInstallerFile>True</GenerateAppInstallerFile>
52+
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
53+
<GenerateTestArtifacts>True</GenerateTestArtifacts>
54+
<AppxBundlePlatforms>x64</AppxBundlePlatforms>
55+
<AppInstallerUri></AppInstallerUri>
56+
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
57+
</PropertyGroup>
58+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
59+
<AppxBundle>Always</AppxBundle>
60+
</PropertyGroup>
61+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
62+
<AppxBundle>Always</AppxBundle>
63+
</PropertyGroup>
64+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
65+
<AppxBundle>Always</AppxBundle>
66+
</PropertyGroup>
67+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
68+
<AppxBundle>Always</AppxBundle>
69+
</PropertyGroup>
70+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
71+
<AppxBundle>Always</AppxBundle>
72+
</PropertyGroup>
73+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
74+
<AppxBundle>Always</AppxBundle>
75+
</PropertyGroup>
76+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
77+
<AppxBundle>Always</AppxBundle>
78+
</PropertyGroup>
79+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
80+
<AppxBundle>Always</AppxBundle>
5181
</PropertyGroup>
5282
<ItemGroup>
5383
<AppxManifest Include="Package.appxmanifest">

Windows/VirtualDrive/VirtualDrive.Package/VirtualDrive.Package.wapproj.user

Lines changed: 0 additions & 4 deletions
This file was deleted.

Windows/VirtualDrive/VirtualDrive.ThumbnailProvider/VirtualDrive.ThumbnailProvider.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>netcoreapp3.1</TargetFramework>
55
<EnableComHosting>True</EnableComHosting>
6+
<Platforms>x64</Platforms>
67
</PropertyGroup>
78

89
<ItemGroup>

Windows/VirtualDrive/VirtualDrive/MsOfficeDocsMonitor.cs

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ internal MsOfficeDocsMonitor(string userFileSystemRootPath, VirtualEngine engine
4646
watcher.IncludeSubdirectories = true;
4747
watcher.Path = userFileSystemRootPath;
4848
//watcher.Filter = "*.*";
49-
watcher.NotifyFilter = NotifyFilters.FileName;
49+
50+
// Some applications, such as Notpad++, remove the Offline attribute,
51+
// Attributes filter is required to monitor the Changed event and convert the file back to the plceholder.
52+
watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.Attributes;
5053
watcher.Error += Error;
5154
watcher.Created += CreatedAsync;
5255
watcher.Changed += ChangedAsync;
@@ -87,6 +90,38 @@ private async void CreatedAsync(object sender, FileSystemEventArgs e)
8790
private async void ChangedAsync(object sender, FileSystemEventArgs e)
8891
{
8992
LogMessage($"{e.ChangeType}", e.FullPath);
93+
94+
string userFileSystemPath = e.FullPath;
95+
try
96+
{
97+
if (System.IO.File.Exists(userFileSystemPath)
98+
&& !MsOfficeHelper.AvoidMsOfficeSync(userFileSystemPath))
99+
{
100+
if (!PlaceholderItem.IsPlaceholder(userFileSystemPath))
101+
{
102+
if (engine.CustomDataManager(userFileSystemPath).IsNew)
103+
{
104+
await engine.ClientNotifications(userFileSystemPath, this).CreateAsync();
105+
}
106+
else
107+
{
108+
LogMessage("Converting to placeholder", userFileSystemPath);
109+
PlaceholderItem.ConvertToPlaceholder(userFileSystemPath, null, null, false);
110+
await engine.ClientNotifications(userFileSystemPath, this).UpdateAsync();
111+
await engine.CustomDataManager(userFileSystemPath).RefreshCustomColumnsAsync();
112+
}
113+
}
114+
}
115+
}
116+
catch (Exception ex)
117+
{
118+
string userFileSystemOldPath = null;
119+
if (e is RenamedEventArgs)
120+
{
121+
userFileSystemOldPath = (e as RenamedEventArgs).OldFullPath;
122+
}
123+
LogError($"{e.ChangeType} failed", userFileSystemOldPath, userFileSystemPath, ex);
124+
}
90125
}
91126

92127
/// <summary>
@@ -106,36 +141,7 @@ private async void RenamedAsync(object sender, RenamedEventArgs e)
106141
// for example temp MS Office file was renamed SGE4274H -> file.xlsx,
107142
// we need to convert the file to a pleaceholder and upload it to the remote storage.
108143

109-
LogMessage("Renamed", e.OldFullPath, e.FullPath);
110-
111-
string userFileSystemOldPath = e.OldFullPath;
112-
string userFileSystemNewPath = e.FullPath;
113-
try
114-
{
115-
if (System.IO.File.Exists(userFileSystemNewPath)
116-
&& !MsOfficeHelper.AvoidMsOfficeSync(userFileSystemNewPath))
117-
{
118-
if (!PlaceholderItem.IsPlaceholder(userFileSystemNewPath))
119-
{
120-
if (engine.CustomDataManager(userFileSystemNewPath).IsNew)
121-
{
122-
await engine.ClientNotifications(userFileSystemNewPath, this).CreateAsync();
123-
}
124-
else
125-
{
126-
LogMessage("Converting to placeholder", userFileSystemNewPath);
127-
PlaceholderItem.ConvertToPlaceholder(userFileSystemNewPath, null, null, false);
128-
await engine.ClientNotifications(userFileSystemNewPath, this).UpdateAsync();
129-
await engine.CustomDataManager(userFileSystemNewPath).RefreshCustomColumnsAsync();
130-
}
131-
}
132-
}
133-
}
134-
catch (Exception ex)
135-
{
136-
LogError($"{e.ChangeType} failed", userFileSystemOldPath, userFileSystemNewPath, ex);
137-
}
138-
144+
ChangedAsync(sender, e);
139145
}
140146

141147
private void Error(object sender, ErrorEventArgs e)

Windows/VirtualDrive/VirtualDrive/Program.cs

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
using log4net;
2+
using log4net.Appender;
3+
using log4net.Config;
4+
using Microsoft.Extensions.Configuration;
15
using System;
26
using System.Diagnostics;
37
using System.IO;
8+
using System.Linq;
49
using System.Reflection;
10+
using System.Runtime.InteropServices;
511
using System.Threading.Tasks;
612
using Windows.Storage;
7-
using Microsoft.Extensions.Configuration;
8-
using log4net;
9-
using log4net.Config;
1013

1114
using ITHit.FileSystem.Samples.Common.Windows;
1215

@@ -43,7 +46,10 @@ static async Task Main(string[] args)
4346
// Enable UTF8 for Console Window
4447
Console.OutputEncoding = System.Text.Encoding.UTF8;
4548

46-
log.Info($"\n{System.Diagnostics.Process.GetCurrentProcess().ProcessName} {Settings.AppID}");
49+
log.Info($"\n{Process.GetCurrentProcess().ProcessName} {Settings.AppID}");
50+
log.Info($"\nOS version: {RuntimeInformation.OSDescription}.");
51+
log.Info($"\nEnv version: {RuntimeInformation.FrameworkDescription} {IntPtr.Size * 8}bit.");
52+
log.Info($"\nLog path: {(logRepository.GetAppenders().Where(p => p.GetType() == typeof(RollingFileAppender)).FirstOrDefault() as RollingFileAppender)?.File}.");
4753
log.Info("\nPress 'Q' to unregister file system, delete all files/folders and exit (simulate uninstall with full cleanup).");
4854
log.Info("\nPress 'q' to unregister file system and exit (simulate uninstall).");
4955
log.Info("\nPress any other key to exit without unregistering (simulate reboot).");
@@ -69,15 +75,15 @@ await Registrar.RegisterAsync(SyncRootId, Settings.UserFileSystemRootPath, Setti
6975
StorageFolder userFileSystemRootFolder = await StorageFolder.GetFolderFromPathAsync(Settings.UserFileSystemRootPath);
7076
log.Info($"\nIndexed state: {(await userFileSystemRootFolder.GetIndexedStateAsync())}\n");
7177

72-
ConsoleKeyInfo exitKey;
78+
ConsoleKeyInfo? exitKey = null;
7379

7480
try
7581
{
7682
Engine = new VirtualEngine(
77-
Settings.UserFileSystemLicense,
78-
Settings.UserFileSystemRootPath,
79-
Settings.ServerDataFolderPath,
80-
Settings.IconsFolderPath,
83+
Settings.UserFileSystemLicense,
84+
Settings.UserFileSystemRootPath,
85+
Settings.ServerDataFolderPath,
86+
Settings.IconsFolderPath,
8187
log);
8288
Engine.AutoLock = Settings.AutoLock;
8389

@@ -91,25 +97,30 @@ await Registrar.RegisterAsync(SyncRootId, Settings.UserFileSystemRootPath, Setti
9197
// Keep this application running until user input.
9298
exitKey = Console.ReadKey();
9399
}
100+
catch (Exception ex)
101+
{
102+
log.Error(ex);
103+
Console.ReadKey();
104+
}
94105
finally
95106
{
96107
Engine.Dispose();
97108
}
98109

99-
if (exitKey.KeyChar == 'q')
110+
if (exitKey?.KeyChar == 'q')
100111
{
101112
// Unregister during programm uninstall.
102113
await Registrar.UnregisterAsync(SyncRootId);
103114
log.Info($"\n\nUnregistering {Settings.UserFileSystemRootPath} sync root.");
104115
log.Info("\nAll empty file and folder placeholders are deleted. Hydrated placeholders are converted to regular files / folders.\n");
105116
}
106-
else if (exitKey.KeyChar == 'Q')
117+
else if (exitKey?.KeyChar == 'Q')
107118
{
108119
log.Info($"\n\nUnregistering {Settings.UserFileSystemRootPath} sync root.");
109120
log.Info("\nAll files and folders placeholders are deleted.\n");
110121

111122
// Unregister during programm uninstall and delete all files/folder.
112-
await Registrar.UnregisterAsync(SyncRootId);
123+
await Registrar.UnregisterAsync(SyncRootId);
113124

114125
try
115126
{

Windows/VirtualDrive/VirtualDrive/VirtualDrive.csproj

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@
77
<Company>IT Hit LTD.</Company>
88
<Product>Virtual Drive</Product>
99
<Copyright>IT Hit LTD.</Copyright>
10-
<Platforms>AnyCPU</Platforms>
10+
<Platforms>x64</Platforms>
1111
<Description>A virtual drive project in .NET/C# with synchronization support, on-demand loading, selective offline files support, upload and download progress. It synchronizes files and folders both from remote storage to the user file system and from the user file system to remote storage.
1212

1313
To simulate the remote storage, this sample is using a folder in the local file system on the same machine. You can use this project as a strting point for creating a Virtual Drive with advanced features.
1414

1515
This is an advanced project with ETags support, Microsoft Office documents editing, automatic Microsoft Office documents locking, and custom columns in Windows File Manager.</Description>
1616
</PropertyGroup>
17-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
18-
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
19-
</PropertyGroup>
2017
<ItemGroup>
2118
<Compile Remove="Framework\**" />
2219
<Compile Remove="RemoteStorageTemplate\**" />
@@ -32,9 +29,8 @@ This is an advanced project with ETags support, Microsoft Office documents editi
3229
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="5.0.0" />
3330
</ItemGroup>
3431
<ItemGroup>
35-
<PackageReference Include="ITHit.FileSystem.Windows" Version="3.2.8901.0" />
32+
<PackageReference Include="ITHit.FileSystem.Windows" Version="3.2.8936.0" />
3633
<ProjectReference Include="..\..\Common\Common.Windows.csproj" />
37-
<ProjectReference Include="..\VirtualDrive.ThumbnailProvider\VirtualDrive.ThumbnailProvider.csproj" />
3834
</ItemGroup>
3935
<ItemGroup>
4036
<None Update="appsettings.json">
@@ -68,11 +64,4 @@ This is an advanced project with ETags support, Microsoft Office documents editi
6864
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
6965
</Content>
7066
</ItemGroup>
71-
<!--Copy *.json deps files from VirtualDrive.ThumbnailProvider-->
72-
<Target Name="CopyDepsFiles" AfterTargets="AfterBuild">
73-
<ItemGroup>
74-
<DepsFilePaths Include="..\VirtualDrive.ThumbnailProvider\bin\$(Configuration)\$(TargetFramework)\*.json" />
75-
</ItemGroup>
76-
<Copy SourceFiles="@(DepsFilePaths)" DestinationFolder="$(OutDir)" />
77-
</Target>
7867
</Project>

Windows/VirtualDrive/VirtualDrive/VirtualDrive.csproj.user

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)