本文介绍了我需要一个可以隐藏敏感文件夹的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我需要一个可以隐藏敏感文件夹的功能。 有我开发的这个应用程序,我想要某些文件夹 隐藏了用户因为它们包含一些我不希望在注册表中的敏感数据。我知道CreateFile 函数有隐藏文件的功能,但我不认为CreateDirectory 函数有相同的功能。是否有这样的功能?Please I need a function with which I can make sensitive folders hidden.There is this application I developped and there are certain folders I wanthidden from users because they contain certain sensitive data that I do not wish to be in the registry. I know that CreateFile Function has facility for hidding files but I don''t think CreateDirectoryfunction has the same. Is there such a function?推荐答案 private static void ToggleHidden(bool hide) { DirectoryInfo d = new DirectoryInfo(@"C:\MySecretFolder"); if(d.Exists) { FileAttributes atts = d.Attributes; if(hide == true) { // Hide the folder. // Append Hidden attribute only if not already set. if((atts & FileAttributes.Hidden) != FileAttributes.Hidden) atts |= FileAttributes.Hidden; } else { // Show the folder. // Remove Hidden attribute if set. if((atts & FileAttributes.Hidden) == FileAttributes.Hidden) atts &= ~FileAttributes.Hidden; }} hide-directories-programatically-in-c-sharp [ ^ ] 这篇关于我需要一个可以隐藏敏感文件夹的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-25 03:15