2

我正在使用存储提供程序和 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 文件管理器的根级别显示?

4

1 回答 1

3

根据集成云存储提供商文章,您可以编辑您的同步根注册信息并将HKCU\Software\Classes\CLSID\{<GUID>}\ System.IsPinnedToNameSpaceTree值修改为 0。这将从资源管理器树中隐藏您的同步根文件夹。如果他打开“显示所有文件夹”选项,用户仍然可以看到它。

要找到您的 SyncRoot CLSID,您需要打开同步根注册管理器并找到您的注册条目:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SyncRootManager\<your sync root>\ NamespaceCLSID

于 2021-02-05T16:14:26.097 回答