Skip to content

Commit 1b0e419

Browse files
committed
v1.4.4298.0
1 parent 717ab0f commit 1b0e419

File tree

116 files changed

+2268
-0
lines changed

Some content is hidden

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

116 files changed

+2268
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.application-groups</key>
8+
<array>
9+
<string>$(TeamIdentifierPrefix)group.com.ithit.virtualfilesystem</string>
10+
</array>
11+
<key>com.apple.security.files.downloads.read-write</key>
12+
<true/>
13+
<key>com.apple.security.assets.pictures.read-write</key>
14+
<true/>
15+
<key>com.apple.security.assets.music.read-write</key>
16+
<true/>
17+
<key>com.apple.security.assets.movies.read-write</key>
18+
<true/>
19+
<key>com.apple.security.files.user-selected.read-write</key>
20+
<true/>
21+
</dict>
22+
</plist>
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{30EDD98F-A449-4A9F-A718-EE480181C619}</ProjectGuid>
7+
<ProjectTypeGuids>{10CE9E57-9141-4DF0-916A-2C4FD4EE2A73};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
8+
<OutputType>Library</OutputType>
9+
<RootNamespace>FileProviderExtension</RootNamespace>
10+
<AssemblyName>FileProviderExtension</AssemblyName>
11+
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
12+
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
13+
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
14+
<ReleaseVersion>0.5</ReleaseVersion>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug</OutputPath>
21+
<DefineConstants>DEBUG;</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
<EnableCodeSigning>true</EnableCodeSigning>
25+
<CodeSigningKey>Mac Developer</CodeSigningKey>
26+
<CreatePackage>false</CreatePackage>
27+
<EnablePackageSigning>false</EnablePackageSigning>
28+
<IncludeMonoRuntime>false</IncludeMonoRuntime>
29+
<UseSGen>true</UseSGen>
30+
<UseRefCounting>true</UseRefCounting>
31+
<HttpClientHandler></HttpClientHandler>
32+
<LinkMode>None</LinkMode>
33+
<AOTMode>None</AOTMode>
34+
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
35+
<CodeSignProvision>ITHit Profile</CodeSignProvision>
36+
<LangVersion>9.0</LangVersion>
37+
<UseHardenedRuntime>true</UseHardenedRuntime>
38+
<XamMacArch>x86_64</XamMacArch>
39+
</PropertyGroup>
40+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
41+
<DebugType>pdbonly</DebugType>
42+
<Optimize>true</Optimize>
43+
<OutputPath>bin\Release</OutputPath>
44+
<DefineConstants></DefineConstants>
45+
<ErrorReport>prompt</ErrorReport>
46+
<WarningLevel>4</WarningLevel>
47+
<EnableCodeSigning>false</EnableCodeSigning>
48+
<CreatePackage>true</CreatePackage>
49+
<EnablePackageSigning>false</EnablePackageSigning>
50+
<IncludeMonoRuntime>true</IncludeMonoRuntime>
51+
<UseSGen>true</UseSGen>
52+
<UseRefCounting>true</UseRefCounting>
53+
<CodeSignEntitlements>Entitlements.plist</CodeSignEntitlements>
54+
<LinkMode>SdkOnly</LinkMode>
55+
<HttpClientHandler></HttpClientHandler>
56+
<AOTMode>None</AOTMode>
57+
<LangVersion>9.0</LangVersion>
58+
<UseHardenedRuntime>true</UseHardenedRuntime>
59+
</PropertyGroup>
60+
<ItemGroup>
61+
<Reference Include="System" />
62+
<Reference Include="System.Core" />
63+
<Reference Include="Xamarin.Mac" />
64+
<Reference Include="ITHit.FileSystem">
65+
<HintPath>..\packages\ITHit.FileSystem.1.4.4298\lib\netstandard2.1\ITHit.FileSystem.dll</HintPath>
66+
</Reference>
67+
<Reference Include="ITHit.FileSystem.Mac">
68+
<HintPath>..\packages\ITHit.FileSystem.Mac.1.4.4298-Alpha\lib\xamarinmac74\ITHit.FileSystem.Mac.dll</HintPath>
69+
</Reference>
70+
</ItemGroup>
71+
<ItemGroup>
72+
<Folder Include="Resources\" />
73+
</ItemGroup>
74+
<ItemGroup>
75+
<None Include="Info.plist" />
76+
<None Include="Entitlements.plist" />
77+
<None Include="packages.config" />
78+
</ItemGroup>
79+
<ItemGroup>
80+
<Compile Include="VfsFolder.cs" />
81+
<Compile Include="VfsEngine.cs" />
82+
<Compile Include="VfsFile.cs" />
83+
<Compile Include="VfsFileSystemItem.cs" />
84+
<Compile Include="Mapping.cs" />
85+
</ItemGroup>
86+
<ItemGroup>
87+
<ProjectReference Include="..\VirtualFilesystemCommon\VirtualFilesystemCommon.csproj">
88+
<Project>{8A146BCC-DE6F-436F-9C25-67AD964E473F}</Project>
89+
<Name>VirtualFilesystemCommon</Name>
90+
</ProjectReference>
91+
</ItemGroup>
92+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.AppExtension.CSharp.targets" />
93+
</Project>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>FileProviderExtension</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>com.ithit.virtualfilesystem.app.extension</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>FileProviderExtension</string>
15+
<key>CFBundlePackageType</key>
16+
<string>XPC!</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
<key>LSMinimumSystemVersion</key>
24+
<string>10.15</string>
25+
<key>LSUIElement</key>
26+
<true/>
27+
<key>NSExtension</key>
28+
<dict>
29+
<key>NSExtensionAttributes</key>
30+
<dict/>
31+
<key>NSExtensionPointIdentifier</key>
32+
<string>com.apple.fileprovider-nonui</string>
33+
<key>NSExtensionPrincipalClass</key>
34+
<string>VfsEngine</string>
35+
<key>NSExtensionFileProviderSupportsEnumeration</key>
36+
<true/>
37+
</dict>
38+
<key>NSPrincipalClass</key>
39+
<string>NSApplication</string>
40+
</dict>
41+
</plist>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
using System.IO;
2+
using ITHit.FileSystem;
3+
using VirtualFilesystemCommon;
4+
5+
namespace FileProviderExtension
6+
{
7+
/// <summary>
8+
/// Maps a user file system path to the remote storage path and back.
9+
/// </summary>
10+
/// <remarks>You will change methods of this class to map the user file system path to your remote storage path.</remarks>
11+
internal static class Mapping
12+
{
13+
/// <summary>
14+
/// Returns a remote storage URI that corresponds to the user file system path.
15+
/// </summary>
16+
/// <param name="userFileSystemPath">Full path in the user file system.</param>
17+
/// <returns>Remote storage URI that corresponds to the <paramref name="userFileSystemPath"/>.</returns>
18+
public static string MapPath(string userFileSystemPath)
19+
{
20+
// Get path relative to the virtual root.
21+
string relativePath = userFileSystemPath.TrimEnd(Path.DirectorySeparatorChar).Substring(
22+
AppGroupSettings.GetUserRootPath().TrimEnd(Path.DirectorySeparatorChar).Length);
23+
24+
string path = $"{AppGroupSettings.GetRemoteRootPath().TrimEnd(Path.DirectorySeparatorChar)}{relativePath}";
25+
return path;
26+
}
27+
28+
/// <summary>
29+
/// Returns a user file system path that corresponds to the remote storage URI.
30+
/// </summary>
31+
/// <param name="remoteStorageUri">Remote storage URI.</param>
32+
/// <returns>Path in the user file system that corresponds to the <paramref name="remoteStorageUri"/>.</returns>
33+
public static string ReverseMapPath(string remoteStorageUri)
34+
{
35+
// Get path relative to the virtual root.
36+
string relativePath = remoteStorageUri.TrimEnd(Path.DirectorySeparatorChar).Substring(
37+
AppGroupSettings.GetRemoteRootPath().TrimEnd(Path.DirectorySeparatorChar).Length);
38+
39+
string path = $"{AppGroupSettings.GetUserRootPath().TrimEnd(Path.DirectorySeparatorChar)}{relativePath}";
40+
return path;
41+
}
42+
43+
/// <summary>
44+
/// Gets a user file system item info from the remote storage data.
45+
/// </summary>
46+
/// <param name="remoteStorageItem">Remote storage item info.</param>
47+
/// <returns>User file system item info.</returns>
48+
public static IFileSystemItemBasicInfo GetUserFileSysteItemBasicInfo(FileSystemInfo remoteStorageItem)
49+
{
50+
VfsFileSystemItem userFileSystemItem;
51+
52+
if (remoteStorageItem is FileInfo)
53+
{
54+
FileInfo remoteStorageFile = (FileInfo)remoteStorageItem;
55+
userFileSystemItem = new VfsFile(remoteStorageFile.FullName, remoteStorageFile.Attributes, remoteStorageFile.CreationTime,
56+
remoteStorageFile.LastWriteTime, remoteStorageFile.LastAccessTime, remoteStorageFile.Length);
57+
}
58+
else
59+
{
60+
userFileSystemItem = new VfsFolder(remoteStorageItem.FullName, remoteStorageItem.Attributes, remoteStorageItem.CreationTime,
61+
remoteStorageItem.LastWriteTime, remoteStorageItem.LastAccessTime);
62+
}
63+
64+
userFileSystemItem.Name = remoteStorageItem.FullName;
65+
userFileSystemItem.Attributes = remoteStorageItem.Attributes;
66+
userFileSystemItem.CreationTime = remoteStorageItem.CreationTime;
67+
userFileSystemItem.LastWriteTime = remoteStorageItem.LastWriteTime;
68+
userFileSystemItem.LastAccessTime = remoteStorageItem.LastAccessTime;
69+
userFileSystemItem.ChangeTime = remoteStorageItem.LastWriteTime;
70+
71+
// You will send the ETag to
72+
// the server inside If-Match header togeter with updated content from client.
73+
// This will make sure the changes on the server is not overwritten.
74+
//
75+
// In this sample, for the sake of simplicity, we use file last write time instead of ETag.
76+
userFileSystemItem.ETag = remoteStorageItem.LastWriteTime.ToBinary().ToString();
77+
78+
// If the item is locked by another user, set the LockedByAnotherUser to true.
79+
// Here we just use the read-only attribute from remote storage item for demo purposes.
80+
userFileSystemItem.LockedByAnotherUser = (remoteStorageItem.Attributes & FileAttributes.ReadOnly) != 0;
81+
82+
if (remoteStorageItem is FileInfo)
83+
{
84+
((VfsFile)userFileSystemItem).Length = ((FileInfo)remoteStorageItem).Length;
85+
};
86+
87+
return userFileSystemItem;
88+
}
89+
}
90+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using System;
2+
using System.IO;
3+
using System.Threading.Tasks;
4+
using FileProvider;
5+
using Foundation;
6+
using ITHit.FileSystem;
7+
using ITHit.FileSystem.Mac;
8+
using VirtualFilesystemCommon;
9+
10+
namespace FileProviderExtension
11+
{
12+
[Register(nameof(VfsEngine))]
13+
public class VfsEngine : EngineMac
14+
{
15+
[Export("initWithDomain:")]
16+
public VfsEngine(NSFileProviderDomain domain)
17+
: base(domain)
18+
{
19+
License = AppGroupSettings.GetLicense();
20+
}
21+
22+
public override async Task<IFileSystemItem> GetFileSystemItemAsync(string path)
23+
{
24+
string remotePath = Mapping.MapPath(path);
25+
26+
if (File.Exists(remotePath))
27+
{
28+
FileInfo fileInfo = new FileInfo(remotePath);
29+
return new VfsFile(Mapping.ReverseMapPath(fileInfo.FullName), fileInfo.Attributes, fileInfo.CreationTime, fileInfo.LastWriteTime, fileInfo.LastAccessTime, fileInfo.Length);
30+
}
31+
32+
if (Directory.Exists(remotePath))
33+
{
34+
DirectoryInfo dirInfo = new DirectoryInfo(remotePath);
35+
return new VfsFolder(Mapping.ReverseMapPath(dirInfo.FullName), dirInfo.Attributes, dirInfo.CreationTime, dirInfo.LastWriteTime, dirInfo.LastAccessTime);
36+
}
37+
38+
return null;
39+
}
40+
41+
public override void LogError(string message, string sourcePath = null, string targetPath = null, Exception ex = null)
42+
{
43+
throw new NotImplementedException();
44+
}
45+
46+
public override void LogMessage(string message, string sourcePath = null, string targetPath = null)
47+
{
48+
throw new NotImplementedException();
49+
}
50+
51+
public override void RiseError(string message, string sourcePath = null, string targetPath = null, Exception ex = null)
52+
{
53+
throw new NotImplementedException();
54+
}
55+
56+
protected override void Dispose(bool disposing)
57+
{
58+
base.Dispose(disposing);
59+
}
60+
}
61+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System;
2+
using System.IO;
3+
using System.Threading.Tasks;
4+
using ITHit.FileSystem;
5+
6+
namespace FileProviderExtension
7+
{
8+
public class VfsFile : VfsFileSystemItem, IFile, IFileBasicInfo
9+
{
10+
public long Length { get; set; }
11+
12+
public VfsFile(string name, FileAttributes attributes,
13+
DateTimeOffset creationTime, DateTimeOffset lastWriteTime, DateTimeOffset lastAccessTime, long length)
14+
: base(name)
15+
{
16+
Name = name;
17+
Attributes = attributes;
18+
CreationTime = creationTime;
19+
LastWriteTime = lastWriteTime;
20+
LastAccessTime = lastAccessTime;
21+
Length = length;
22+
}
23+
24+
public async Task CloseAsync(IOperationContext operationContext, IResultContext context)
25+
{
26+
throw new NotImplementedException();
27+
}
28+
29+
public async Task DeleteAsync(IOperationContext operationContext, IConfirmationResultContext resultContext)
30+
{
31+
throw new NotImplementedException();
32+
}
33+
34+
public async Task MoveToAsync(string targetPath, IOperationContext operationContext, IConfirmationResultContext resultContext)
35+
{
36+
throw new NotImplementedException();
37+
}
38+
39+
public async Task OpenAsync(IOperationContext operationContext, IResultContext context)
40+
{
41+
throw new NotImplementedException();
42+
}
43+
44+
public async Task TransferDataAsync(long offset, long length, ITransferDataOperationContext operationContext, ITransferDataResultContext resultContext)
45+
{
46+
throw new NotImplementedException();
47+
}
48+
49+
public async Task ValidateDataAsync(long offset, long length, IValidateDataOperationContext operationContext, IValidateDataResultContext resultContext)
50+
{
51+
throw new NotImplementedException();
52+
}
53+
}
54+
}

0 commit comments

Comments
 (0)