Skip to content

Commit 59d94b4

Browse files
committed
v4.0.10891.0-Beta
1 parent a4217df commit 59d94b4

Some content is hidden

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

51 files changed

+1911
-955
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="4.0.10509.0-Beta" />
11+
<PackageReference Include="ITHit.FileSystem" Version="4.0.10891.0-Beta" />
1212
</ItemGroup>
1313
</Project>

Common/Settings.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ public class Settings
3232
/// </summary>
3333
public string UserFileSystemRootPath { get; set; }
3434

35-
/// <summary>
36-
/// Full synchronization interval in milliseconds.
37-
/// </summary>
38-
public double SyncIntervalMs { get; set; }
39-
4035
/// <summary>
4136
/// Network delay in milliseconds. When this parameter is > 0 the file download will be delayd to demonstrate file transfer progress.
4237
/// Set this parameter to 0 to avoid any network simulation delays.

Windows/Common/Common.Windows.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
<Product>IT Hit User File System</Product>
88
<Copyright>IT Hit LTD.</Copyright>
99
</PropertyGroup>
10+
<ItemGroup>
11+
<Compile Remove="VirtualDrive\Program.cs" />
12+
</ItemGroup>
1013
<ItemGroup>
1114
<PackageReference Include="log4net" Version="2.0.12" />
1215
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
1316
</ItemGroup>
1417
<ItemGroup>
15-
<PackageReference Include="ITHit.FileSystem.Windows" Version="4.0.10509.0-Beta" />
18+
<PackageReference Include="ITHit.FileSystem.Windows" Version="4.0.10891.0-Beta" />
1619
<ProjectReference Include="..\..\Common\Common.csproj" />
1720
</ItemGroup>
1821
</Project>

Windows/Common/Logger.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ public class Logger : ILogger
1818
/// <summary>
1919
/// Name of the component that is writing to the log.
2020
/// </summary>
21-
private string componentName;
21+
private readonly string componentName;
2222

2323
/// <summary>
2424
/// Log4Net Logger.
2525
/// </summary>
26-
protected ILog Log;
26+
protected readonly ILog Log;
2727

2828
/// <summary>
2929
/// Creates instance of this class.
@@ -43,18 +43,16 @@ public void LogError(string message, string sourcePath = null, string targetPath
4343
string process = null;
4444
byte? priorityHint = null;
4545
long? clientFileId = null;
46-
string serverItemId = null;
4746

4847
if (operationContext != null)
4948
{
5049
ProcessInfo processInfo = Marshal.PtrToStructure<ProcessInfo>(operationContext.ProcessInfo);
5150
process = System.IO.Path.GetFileName(processInfo.ImagePath);
5251
priorityHint = operationContext.PriorityHint;
5352
clientFileId = (operationContext as IWindowsOperationContext).FileId;
54-
//serverItemId = Convert.ToBase64String(operationContext.ItemId);
5553
}
5654

57-
Log.Error($"\n{DateTimeOffset.Now.ToString("hh:mm:ss.fff")} [{process,-25}] {priorityHint,2} {componentName,-26}{message,-45} {sourcePath,-80} {att} ", ex);
55+
Log.Error($"{Format(DateTimeOffset.Now.ToString("hh:mm:ss.fff"), process, priorityHint?.ToString(), componentName, message, sourcePath, att, targetPath)}{Environment.NewLine}", ex);
5856
}
5957

6058
/// <inheritdoc/>
@@ -64,7 +62,6 @@ public void LogMessage(string message, string sourcePath = null, string targetPa
6462
string process = null;
6563
byte? priorityHint = null;
6664
long? clientFileId = null;
67-
string serverItemId = null;
6865
string size = null;
6966

7067
if (operationContext != null)
@@ -74,10 +71,20 @@ public void LogMessage(string message, string sourcePath = null, string targetPa
7471
priorityHint = operationContext.PriorityHint;
7572
clientFileId = (operationContext as IWindowsOperationContext).FileId;
7673
size = FsPath.FormatBytes((operationContext as IWindowsOperationContext).FileSize);
77-
//serverItemId = Convert.ToBase64String(operationContext.ItemId);
7874
}
7975

80-
Log.Debug($"\n{DateTimeOffset.Now.ToString("hh:mm:ss.fff")} [{process,-25}] {priorityHint,2} {componentName,-26}{message,-45} {sourcePath,-80} {size,7} {att} {targetPath}");
76+
Log.Debug(Format(DateTimeOffset.Now.ToString("hh:mm:ss.fff"), process, priorityHint?.ToString(), componentName, message, sourcePath, att, targetPath));
77+
}
78+
79+
private static string Format(string date, string process, string priorityHint, string componentName, string message, string sourcePath, string attributes, string targetPath)
80+
{
81+
return $"{Environment.NewLine}|{date, -12}| {process,-25}| {priorityHint,-5}| {componentName,-26}| {message,-45}| {sourcePath,-80}| {attributes, -22}| {targetPath}";
82+
}
83+
84+
public static void PrintHeader(ILog logger)
85+
{
86+
logger.Info(Format("Time", "Process Name", "Prty", "Component", "Operation", "Source Path", "Attributes", "Target Path"));
87+
logger.Info(Format("----", "------------", "----", "---------", "---------", "-----------", "----------", "-----------"));
8188
}
8289
}
8390
}

Windows/Common/Registrar.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ public static class Registrar
2222
/// <param name="path">A root folder of your user file system. Your file system tree will be located under this folder.</param>
2323
/// <param name="displayName">Human readable display name.</param>
2424
/// <param name="iconPath">Path to the drive ico file.</param>
25-
/// <remarks>Call this method during application installation.</remarks>
25+
/// <remarks>
26+
/// In the case of a packaged installer (msix) call this method during first program start.
27+
/// In the case of a regular installer (msi) call this method during installation.
28+
/// </remarks>
2629
public static async Task RegisterAsync(string syncRootId, string path, string displayName, string iconPath)
2730
{
2831
StorageProviderSyncRootInfo storageInfo = new StorageProviderSyncRootInfo();
@@ -145,8 +148,16 @@ public static async Task<bool> IsRegisteredAsync(string path)
145148
/// </summary>
146149
/// <param name="syncRootId">ID of the sync root.</param>
147150
/// <remarks>
148-
/// Call this method during application ununstall.
151+
/// <para>
152+
/// In the case of a packaged installer (msix) you do not need to call this method.
153+
/// The platform will automatically delete sync root registartion during program uninstall.
154+
/// </para>
155+
/// <para>
156+
/// In the case of a regular installer (msi) call this method during uninstall.
157+
/// </para>
158+
/// <para>
149159
/// All file and folder placeholders are converted into regular files/folders during this call.
160+
/// </para>
150161
/// </remarks>
151162
public static async Task UnregisterAsync(string syncRootId)
152163
{
File renamed without changes.

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public async Task RemoveCustomColumnsAsync(IEnumerable<FileSystemItemPropertyDat
297297
/// Adds or updates custom columns data, preserving existing columns.
298298
/// </summary>
299299
/// <param name="customColumnsData">List of columns to add or update.</param>
300-
public async Task SetCustomColumnsAsync(IEnumerable<FileSystemItemPropertyData> customColumnsData)
300+
private async Task SetCustomColumnsAsync(IEnumerable<FileSystemItemPropertyData> customColumnsData)
301301
{
302302
// All cutom columns must be set togather, otherwise columns data will be wiped.
303303

@@ -525,5 +525,23 @@ private void DeleteCustomColumns()
525525
File.Delete(customColumnsFilePath);
526526
}
527527
}
528+
529+
public async Task SetCustomDataAsync(string eTag, bool? locked, IEnumerable<FileSystemItemPropertyData> customColumnsData)
530+
{
531+
// Setting ETag also marks an item as not new.
532+
533+
// ETags must correspond with a server file/folder, NOT with a client placeholder.
534+
// It should NOT be moved/deleted/updated when a placeholder in the user file system is moved/deleted/updated.
535+
// It should be moved/deleted when a file/folder in the remote storage is moved/deleted.
536+
await ETagManager.SetETagAsync(eTag);
537+
538+
if (locked != null)
539+
{
540+
// Set the read-only attribute and all custom columns data.
541+
bool isLockedByThisUser = await LockManager.IsLockedByThisUserAsync();
542+
await SetLockedByAnotherUserAsync(locked.Value && !isLockedByThisUser);
543+
}
544+
await SetCustomColumnsAsync(customColumnsData);
545+
}
528546
}
529547
}

Windows/Common/Filter/AutoCadFilterHelper.cs renamed to Windows/Common/VirtualDrive/Filter/AutoCadFilterHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace ITHit.FileSystem.Samples.Common.Windows
1313
/// <remarks>
1414
/// AutoCAD lock files (.dwl and .dwl2), are marked as hidden and filtered by the <see cref="FilterHelper.IsHiddenOrTemp"/> method.
1515
/// </remarks>
16-
internal class AutoCadFilterHelper
16+
public class AutoCadFilterHelper
1717
{
1818
/// <summary>
1919
/// Returns true if the file should NOT be synched to the remote storage. False - otherwise.
@@ -48,7 +48,7 @@ private static bool IsAutoCadTemp(string path)
4848
/// system that corresponds to the provided path to AutoCAD file. False - otherwise.
4949
/// </summary>
5050
/// <param name="path">Path to the AutoCAD file.</param>
51-
internal static bool IsAutoCadLocked(string path)
51+
public static bool IsAutoCadLocked(string path)
5252
{
5353
string lockPath = GetLockPathFromAutoCadPath(path);
5454
return lockPath != null;

0 commit comments

Comments
 (0)