我正在使用存储提供程序和 Windows Cloud Files API 创建文件系统。我想避免在 Windows 文件管理器中显示同步根目录:
这里是我用来注册同步根的代码:
string path = "C:\\Users\\User1\\DAV\\";
StorageProviderSyncRootInfo storageInfo = new StorageProviderSyncRootInfo();
storageInfo.Path = await StorageFolder.GetFolderFromPathAsync(path);
storageInfo.Id = syncRootId;
storageInfo.DisplayNameResource = "WebDAV Drive";
storageInfo.IconResource = "C:\\Drive.ico";
storageInfo.Version = "1.0"
storageInfo.RecycleBinUri = new Uri("https://userfilesystem.com/recyclebin");
storageInfo.Context = CryptographicBuffer.ConvertStringToBinary(path, BinaryStringEncoding.Utf8);
storageInfo.HydrationPolicy = StorageProviderHydrationPolicy.Progressive;
storageInfo.HydrationPolicyModifier = StorageProviderHydrationPolicyModifier.AutoDehydrationAllowed | StorageProviderHydrationPolicyModifier.ValidationRequired;
storageInfo.PopulationPolicy = StorageProviderPopulationPolicy.Full;
storageInfo.InSyncPolicy =
StorageProviderInSyncPolicy.FileCreationTime | StorageProviderInSyncPolicy.DirectoryCreationTime |
StorageProviderInSyncPolicy.FileLastWriteTime | StorageProviderInSyncPolicy.DirectoryLastWriteTime |
StorageProviderInSyncPolicy.FileHiddenAttribute | StorageProviderInSyncPolicy.DirectoryHiddenAttribute |
StorageProviderInSyncPolicy.FileSystemAttribute | StorageProviderInSyncPolicy.DirectorySystemAttribute;
StorageProviderSyncRootManager.Register(storageInfo);
可以在此GitHub 存储库中找到完整的代码。
如何使我的文件系统不在 Windows 文件管理器的根级别显示?