Skip to content

Commit

Permalink
v4.1.12172.0-Beta2
Browse files Browse the repository at this point in the history
  • Loading branch information
ITHitBuild committed Feb 22, 2022
1 parent e9de969 commit 0da32b8
Show file tree
Hide file tree
Showing 90 changed files with 1,830 additions and 1,601 deletions.
2 changes: 1 addition & 1 deletion Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<RootNamespace>ITHit.FileSystem.Samples.Common</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem" Version="4.0.11399.0-Beta" />
<PackageReference Include="ITHit.FileSystem" Version="4.1.12172.0-Beta2" />
</ItemGroup>
</Project>
15 changes: 7 additions & 8 deletions Common/FileSystemItemMetadataExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace ITHit.FileSystem.Samples.Common
public class FileSystemItemMetadataExt : IFileSystemItemMetadata
{
/// <inheritdoc/>
public byte[] ItemId { get; set; }
public byte[] RemoteStorageItemId { get; set; }

///<inheritdoc/>
public string Name { get; set; }
Expand All @@ -37,14 +37,13 @@ public class FileSystemItemMetadataExt : IFileSystemItemMetadata
public DateTimeOffset ChangeTime { get; set; }

/// <summary>
/// Server ETag.
/// Lock info.
/// </summary>
public string ETag { get; set; }

/// <summary>
/// Indicates if the item is locked in the remote storage.
/// </summary>
public bool IsLocked { get; set; } = false;
/// <remarks>
/// If the item is locked, this property contains info about the lock.
/// It is set to null otherwise.
/// </remarks>
public ServerLockInfo Lock { get; set; }

/// <summary>
/// Custom columns data to be displayed in the file manager.
Expand Down
32 changes: 32 additions & 0 deletions Common/ServerLockInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace ITHit.FileSystem.Samples.Common
{
/// <summary>
/// Information about the lock returned from the remote storage as a result of the lock operation.
/// </summary>
public class ServerLockInfo
{
/// <summary>
/// Lock-token. Must be supplied during the item update and unlock operations.
/// </summary>
public string LockToken { get; set; }

/// <summary>
/// Lock expidation date/time returned by the server.
/// </summary>
public DateTimeOffset LockExpirationDateUtc { get; set; }

/// <summary>
/// Name of the user that locked the item.
/// </summary>
public string Owner { get; set; }

/// <summary>
/// True if the item is locked exclusively. False in case the item has a shared lock.
/// </summary>
public bool Exclusive { get; set; } = true;
}
}
7 changes: 1 addition & 6 deletions Common/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,10 @@ public class Settings
public string ProductName { get; set; }

/// <summary>
/// Automatically lock the file in remote storage when a file handle is being opened for writing, unlock on close.
/// Automatically lock the file in the remote storage when a file handle is being opened for writing, unlock on close.
/// </summary>
public bool AutoLock { get; set; }

/// <summary>
/// Path to the folder that stores custom data associated with files and folders.
/// </summary>
public string ServerDataFolderPath { get; set; }

/// <summary>
/// Communication channel name is used by RPC to establish connection over named pipes.
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion Windows/Common/Core/Common.Windows.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
<Product>IT Hit User File System</Product>
<Copyright>IT Hit LTD.</Copyright>
<RootNamespace>ITHit.FileSystem.Samples.Common.Windows.Core</RootNamespace>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.13" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem.Windows" Version="4.0.11399.0-Beta" />
<PackageReference Include="ITHit.FileSystem.Windows" Version="4.1.12172.0-Beta2" />
<ProjectReference Include="..\..\..\Common\Common.csproj" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions Windows/Common/Core/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace ITHit.FileSystem.Samples.Common.Windows
{
/// <summary>
/// Implements unified logging.
/// Implements logging.
/// </summary>
public class Logger : ILogger
{
Expand Down Expand Up @@ -42,7 +42,7 @@ public void LogError(string message, string sourcePath = null, string targetPath
string att = FsPath.Exists(sourcePath) ? FsPath.GetAttString(sourcePath) : null;
string process = null;
byte? priorityHint = null;
long? clientFileId = null;
ulong? clientFileId = null;

if (operationContext != null)
{
Expand All @@ -61,7 +61,7 @@ public void LogMessage(string message, string sourcePath = null, string targetPa
string att = FsPath.Exists(sourcePath) ? FsPath.GetAttString(sourcePath) : null;
string process = null;
byte? priorityHint = null;
long? clientFileId = null;
ulong? clientFileId = null;
string size = null;

if (operationContext != null)
Expand Down
2 changes: 1 addition & 1 deletion Windows/Common/Core/Registrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static async Task RegisterAsync(string syncRootId, string path, string di


// Adds columns to Windows File Manager.
// Show/hide columns in the "More..." context menu on the columns header.
// Show/hide columns in the "More..." context menu on the columns header in Windows Explorer.
var proDefinitions = storageInfo.StorageProviderItemPropertyDefinitions;
proDefinitions.Add(new StorageProviderItemPropertyDefinition { DisplayNameResource = "Lock Owner" , Id = (int)CustomColumnIds.LockOwnerIcon });
proDefinitions.Add(new StorageProviderItemPropertyDefinition { DisplayNameResource = "Lock Scope" , Id = (int)CustomColumnIds.LockScope });
Expand Down
1 change: 1 addition & 0 deletions Windows/Common/Rpc.Proto/Common.Windows.Rpc.Proto.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<Product>IT Hit User File System</Product>
<Copyright>IT Hit LTD.</Copyright>
<RootNamespace>ITHit.FileSystem.Samples.Common.Windows.Rpc.Proto</RootNamespace>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down
32 changes: 32 additions & 0 deletions Windows/Common/Rpc.Proto/ShellExtension.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ service ShellExtensionRpc {
rpc SetLockStatus (ItemsStatusList) returns (EmptyMessage) {}
rpc GetLockStatus (ItemsPathList) returns (ItemsStatusList) {}
rpc GetThumbnail (ThumbnailRequest) returns (Thumbnail) {}
rpc LogMessage (LogMessageRequest) returns (EmptyMessage) {}
rpc LogError (LogErrorRequest) returns (EmptyMessage) {}
rpc GetItemProperties (ItemPropertyRequest) returns (ItemsPropertyList) {}
}

message ItemsPathList {
Expand All @@ -25,5 +28,34 @@ message Thumbnail {
bytes image = 1;
}

message LogMessageRequest {
string componentName = 1;
string message = 2;
string sourcePath = 3;
string targetPath = 4;
}

message LogErrorRequest {
string componentName = 1;
string message = 2;
string sourcePath = 3;
string targetPath = 4;
string exSerialized = 5;
}

message EmptyMessage {
}

message ItemProperty {
string iconResource = 1;
int32 id = 2;
string value = 3;
}

message ItemsPropertyList {
repeated ItemProperty properties = 1;
}

message ItemPropertyRequest {
string path = 1;
}
1 change: 1 addition & 0 deletions Windows/Common/Rpc/Common.Windows.Rpc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Product>IT Hit User File System</Product>
<Copyright>IT Hit LTD.</Copyright>
<RootNamespace>ITHit.FileSystem.Samples.Common.Windows.Rpc</RootNamespace>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.13" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Product>IT Hit User File System</Product>
<Copyright>IT Hit LTD.</Copyright>
<RootNamespace>ITHit.FileSystem.Samples.Common.Windows.ShellExtension</RootNamespace>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<Compile Remove="ThumbnailProviderCommon.cs" />
Expand All @@ -19,7 +20,7 @@
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem.Windows" Version="4.0.11399.0-Beta" />
<PackageReference Include="ITHit.FileSystem.Windows" Version="4.1.12172.0-Beta2" />
<ProjectReference Include="..\..\..\Common\Common.csproj" />
<ProjectReference Include="..\Rpc.Proto\Common.Windows.Rpc.Proto.csproj" />
<ProjectReference Include="..\Rpc\Common.Windows.Rpc.csproj" />
Expand Down
24 changes: 13 additions & 11 deletions Windows/Common/ShellExtension/ContextMenusProviderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using System.IO;
using log4net;
using ITHit.FileSystem.Samples.Common.Windows.ShellExtension.Interop;
using ITHit.FileSystem.Samples.Common.Windows.Rpc;
using ITHit.FileSystem.Samples.Common.Windows.Rpc.Generated;
using System.Xml.Serialization;

namespace ITHit.FileSystem.Samples.Common.Windows.ShellExtension
{
Expand Down Expand Up @@ -37,7 +40,7 @@ public abstract class ContextMenusProviderBase : IExplorerCommand
/// <param name="filesPath">List of selected items.</param>
public abstract Task<string> GetIconAsync(IEnumerable<string> filesPath);

protected ILog Log { get; }
protected ILogger Log { get; }

/// <summary>
/// Creates instance of this class.
Expand All @@ -46,7 +49,7 @@ public ContextMenusProviderBase()
{
ReferenceManager.AddObjectReference();

Log = ShellExtensionConfiguration.GetLogger("ContextMenus.log");
Log = new GrpcLogger("Context Menu Provider");
}

~ContextMenusProviderBase()
Expand All @@ -65,7 +68,7 @@ public int GetTitle(IShellItemArray itemArray, out string title)
if (!files.Any() || !files.All(File.Exists))
return WinError.E_NOTIMPL;

Log.Info($"\nGetting menu title for {string.Join(",", files)}");
Log.LogMessage($"{nameof(ContextMenusProviderBase)}.{nameof(GetTitle)}()", string.Join(", ", files));

title = GetMenuTitleAsync(files).GetAwaiter().GetResult();

Expand All @@ -80,7 +83,7 @@ public int GetTitle(IShellItemArray itemArray, out string title)
}
catch (Exception ex)
{
Log.Error(ex);
Log.LogError("", null, null, ex);
return WinError.E_FAIL;
}
}
Expand All @@ -94,7 +97,7 @@ public int Invoke(IShellItemArray itemArray, object bindCtx)
if (!files.Any() || !files.All(File.Exists))
return WinError.E_NOTIMPL;

Log.Info($"\nInvoke menu command for {string.Join(",", files)}");
Log.LogMessage($"{nameof(ContextMenusProviderBase)}.{nameof(Invoke)}()", string.Join(", ", files));

InvokeMenuCommandAsync(files).GetAwaiter().GetResult();

Expand All @@ -106,7 +109,7 @@ public int Invoke(IShellItemArray itemArray, object bindCtx)
}
catch (Exception ex)
{
Log.Error(ex);
Log.LogError("", null, null, ex);
return WinError.E_FAIL;
}
}
Expand All @@ -129,7 +132,7 @@ public int GetState(IShellItemArray itemArray, bool okToBeSlow, out EXPCMDSTATE
return WinError.E_NOTIMPL;
}

Log.Info($"\nGetting menu state for {string.Join(",", files)}");
Log.LogMessage($"{nameof(ContextMenusProviderBase)}.{nameof(GetState)}()", string.Join(", ", files));

commandState = GetMenuStateAsync(files).GetAwaiter().GetResult();

Expand All @@ -141,7 +144,7 @@ public int GetState(IShellItemArray itemArray, bool okToBeSlow, out EXPCMDSTATE
}
catch (Exception ex)
{
Log.Error(ex);
Log.LogError("", null, null, ex);
return WinError.E_FAIL;
}
}
Expand All @@ -164,7 +167,7 @@ public int GetIcon(IShellItemArray itemArray, out string resourceString)
if (!files.Any() || !files.All(File.Exists))
return WinError.E_NOTIMPL;

Log.Info($"\nGetting menu icon for {string.Join(",", files)}");
Log.LogMessage($"{nameof(ContextMenusProviderBase)}.{nameof(GetIcon)}()", string.Join(", ", files));

resourceString = GetIconAsync(files).GetAwaiter().GetResult();

Expand All @@ -179,7 +182,7 @@ public int GetIcon(IShellItemArray itemArray, out string resourceString)
}
catch (Exception ex)
{
Log.Error(ex);
Log.LogError("", null, null, ex);
return WinError.E_FAIL;
}
}
Expand All @@ -204,6 +207,5 @@ public int EnumSubCommands(out IEnumExplorerCommand commandEnum)
commandEnum = null;
return WinError.E_NOTIMPL;
}

}
}
Loading

0 comments on commit 0da32b8

Please sign in to comment.