Skip to content

Commit

Permalink
v8.1.26224.0-Beta2
Browse files Browse the repository at this point in the history
  • Loading branch information
ITHitBuild committed Mar 12, 2024
1 parent 66a0152 commit f5b8996
Show file tree
Hide file tree
Showing 84 changed files with 2,256 additions and 1,083 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="8.0.26019.0-Beta" />
<PackageReference Include="ITHit.FileSystem" Version="8.0.26019.0-Beta" />
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.1.26224.0-Beta2" />
<PackageReference Include="ITHit.FileSystem" Version="8.1.26224.0-Beta2" />
</ItemGroup>
</Project>
9 changes: 7 additions & 2 deletions Common/CustomColumnIds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ public enum CustomColumnIds
LockExpirationDate = 5,

/// <summary>
/// ETag column ID.
/// Content ETag column ID.
/// </summary>
ETag = 6,
ContentETag = 6,

/// <summary>
/// Metadata ETag column ID.
/// </summary>
MetadataETag = 7,
}
}
3 changes: 3 additions & 0 deletions Common/FileMetadataExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ public class FileMetadataExt : FileSystemItemMetadataExt, IFileMetadata
{
///<inheritdoc/>
public long Length { get; set; }

///<inheritdoc/>
public string ContentETag { get; set; }
}
}
40 changes: 2 additions & 38 deletions Common/FileSystemItemMetadataExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,13 @@ namespace ITHit.FileSystem.Samples.Common
{
/// <summary>
/// Represents a basic information about the file or the folder in the user file system.
/// In addition to the properties provided by <see cref="IFileSystemItemMetadata"/> provides <see cref="Lock"/> property.
/// </summary>
public class FileSystemItemMetadataExt : IFileSystemItemMetadata
public class FileSystemItemMetadataExt : FileSystemItemMetadata
{
/// <inheritdoc/>
public byte[] RemoteStorageItemId { get; set; }

/// <inheritdoc/>
public byte[] RemoteStorageParentItemId { get; set; }

///<inheritdoc/>
public string Name { get; set; }

///<inheritdoc/>
public FileAttributes Attributes { get; set; }

///<inheritdoc/>
public DateTimeOffset CreationTime { get; set; }

///<inheritdoc/>
public DateTimeOffset LastWriteTime { get; set; }

///<inheritdoc/>
public DateTimeOffset LastAccessTime { get; set; }

///<inheritdoc/>
public DateTimeOffset ChangeTime { get; set; }

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

/// <summary>
/// Lock info or null if the item is not locked.
/// </summary>
public ServerLockInfo Lock { get; set; }

/// <summary>
/// Custom columns data to be displayed in the file manager.
/// </summary>
//public IEnumerable<FileSystemItemPropertyData> CustomProperties { get; set; } = new FileSystemItemPropertyData[] { };

///<inheritdoc/>
public ICustomData Properties { get; set; }
}
}
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,18 @@ Note that these steps are NOT required for development. Sample project provided
</p>
</a>
</li>
<li>
<a class="link-header" href="https://www.userfilesystem.com/examples/ios_deployment/">
<h2>iOS File Provider Extension Projects Deployment</h2>
</a>

<a href="https://www.userfilesystem.com/examples/ios_deployment/">
<p>
To deploy iOS project you will need to create&nbsp;Group ID, App Identifies and Provisioning Profiles.&nbsp;
The project requires a physical device. You can NOT run the project on iOS simulator. You MUST add a device to a devices list.
Unlike with macOS, ALL b <span>...</span>
</p>
</a>
</li>
</ul>

80 changes: 46 additions & 34 deletions Windows/Common/Core/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,42 @@
using log4net;
using ITHit.FileSystem.Windows;
using System.IO;
using System.Collections.Concurrent;
using System.Threading;


namespace ITHit.FileSystem.Samples.Common.Windows
{
/// <summary>
/// Application commands.
/// Commands sent from tray app and comnsole.
/// </summary>
public class Commands
{
/// <summary>
/// Engine instance.
/// </summary>
public EngineWindows Engine;
private readonly EngineWindows Engine;

/// <summary>
/// Remote storage monitor.
/// </summary>
public ISyncService RemoteStorageMonitor;

/// <summary>
/// Log4Net logger.
/// Remote storaage path.
/// </summary>
private readonly ILog log;
private readonly string RemoteStorageRootPath;

/// <summary>
/// Remote storage root path.
/// Log4Net logger.
/// </summary>
private readonly string remoteStorageRootPath;
private readonly ILog log;

public Commands(ILog log, string remoteStorageRootPath)
public Commands(EngineWindows engine, string remoteStorageRootPath, ILog log)
{
this.Engine = engine;
this.RemoteStorageRootPath = remoteStorageRootPath;
this.log = log;
this.remoteStorageRootPath = remoteStorageRootPath;
}

/// <summary>
Expand Down Expand Up @@ -70,7 +73,7 @@ public async Task StartStopSynchronizationAsync()
case SynchronizationState.Disabled:
if (Engine.State != EngineState.Running)
{
Engine.SyncService.Logger.LogError("Failed to start. The Engine must be running.");
Engine.SyncService.Logger.LogError("Failed to start. The Engine must be running.", Engine.Path);
return;
}
await Engine.SyncService.StartAsync();
Expand All @@ -84,11 +87,17 @@ public async Task StartStopSynchronizationAsync()

public async Task StartStopRemoteStorageMonitorAsync()
{
if(RemoteStorageMonitor == null)
{
Engine.Logger.LogError("Remote storage monitor is null.", Engine.Path);
return;
}

if (RemoteStorageMonitor.SyncState == SynchronizationState.Disabled)
{
if (Engine.State != EngineState.Running)
{
log.Error("Failed to start. The Engine must be running.");
Engine.Logger.LogError("Failed to start. The Engine must be running.", Engine.Path);
//Engine.RemoteStorageMonitor.Logger.LogError("Failed to start. The Engine must be running.");
return;
}
Expand All @@ -115,9 +124,9 @@ public static void Open(string path)
}

/// <summary>
/// Open Windows File Manager with user file system.
/// Open root user file system folder in Windows Explorer.
/// </summary>
public async Task OpenFolderAsync()
public async Task OpenRootFolderAsync()
{
Open(Engine.Path);
}
Expand All @@ -127,25 +136,26 @@ public async Task OpenFolderAsync()
/// </summary>
public async Task OpenRemoteStorageAsync()
{
Open(remoteStorageRootPath);
Open(RemoteStorageRootPath);
}

/// <summary>
/// Opens support portal.
/// </summary>
public async Task OpenSupportPortalAsync()
public static async Task OpenSupportPortalAsync()
{
Open("https://www.userfilesystem.com/support/");
}

/// <summary>
/// Called on app exit.
/// </summary>
public async Task AppExitAsync()
public async Task EngineExitAsync()
{
await StopEngineAsync();
log.Info("\n\nAll downloaded file / folder placeholders remain in file system. Restart the application to continue managing files.");
log.Info("\nYou can also edit documents when the app is not running and than start the app to sync all changes to the remote storage.\n");
log.Info($"\n\n{RemoteStorageRootPath}");
log.Info("\nAll downloaded file / folder placeholders remain in file system. Restart the application to continue managing files.");
log.Info("\nYou can edit documents when the app is not running and than start the app to sync all changes to the remote storage.\n");
}

/// <summary>
Expand All @@ -160,47 +170,49 @@ public async Task StopEngineAsync()
}

#if DEBUG

/// <summary>
/// Sets console output defaults.
/// </summary>
public void ConfigureConsole()
{
// Enable UTF8 for Console Window and set width.
Console.OutputEncoding = System.Text.Encoding.UTF8;
Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight / 3);
//Console.SetBufferSize(Console.LargestWindowWidth * 2, short.MaxValue / 2);
}

/// <summary>
/// Opens Windows File Manager with both remote storage and user file system for testing.
/// </summary>
/// <param name="openRemoteStorage">True if the Remote Storage must be opened. False - otherwise.</param>
/// <remarks>This method is provided solely for the development and testing convenience.</remarks>
public void ShowTestEnvironment(bool openRemoteStorage = true)
public void ShowTestEnvironment(string userFileSystemWindowName, bool openRemoteStorage = true, CancellationToken cancellationToken = default)
{
// Open Windows File Manager with user file system.
Commands.Open(Engine.Path);
IntPtr hWndUserFileSystem = WindowManager.FindWindow(userFileSystemWindowName, cancellationToken);
WindowManager.PositionFileSystemWindow(hWndUserFileSystem, 1, 2);

if (openRemoteStorage)
{
// Open remote storage.
Commands.Open(remoteStorageRootPath);
Commands.Open(RemoteStorageRootPath);
string rsWindowName = Path.GetFileName(RemoteStorageRootPath.TrimEnd('\\'));
IntPtr hWndRemoteStorage = WindowManager.FindWindow(rsWindowName, cancellationToken);
WindowManager.PositionFileSystemWindow(hWndRemoteStorage, 0, 2);
}
}

#endif

public void Test()
{
string name = "General.docx";
var n = Engine.ServerNotifications(Path.Combine(Engine.Path, name));
IFileSystemItemMetadata metadata = new FileMetadataExt();
string name = "Notes.txt";
string filePath = Path.Combine(Engine.Path, name);
//FileInfo fi = new FileInfo(filePath);
//fi.IsReadOnly = true;

var n = Engine.ServerNotifications(filePath);
IFileMetadata metadata = new FileMetadata();
metadata.Attributes = FileAttributes.Normal;
metadata.CreationTime = DateTimeOffset.Now;
metadata.LastWriteTime = DateTimeOffset.Now;
metadata.ChangeTime = DateTimeOffset.Now;
metadata.LastAccessTime = DateTimeOffset.Now;
metadata.Name = name;
metadata.MetadataETag = DateTimeOffset.Now.Ticks.ToString();
metadata.ContentETag = null;//"etag1";
n.UpdateAsync(metadata);
}

}
}
5 changes: 3 additions & 2 deletions Windows/Common/Core/Common.Windows.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0-windows10.0.19041.0;net48</TargetFrameworks>
<UseWindowsForms>True</UseWindowsForms>
<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 @@ -20,8 +21,8 @@
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="8.0.26019.0-Beta" />
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.0.26019.0-Beta" />
<PackageReference Include="ITHit.FileSystem.Windows.Package" Version="8.1.26224.0-Beta2" />
<PackageReference Include="ITHit.FileSystem.Windows" Version="8.1.26224.0-Beta2" />
<ProjectReference Include="..\..\..\Common\Common.csproj" />
</ItemGroup>
</Project>
Loading

0 comments on commit f5b8996

Please sign in to comment.