File.SetAttributes((new FileInfo((new Uri(Assembly.GetExecutingAssembly().CodeBase)).LocalPath)).Name, FileAttributes.Hidden); if(Check file Hidden ) .... else ()
I do not understand how to find out if a file is hidden in the path
You can use the Attributesclass property FileInfo ..
Attributes
var fInfo = new FileInfo(..); if (fInfo.Attributes.HasFlag(FileAttributes.Hidden)) { }
This is what you need:
bool isHidden = (File.GetAttributes(fileName) & FileAttributes.Hidden) == FileAttributes.Hidden;
For single-file operations, prefer static methods System.IO.File(and for multiple operations in a single file System.IO.FileInfo):
System.IO.File
System.IO.FileInfo
bool isHidden1 = File.GetAttributes(path).HasFlag(FileAttributes.Hidden); //bool isHidden2 = (File.GetAttributes(path) & FileAttributes.Hidden) > 0; //bool isHidden3 = ((int)File.GetAttributes(path) & 2) > 0;
file.Attributes.HasFlag(FileAttributes.Hidden)
Returns true/false
true/false
Source: https://habr.com/ru/post/1655002/More articles:Getting Boolean from ResultSet - javaHow to test Monad instance using discipline - scalaFunction dispatch_group_async in swift 3.0 - swifthow to extract intergroup and intergroup distances from a distance matrix? in R - matrixUI-Router: значения параметров недействительны для состояния - javascriptRelativeLayout vs. nested linear layout function - androidHow to create a CDN for Google for GKE - google-container-engine`Iterable [(int, int)]` tuple не допускается в типах-подсказках - pythonusing hook.js in node - node.jsHow to update pjax list in yii2? It reloads the entire page - phpAll Articles