Skip to content

Commit

Permalink
v8.0.26019.0-Beta
Browse files Browse the repository at this point in the history
  • Loading branch information
ITHitBuild committed Feb 8, 2024
1 parent 4652635 commit 66a0152
Show file tree
Hide file tree
Showing 83 changed files with 1,584 additions and 1,235 deletions.
4 changes: 2 additions & 2 deletions Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem.Windows" Version="7.3.24116.0" />
<PackageReference Include="ITHit.FileSystem" Version="7.3.24116.0" />
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.0.26019.0-Beta" />
<PackageReference Include="ITHit.FileSystem" Version="8.0.26019.0-Beta" />
</ItemGroup>
</Project>
24 changes: 6 additions & 18 deletions Common/FileSystemItemMetadataExt.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
using ITHit.FileSystem;
using ITHit.FileSystem.Synchronization;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;

using ITHit.FileSystem;
using ITHit.FileSystem.Synchronization;


namespace ITHit.FileSystem.Samples.Common
{
/// <summary>
/// Represents a basic information about the file or the folder in the user file system.
/// In addition to properties provided by <see cref="IFileSystemItem"/> this class contains
/// <see cref="ETag"/> and <see cref="Lock"/> properties.
/// </summary>
public class FileSystemItemMetadataExt : IFileSystemItemMetadata, IChangedItem
public class FileSystemItemMetadataExt : IFileSystemItemMetadata
{
/// <inheritdoc/>
public byte[] RemoteStorageItemId { get; set; }
Expand Down Expand Up @@ -52,16 +49,7 @@ public class FileSystemItemMetadataExt : IFileSystemItemMetadata, IChangedItem
/// <summary>
/// Custom columns data to be displayed in the file manager.
/// </summary>
public IEnumerable<FileSystemItemPropertyData> CustomProperties { get; set; } = new FileSystemItemPropertyData[] { };

///<inheritdoc/>
public Change ChangeType { get; set; }

///<inheritdoc/>
public Func<Task> BeforeAction { get; set; }

///<inheritdoc/>
public Func<Task> AfterAction { get; set; }
//public IEnumerable<FileSystemItemPropertyData> CustomProperties { get; set; } = new FileSystemItemPropertyData[] { };

///<inheritdoc/>
public ICustomData Properties { get; set; }
Expand Down
6 changes: 2 additions & 4 deletions Common/ServerLockInfo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using ITHit.FileSystem.Windows;
using System;
using System.Collections.Generic;
using System.Text;


namespace ITHit.FileSystem.Samples.Common
{
Expand Down Expand Up @@ -35,7 +33,7 @@ public class ServerLockInfo
/// </summary>
/// <remarks>
/// If the item is locked by this user on this machine the value of this property indicates automatic or manual lock.
/// If the item is locked by other user or locked by this user on other machine contains <see cref="LockMode.None"/> value.
/// If the item is locked by other user or locked by this user on other machine, it contains <see cref="LockMode.None"/> value.
/// </remarks>
public LockMode Mode { get; set; } = LockMode.None;
}
Expand Down
14 changes: 14 additions & 0 deletions Windows/Common/Core/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

using log4net;
using ITHit.FileSystem.Windows;
using System.IO;


namespace ITHit.FileSystem.Samples.Common.Windows
Expand Down Expand Up @@ -188,5 +189,18 @@ public void ShowTestEnvironment(bool openRemoteStorage = true)
}
}
#endif
public void Test()
{
string name = "General.docx";
var n = Engine.ServerNotifications(Path.Combine(Engine.Path, name));
IFileSystemItemMetadata metadata = new FileMetadataExt();
metadata.Attributes = FileAttributes.Normal;
metadata.CreationTime = DateTimeOffset.Now;
metadata.LastWriteTime = DateTimeOffset.Now;
metadata.ChangeTime = DateTimeOffset.Now;
metadata.LastAccessTime = DateTimeOffset.Now;
metadata.Name = name;
n.UpdateAsync(metadata);
}
}
}
4 changes: 2 additions & 2 deletions Windows/Common/Core/Common.Windows.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="7.3.24116.0" />
<PackageReference Include="ITHit.FileSystem.Windows" Version="7.3.24116.0" />
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="8.0.26019.0-Beta" />
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.0.26019.0-Beta" />
<ProjectReference Include="..\..\..\Common\Common.csproj" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions Windows/Common/Core/ConsoleProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public async Task ProcessUserInputAsync()

switch (keyInfo.Key)
{
case ConsoleKey.X:
commands.Test();
break;

case ConsoleKey.F1:
case ConsoleKey.H:
// Print help info.
Expand Down
40 changes: 26 additions & 14 deletions Windows/Common/Core/LogFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,24 +185,35 @@ public void LogDebug(IEngine sender, EngineMessageEventArgs e)
/// <param name="level">Log level.</param>
private void WriteLog(IEngine sender, EngineMessageEventArgs e, log4net.Core.Level level)
{
string att = GetAttString(e.TargetPath ?? e.SourcePath);
string attSource = GetAttString(e.SourcePath);
string attTarget = GetAttString(e.TargetPath);

string process = null;
byte? priorityHint = null;
string fileId = null;
string size = null;

if (e.OperationContext != null)
{
process = System.IO.Path.GetFileName(e.OperationContext.ProcessInfo?.ImagePath);
priorityHint = e.OperationContext.PriorityHint;
fileId = (e.OperationContext as IWindowsOperationContext).FileId.ToString();
size = FormatBytes((e.OperationContext as IWindowsOperationContext).FileSize);
process = System.IO.Path.GetFileName(e.OperationContext?.ProcessInfo?.ImagePath);
priorityHint = e.OperationContext?.PriorityHint;
IWindowsOperationContext ocWin = e.OperationContext as IWindowsOperationContext;
if (ocWin != null)
{
fileId = ocWin.FileId.ToString();
size = FormatBytes((e.OperationContext as IWindowsOperationContext).FileSize);
}
}

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

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);
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);
if (targetPath!=null)
{
// For move operation output target path in the next line.
message += Format(null, null, null, null, null, null, null, null, null, null, targetPath, attTarget);
}

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

}

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

/// <summary>
Expand All @@ -236,8 +247,8 @@ private static string Format(string date, string process, string priorityHint, s
private void PrintHeader()
{
log.Info("\n");
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"));
log.Info(Format("----", "------------", "----", "_____", "_____", "---------", "____", "------------------", "----------------", "-------", "-----------", "----------", "-----------"));
log.Info(Format("Time", "Process Name", "Prty", "FS ID", "RS ID", "Component", "Line", "Caller Member Name", "Caller File Path", "Message", "Path", "Attributes"));
log.Info(Format("----", "------------", "----", "_____", "_____", "---------", "____", "------------------", "----------------", "-------", "----", "----------"));
}

/// <summary>
Expand All @@ -247,14 +258,15 @@ private void PrintHeader()
/// <returns>String that represents file or folder attributes or null if the file/folder is not found.</returns>
public static string GetAttString(string path)
{
if (path == null)
return null;

if (WindowsFileSystemItem.TryGetAttributes(path, out System.IO.FileAttributes? attributes))
{
return WindowsFileSystemItem.GetFileAttributesString(attributes.Value);
}
else
{
return null;
}

return null;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0-windows10.0.19041.0;net48</TargetFrameworks>
<TargetFrameworks>net7.0-windows10.0.19041.0</TargetFrameworks>
<Description>Contains functionality common for all Windows Virtual Drive samples.</Description>
<Authors>IT Hit LTD.</Authors>
<Product>IT Hit User File System</Product>
Expand All @@ -13,7 +13,8 @@
<Compile Remove="IVirtualFolder.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem.Windows" Version="7.3.24116.0" />
<PackageReference Include="ITHit.FileSystem.Windows.AppHelper" Version="8.0.26019.0-Beta" />
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.0.26019.0-Beta" />
<ProjectReference Include="..\..\..\Common\Common.csproj" />
<ProjectReference Include="..\Core\Common.Windows.Core.csproj" />
</ItemGroup>
Expand Down
Loading

0 comments on commit 66a0152

Please sign in to comment.