Skip to content

Commit 6c51ab2

Browse files
committed
v8.2.27026.0
1 parent deb13fb commit 6c51ab2

File tree

64 files changed

+727
-717
lines changed

Some content is hidden

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

64 files changed

+727
-717
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="8.1.26901.0" />
14-
<PackageReference Include="ITHit.FileSystem" Version="8.1.26901.0" />
13+
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.2.27026.0" />
14+
<PackageReference Include="ITHit.FileSystem" Version="8.2.27026.0" />
1515
</ItemGroup>
1616
</Project>

Common/FileMetadataExt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace ITHit.FileSystem.Samples.Common
99
public class FileMetadataExt : FileSystemItemMetadataExt, IFileMetadata
1010
{
1111
///<inheritdoc/>
12-
public long Length { get; set; }
12+
public long? Length { get; set; }
1313

1414
///<inheritdoc/>
1515
public string ContentETag { get; set; }

Common/Settings.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,18 @@ public class Settings
3838
public string IconsFolderPath { get; set; }
3939

4040
/// <summary>
41-
/// Product name. Displayed as a mounted folder name under Desktop as
42-
/// well in every location where product name is required.
41+
/// Product name. Displayed in every location where product name is required.
4342
/// </summary>
4443
public string ProductName { get; set; }
4544

4645
/// <summary>
4746
/// Automatically lock the file in the remote storage when a file handle is being opened for writing, unlock on close.
4847
/// </summary>
4948
public bool AutoLock { get; set; }
49+
50+
/// <summary>
51+
/// The folder content invalidation period in milliseconds.
52+
/// </summary>
53+
public double FolderInvalidationIntervalMs { get; set; }
5054
}
5155
}

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

Lines changed: 2 additions & 2 deletions
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.26901.0" />
25-
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.1.26901.0" />
24+
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="8.2.27026.0" />
25+
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.2.27026.0" />
2626
<ProjectReference Include="..\..\..\Common\Common.csproj" />
2727
</ItemGroup>
2828
</Project>

Windows/Common/Core/LogFormatter.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public bool DebugLoggingEnabled
4747

4848
private readonly string appId;
4949

50-
private const int sourcePathWidth = 45;
51-
private const int remoteStorageIdWidth = 20;
50+
private const int sourcePathWidth = 30;
51+
private const int remoteStorageIdWidth = 12;
5252

5353
private const int indent = -45;
5454

@@ -192,14 +192,17 @@ private void WriteLog(IEngine sender, EngineMessageEventArgs e, log4net.Core.Lev
192192
{
193193
string attSource = GetAttString(e.SourcePath);
194194
string attTarget = GetAttString(e.TargetPath);
195-
195+
196+
string remoteStorageId = null;
196197
string process = null;
197198
byte? priorityHint = null;
198199
string fileId = null;
199200
string size = null;
200201

201202
if (e.OperationContext != null)
202203
{
204+
byte[] rsId = e?.Metadata?.RemoteStorageItemId ?? e.OperationContext.RemoteStorageItemId;
205+
remoteStorageId = IdToSting(rsId)?.FitString(remoteStorageIdWidth, 4);
203206
process = System.IO.Path.GetFileName(e.OperationContext?.ProcessInfo?.ImagePath);
204207
priorityHint = e.OperationContext?.PriorityHint;
205208
IWindowsOperationContext ocWin = e.OperationContext as IWindowsOperationContext;
@@ -213,7 +216,7 @@ private void WriteLog(IEngine sender, EngineMessageEventArgs e, log4net.Core.Lev
213216
string sourcePath = e.SourcePath?.FitString(sourcePathWidth, 6);
214217
string targetPath = e.TargetPath?.FitString(sourcePathWidth, 6);
215218

216-
string message = Format(DateTimeOffset.Now.ToString("hh:mm:ss.fff"), process, priorityHint?.ToString(), fileId, "", e.ComponentName, e.CallerLineNumber.ToString(), e.CallerMemberName, e.CallerFilePath, e.Message, sourcePath, attSource);
219+
string message = Format(DateTimeOffset.Now.ToString("hh:mm:ss.fff"), process, priorityHint?.ToString(), fileId, e.ComponentName, e.CallerLineNumber.ToString(), e.CallerMemberName, e.CallerFilePath, e.Message, remoteStorageId, sourcePath, attSource);
217220
if (targetPath!=null)
218221
{
219222
// For move operation output target path in the next line.
@@ -240,10 +243,10 @@ private void WriteLog(IEngine sender, EngineMessageEventArgs e, log4net.Core.Lev
240243

241244
}
242245

243-
private static string Format(string date, string process, string priorityHint, string fileId, string remoteStorageId, string componentName, string callerLineNumber, string callerMemberName, string callerFilePath, string message, string path, string attributes)
246+
private static string Format(string date, string process, string priorityHint, string fileId, string componentName, string callerLineNumber, string callerMemberName, string callerFilePath, string message, string remoteStorageId, string path, string attributes)
244247
{
245248
// {fileId,-18} | {remoteStorageId,-remoteStorageIdWidth}
246-
return $"{Environment.NewLine}|{date,-12}| {process,-25}| {componentName,-26}| {message,-45}| {path,-sourcePathWidth} | {attributes,10}";
249+
return $"{Environment.NewLine}|{date,-12}| {process,-25}| {componentName,-26}| {message,-45}| {remoteStorageId,-remoteStorageIdWidth}| {path,-sourcePathWidth} | {attributes,10}";
247250
}
248251

249252
/// <summary>
@@ -252,8 +255,8 @@ private static string Format(string date, string process, string priorityHint, s
252255
private void PrintHeader()
253256
{
254257
Log.Info("\n");
255-
Log.Info(Format("Time", "Process Name", "Prty", "FS ID", "RS ID", "Component", "Line", "Caller Member Name", "Caller File Path", "Message", "Path", "Attributes"));
256-
Log.Info(Format("----", "------------", "----", "_____", "_____", "---------", "____", "------------------", "----------------", "-------", "----", "----------"));
258+
Log.Info(Format("Time", "Process Name", "Prty", "FS ID", "Component", "Line", "Caller Member Name", "Caller File Path", "Message", "RS Item ID", "Path", "Attributes"));
259+
Log.Info(Format("----", "------------", "----", "_____", "---------", "____", "------------------", "----------------", "-------", "__________", "----", "----------"));
257260
}
258261

259262
/// <summary>
@@ -330,13 +333,13 @@ public static string IdToSting(byte[] remoteStorageItemId)
330333
default:
331334
// Try parse URI
332335
string uriStrId = Encoding.UTF8.GetString(remoteStorageItemId);
333-
if (Uri.TryCreate(uriStrId, UriKind.RelativeOrAbsolute, out Uri uriId))
336+
if (Uri.TryCreate(uriStrId, UriKind.RelativeOrAbsolute, out Uri uriId) && uriId.IsAbsoluteUri)
334337
{
335338
return uriId.Segments.Last();
336339
}
337340
else
338341
{
339-
return uriStrId;
342+
return BitConverter.ToString(remoteStorageItemId);
340343
}
341344
}
342345
}

Windows/Common/Core/Registrar.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,11 @@ public Registrar(ILog log, IEnumerable<(string Name, Guid Guid, bool AlwaysRegis
4747
/// </summary>
4848
/// <param name="displayName">Human readable display name.</param>
4949
/// <param name="iconPath">Path to the drive ico file.</param>
50-
/// <param name="shellExtensionsComServerExePath">Absolute path of external COM server executable to use when running without application identity. If not provided, will use current process.</param>
5150
/// <remarks>
5251
/// In the case of a packaged installer (msix) call this method during first program start.
5352
/// In the case of a regular installer (msi) call this method during installation.
5453
/// </remarks>
55-
public async Task<StorageProviderSyncRootInfo> RegisterSyncRootAsync(string syncRootId, string userFileSystemRootPath, string remotestorageRootPath, string displayName, string iconPath, string shellExtensionsComServerExePath = null)
54+
public async Task<StorageProviderSyncRootInfo> RegisterSyncRootAsync(string syncRootId, string userFileSystemRootPath, string remotestorageRootPath, string displayName, string iconPath)
5655
{
5756
StorageProviderSyncRootInfo syncRoot = null;
5857
if (!await IsRegisteredAsync(userFileSystemRootPath))
@@ -70,7 +69,7 @@ public async Task<StorageProviderSyncRootInfo> RegisterSyncRootAsync(string sync
7069
if (shellExtensionHandlers != null)
7170
{
7271
// Register thumbnails handler, custom states handler, etc.
73-
RegisterShellExtensions(syncRootId, shellExtensionHandlers, Log, shellExtensionsComServerExePath);
72+
RegisterShellExtensions(syncRootId, shellExtensionHandlers, Log);
7473
}
7574

7675
return syncRoot;

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

Lines changed: 2 additions & 2 deletions
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.26901.0" />
17-
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.1.26901.0" />
16+
<PackageReference Include="ITHit.FileSystem.Windows.AppHelper" Version="8.2.27026.0" />
17+
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.2.27026.0" />
1818
<ProjectReference Include="..\..\..\Common\Common.csproj" />
1919
<ProjectReference Include="..\Core\Common.Windows.Core.csproj" />
2020
</ItemGroup>

Windows/Common/VirtualDrive/VirtualEngineBase.cs

Lines changed: 96 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public abstract class VirtualEngineBase : EngineWindows
2626
/// </summary>
2727
/// <param name="userName">User name.</param>
2828
/// <returns>True if user name matches currently loged-in user. False - otherwise.</returns>
29-
public bool IsCurrentUser(string userName)
30-
{
31-
return CurrentUserPrincipal.Equals(userName, StringComparison.InvariantCultureIgnoreCase);
29+
public bool IsCurrentUser(string userName)
30+
{
31+
return CurrentUserPrincipal.Equals(userName, StringComparison.InvariantCultureIgnoreCase);
3232
}
3333

3434
/// <summary>
@@ -59,12 +59,12 @@ public bool IsCurrentUser(string userName)
5959
/// <param name="setLockReadOnly">Mark documents locked by other users as read-only for this user and vice versa.</param>
6060
/// <param name="logFormatter">Formats log output.</param>
6161
public VirtualEngineBase(
62-
string license,
63-
string userFileSystemRootPath,
64-
string remoteStorageRootPath,
62+
string license,
63+
string userFileSystemRootPath,
64+
string remoteStorageRootPath,
6565
string iconsFolderPath,
6666
bool setLockReadOnly,
67-
LogFormatter logFormatter)
67+
LogFormatter logFormatter)
6868
: base(license, userFileSystemRootPath)
6969
{
7070
this.iconsFolderPath = iconsFolderPath ?? throw new ArgumentNullException(nameof(iconsFolderPath));
@@ -73,10 +73,11 @@ public VirtualEngineBase(
7373
// We want our file system to run regardless of any errors.
7474
// If any request to file system fails in user code or in Engine itself we continue processing.
7575
ThrowExceptions = false;
76-
76+
7777
SetLockReadOnly = setLockReadOnly;
7878

7979
StateChanged += Engine_StateChanged;
80+
ItemsChanging += Engine_ItemsChanging;
8081
ItemsChanged += Engine_ItemsChanged;
8182
SyncService.StateChanged += SyncService_StateChanged;
8283
Error += logFormatter.LogError;
@@ -86,7 +87,55 @@ public VirtualEngineBase(
8687

8788

8889
/// <summary>
89-
/// Fired for each file or folder change.
90+
/// Fired before items(s) changes on queing, hydration, upload, population progress.
91+
/// </summary>
92+
private void Engine_ItemsChanging(Engine sender, ItemsChangeEventArgs e)
93+
{
94+
// Log info about the opertion.
95+
switch (e.OperationType)
96+
{
97+
case OperationType.Populate:
98+
// Log a single parent folder for folder population.
99+
LogItemChanging(e, e.Parent);
100+
break;
101+
default:
102+
// Log each item in the list for all other operations.
103+
foreach (ChangeEventItem item in e.Items)
104+
{
105+
LogItemChanging(e, item);
106+
}
107+
break;
108+
}
109+
}
110+
111+
private void LogItemChanging(ItemsChangeEventArgs e, ChangeEventItem item)
112+
{
113+
// Log info about the opertion.
114+
ILogger logger = Logger.CreateLogger(e.ComponentName);
115+
string msg = $"{e.Direction} {e.OperationType}:{e.NotificationTime}";
116+
117+
// Log progress.
118+
if (e.NotificationTime.HasFlag(NotificationTime.Progress))
119+
{
120+
long progress = e.Position * 100 / (e.Length > 0 ? e.Length : 1);
121+
msg = $"{msg}: {progress}%";
122+
}
123+
124+
switch (e.Source)
125+
{
126+
case OperationSource.Server:
127+
logger.LogDebug(msg, item.Path, item.NewPath, e.OperationContext, item.Metadata);
128+
break;
129+
case OperationSource.Client:
130+
logger.LogDebug(msg, item.Path, item.NewPath, e.OperationContext, item.Metadata);
131+
break;
132+
}
133+
}
134+
135+
136+
137+
/// <summary>
138+
/// Fired after file(s) or folder(s) changed.
90139
/// </summary>
91140
private void Engine_ItemsChanged(Engine sender, ItemsChangeEventArgs e)
92141
{
@@ -122,42 +171,66 @@ private void Engine_ItemsChanged(Engine sender, ItemsChangeEventArgs e)
122171
break;
123172
}
124173
}
174+
}
125175

126-
// Log info about the opertion.
127-
LogItemChange(e, item);
176+
// Log info about the opertion.
177+
switch (e.OperationType)
178+
{
179+
case OperationType.Populate:
180+
// Log a single parent folder for folder population.
181+
LogItemChanged(e, e.Parent);
182+
break;
183+
default:
184+
// Log each item in the list for all other operations.
185+
foreach (ChangeEventItem item in e.Items)
186+
{
187+
LogItemChanged(e, item);
188+
}
189+
break;
128190
}
129191
}
130-
131-
private void LogItemChange(ItemsChangeEventArgs e, ChangeEventItem item)
192+
private void LogItemChanged(ItemsChangeEventArgs e, ChangeEventItem item)
132193
{
133194
ILogger logger = Logger.CreateLogger(e.ComponentName);
134-
string msg = $"{e.Direction} {e.OperationType}: {e.Result.Status}";
195+
string msg = $"{e.Direction} {e.OperationType}:{e.NotificationTime}";
196+
197+
if (!e.NotificationTime.HasFlag(NotificationTime.Progress))
198+
{
199+
msg = $"{msg}:{e.Result.Status}";
200+
}
135201
switch (e.Result.Status)
136202
{
137203
case OperationStatus.Success:
138-
switch (e.Direction)
204+
// Log progress.
205+
if (e.NotificationTime.HasFlag(NotificationTime.Progress))
206+
{
207+
long progress = e.Position * 100 / (e.Length > 0 ? e.Length : 1);
208+
msg = $"{msg}: {progress}%";
209+
}
210+
211+
switch (e.Source)
139212
{
140-
case SyncDirection.Incoming:
141-
logger.LogMessage(msg, item.Path, item.NewPath, e.OperationContext);
213+
case OperationSource.Server:
214+
logger.LogMessage(msg, item.Path, item.NewPath, e.OperationContext, item.Metadata);
142215
break;
143-
case SyncDirection.Outgoing:
144-
logger.LogDebug(msg, item.Path, item.NewPath, e.OperationContext);
216+
case OperationSource.Client:
217+
logger.LogDebug(msg, item.Path, item.NewPath, e.OperationContext, item.Metadata);
145218
break;
146219
}
147220
break;
148221
case OperationStatus.Conflict:
149-
logger.LogMessage(msg, item.Path, item.NewPath, e.OperationContext);
222+
logger.LogMessage(msg, item.Path, item.NewPath, e.OperationContext, item.Metadata);
150223
break;
151224
case OperationStatus.Exception:
152-
logger.LogError(msg, item.Path, item.NewPath, e.Result.Exception);
225+
logger.LogError(msg, item.Path, item.NewPath, e.Result.Exception, e.OperationContext, item.Metadata);
153226
break;
154227
case OperationStatus.Filtered:
155228
msg = $"{msg} by {e.Result.FilteredBy.GetType().Name}";
156-
logger.LogDebug(msg, item.Path, item.NewPath, e.OperationContext);
229+
logger.LogDebug(msg, item.Path, item.NewPath, e.OperationContext, item.Metadata);
157230
break;
158231
default:
159232
msg = $"{msg}. {e.Result.Message}";
160-
logger.LogDebug(msg, item.Path, item.NewPath, e.OperationContext);
233+
logger.LogDebug(msg, item.Path, item.NewPath, e.OperationContext, item.Metadata);
161234
break;
162235
}
163236
}

Windows/UserFileSystemSamplesWin.sln

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common", "..\Common\Common.
2929
EndProject
3030
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "WebDAVDrive.Package", "WebDAVDrive\WebDAVDrive.Package\WebDAVDrive.Package.wapproj", "{86767A2F-1559-4DFB-925D-B8E7FCDE74CA}"
3131
EndProject
32-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebDAVDrive.ShellExtension", "WebDAVDrive\WebDAVDrive.ShellExtension\WebDAVDrive.ShellExtension.csproj", "{2EC2F0CD-4E7D-47ED-AAD0-E6DCCB5138B1}"
33-
EndProject
3432
Global
3533
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3634
Debug|x64 = Debug|x64
@@ -81,10 +79,6 @@ Global
8179
{86767A2F-1559-4DFB-925D-B8E7FCDE74CA}.Release|x64.ActiveCfg = Release|x64
8280
{86767A2F-1559-4DFB-925D-B8E7FCDE74CA}.Release|x64.Build.0 = Release|x64
8381
{86767A2F-1559-4DFB-925D-B8E7FCDE74CA}.Release|x64.Deploy.0 = Release|x64
84-
{2EC2F0CD-4E7D-47ED-AAD0-E6DCCB5138B1}.Debug|x64.ActiveCfg = Debug|x64
85-
{2EC2F0CD-4E7D-47ED-AAD0-E6DCCB5138B1}.Debug|x64.Build.0 = Debug|x64
86-
{2EC2F0CD-4E7D-47ED-AAD0-E6DCCB5138B1}.Release|x64.ActiveCfg = Release|x64
87-
{2EC2F0CD-4E7D-47ED-AAD0-E6DCCB5138B1}.Release|x64.Build.0 = Release|x64
8882
EndGlobalSection
8983
GlobalSection(SolutionProperties) = preSolution
9084
HideSolutionNode = FALSE
@@ -99,7 +93,6 @@ Global
9993
{E589600E-97A4-4B1D-8921-0CCC63B03E96} = {F24CBDD0-7A18-43F0-BCD2-A8FD1A8A7B54}
10094
{C1585095-4C3B-4CD1-B8B2-ECDD378D41BE} = {F24CBDD0-7A18-43F0-BCD2-A8FD1A8A7B54}
10195
{86767A2F-1559-4DFB-925D-B8E7FCDE74CA} = {264745B0-DF86-41E1-B400-3CAA1B403830}
102-
{2EC2F0CD-4E7D-47ED-AAD0-E6DCCB5138B1} = {264745B0-DF86-41E1-B400-3CAA1B403830}
10396
EndGlobalSection
10497
GlobalSection(ExtensibilityGlobals) = postSolution
10598
SolutionGuid = {740A716A-38A7-46BC-A21F-18336D0023B7}

0 commit comments

Comments
 (0)