Skip to content

Commit 66a0152

Browse files
committed
v8.0.26019.0-Beta
1 parent 4652635 commit 66a0152

File tree

83 files changed

+1584
-1235
lines changed

Some content is hidden

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

83 files changed

+1584
-1235
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="7.3.24116.0" />
14-
<PackageReference Include="ITHit.FileSystem" Version="7.3.24116.0" />
13+
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.0.26019.0-Beta" />
14+
<PackageReference Include="ITHit.FileSystem" Version="8.0.26019.0-Beta" />
1515
</ItemGroup>
1616
</Project>

Common/FileSystemItemMetadataExt.cs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
using ITHit.FileSystem;
2-
using ITHit.FileSystem.Synchronization;
31
using System;
4-
using System.Collections.Generic;
52
using System.IO;
6-
using System.Text;
7-
using System.Threading.Tasks;
3+
4+
using ITHit.FileSystem;
5+
using ITHit.FileSystem.Synchronization;
6+
87

98
namespace ITHit.FileSystem.Samples.Common
109
{
1110
/// <summary>
1211
/// Represents a basic information about the file or the folder in the user file system.
13-
/// In addition to properties provided by <see cref="IFileSystemItem"/> this class contains
14-
/// <see cref="ETag"/> and <see cref="Lock"/> properties.
1512
/// </summary>
16-
public class FileSystemItemMetadataExt : IFileSystemItemMetadata, IChangedItem
13+
public class FileSystemItemMetadataExt : IFileSystemItemMetadata
1714
{
1815
/// <inheritdoc/>
1916
public byte[] RemoteStorageItemId { get; set; }
@@ -52,16 +49,7 @@ public class FileSystemItemMetadataExt : IFileSystemItemMetadata, IChangedItem
5249
/// <summary>
5350
/// Custom columns data to be displayed in the file manager.
5451
/// </summary>
55-
public IEnumerable<FileSystemItemPropertyData> CustomProperties { get; set; } = new FileSystemItemPropertyData[] { };
56-
57-
///<inheritdoc/>
58-
public Change ChangeType { get; set; }
59-
60-
///<inheritdoc/>
61-
public Func<Task> BeforeAction { get; set; }
62-
63-
///<inheritdoc/>
64-
public Func<Task> AfterAction { get; set; }
52+
//public IEnumerable<FileSystemItemPropertyData> CustomProperties { get; set; } = new FileSystemItemPropertyData[] { };
6553

6654
///<inheritdoc/>
6755
public ICustomData Properties { get; set; }

Common/ServerLockInfo.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
using ITHit.FileSystem.Windows;
21
using System;
3-
using System.Collections.Generic;
4-
using System.Text;
2+
53

64
namespace ITHit.FileSystem.Samples.Common
75
{
@@ -35,7 +33,7 @@ public class ServerLockInfo
3533
/// </summary>
3634
/// <remarks>
3735
/// If the item is locked by this user on this machine the value of this property indicates automatic or manual lock.
38-
/// If the item is locked by other user or locked by this user on other machine contains <see cref="LockMode.None"/> value.
36+
/// If the item is locked by other user or locked by this user on other machine, it contains <see cref="LockMode.None"/> value.
3937
/// </remarks>
4038
public LockMode Mode { get; set; } = LockMode.None;
4139
}

Windows/Common/Core/Commands.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
using log4net;
99
using ITHit.FileSystem.Windows;
10+
using System.IO;
1011

1112

1213
namespace ITHit.FileSystem.Samples.Common.Windows
@@ -188,5 +189,18 @@ public void ShowTestEnvironment(bool openRemoteStorage = true)
188189
}
189190
}
190191
#endif
192+
public void Test()
193+
{
194+
string name = "General.docx";
195+
var n = Engine.ServerNotifications(Path.Combine(Engine.Path, name));
196+
IFileSystemItemMetadata metadata = new FileMetadataExt();
197+
metadata.Attributes = FileAttributes.Normal;
198+
metadata.CreationTime = DateTimeOffset.Now;
199+
metadata.LastWriteTime = DateTimeOffset.Now;
200+
metadata.ChangeTime = DateTimeOffset.Now;
201+
metadata.LastAccessTime = DateTimeOffset.Now;
202+
metadata.Name = name;
203+
n.UpdateAsync(metadata);
204+
}
191205
}
192206
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
2121
</ItemGroup>
2222
<ItemGroup>
23-
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="7.3.24116.0" />
24-
<PackageReference Include="ITHit.FileSystem.Windows" Version="7.3.24116.0" />
23+
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="8.0.26019.0-Beta" />
24+
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.0.26019.0-Beta" />
2525
<ProjectReference Include="..\..\..\Common\Common.csproj" />
2626
</ItemGroup>
2727
</Project>

Windows/Common/Core/ConsoleProcessor.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ public async Task ProcessUserInputAsync()
6161

6262
switch (keyInfo.Key)
6363
{
64+
case ConsoleKey.X:
65+
commands.Test();
66+
break;
67+
6468
case ConsoleKey.F1:
6569
case ConsoleKey.H:
6670
// Print help info.

Windows/Common/Core/LogFormatter.cs

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -185,24 +185,35 @@ public void LogDebug(IEngine sender, EngineMessageEventArgs e)
185185
/// <param name="level">Log level.</param>
186186
private void WriteLog(IEngine sender, EngineMessageEventArgs e, log4net.Core.Level level)
187187
{
188-
string att = GetAttString(e.TargetPath ?? e.SourcePath);
188+
string attSource = GetAttString(e.SourcePath);
189+
string attTarget = GetAttString(e.TargetPath);
190+
189191
string process = null;
190192
byte? priorityHint = null;
191193
string fileId = null;
192194
string size = null;
193195

194196
if (e.OperationContext != null)
195197
{
196-
process = System.IO.Path.GetFileName(e.OperationContext.ProcessInfo?.ImagePath);
197-
priorityHint = e.OperationContext.PriorityHint;
198-
fileId = (e.OperationContext as IWindowsOperationContext).FileId.ToString();
199-
size = FormatBytes((e.OperationContext as IWindowsOperationContext).FileSize);
198+
process = System.IO.Path.GetFileName(e.OperationContext?.ProcessInfo?.ImagePath);
199+
priorityHint = e.OperationContext?.PriorityHint;
200+
IWindowsOperationContext ocWin = e.OperationContext as IWindowsOperationContext;
201+
if (ocWin != null)
202+
{
203+
fileId = ocWin.FileId.ToString();
204+
size = FormatBytes((e.OperationContext as IWindowsOperationContext).FileSize);
205+
}
200206
}
201207

202208
string sourcePath = e.SourcePath?.FitString(sourcePathWidth, 6);
203209
string targetPath = e.TargetPath?.FitString(sourcePathWidth, 6);
204210

205-
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, att, targetPath);
211+
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);
212+
if (targetPath!=null)
213+
{
214+
// For move operation output target path in the next line.
215+
message += Format(null, null, null, null, null, null, null, null, null, null, targetPath, attTarget);
216+
}
206217

207218
if (level == log4net.Core.Level.Error)
208219
{
@@ -224,10 +235,10 @@ private void WriteLog(IEngine sender, EngineMessageEventArgs e, log4net.Core.Lev
224235

225236
}
226237

227-
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 sourcePath, string attributes, string targetPath)
238+
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)
228239
{
229240
// {fileId,-18} | {remoteStorageId,-remoteStorageIdWidth}
230-
return $"{Environment.NewLine}|{date,-12}| {process,-25}| {priorityHint,-5}| {componentName,-26}| {callerLineNumber,4} | {message,-45}| {sourcePath,-sourcePathWidth} | {attributes,10} | {targetPath}";
241+
return $"{Environment.NewLine}|{date,-12}| {process,-25}| {componentName,-26}| {message,-45}| {path,-sourcePathWidth} | {attributes,10}";
231242
}
232243

233244
/// <summary>
@@ -236,8 +247,8 @@ private static string Format(string date, string process, string priorityHint, s
236247
private void PrintHeader()
237248
{
238249
log.Info("\n");
239-
log.Info(Format("Time", "Process Name", "Prty", "FS ID", "RS ID", "Component", "Line", "Caller Member Name", "Caller File Path", "Message", "Source Path", "Attributes", "Target Path"));
240-
log.Info(Format("----", "------------", "----", "_____", "_____", "---------", "____", "------------------", "----------------", "-------", "-----------", "----------", "-----------"));
250+
log.Info(Format("Time", "Process Name", "Prty", "FS ID", "RS ID", "Component", "Line", "Caller Member Name", "Caller File Path", "Message", "Path", "Attributes"));
251+
log.Info(Format("----", "------------", "----", "_____", "_____", "---------", "____", "------------------", "----------------", "-------", "----", "----------"));
241252
}
242253

243254
/// <summary>
@@ -247,14 +258,15 @@ private void PrintHeader()
247258
/// <returns>String that represents file or folder attributes or null if the file/folder is not found.</returns>
248259
public static string GetAttString(string path)
249260
{
261+
if (path == null)
262+
return null;
263+
250264
if (WindowsFileSystemItem.TryGetAttributes(path, out System.IO.FileAttributes? attributes))
251265
{
252266
return WindowsFileSystemItem.GetFileAttributesString(attributes.Value);
253267
}
254-
else
255-
{
256-
return null;
257-
}
268+
269+
return null;
258270
}
259271

260272
/// <summary>

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net7.0-windows10.0.19041.0;net48</TargetFrameworks>
3+
<TargetFrameworks>net7.0-windows10.0.19041.0</TargetFrameworks>
44
<Description>Contains functionality common for all Windows Virtual Drive samples.</Description>
55
<Authors>IT Hit LTD.</Authors>
66
<Product>IT Hit User File System</Product>
@@ -13,7 +13,8 @@
1313
<Compile Remove="IVirtualFolder.cs" />
1414
</ItemGroup>
1515
<ItemGroup>
16-
<PackageReference Include="ITHit.FileSystem.Windows" Version="7.3.24116.0" />
16+
<PackageReference Include="ITHit.FileSystem.Windows.AppHelper" Version="8.0.26019.0-Beta" />
17+
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.0.26019.0-Beta" />
1718
<ProjectReference Include="..\..\..\Common\Common.csproj" />
1819
<ProjectReference Include="..\Core\Common.Windows.Core.csproj" />
1920
</ItemGroup>

0 commit comments

Comments
 (0)