Smart Device Functions:
Alternative C# Signature:
You can create this FileAttributes type to go in your class and be used with the alternative signature if you wish (or you can use the System.IO.FileAttributes as displayed in the below example):
[Flags] public enum FileAttributes : uint
This method works for Alternate Data Streams, also great when used with the Unicode header \\?\ to change the attributes of files who have paths to long to be dealt with via the shell.
Tips & Tricks:
Please add some!
Using the "alternative" method above you can make calls like so:
SetFileAttributes("pathname", FileAttributes.System | FileAttributes.Hidden | FileAttributes.Archive);
Alternatively you can use like this to deal with unicode paths around 32,700 characters long:
private const String UnicodeHeader = @"\\?\";
In the above example I have specified the W (Unicode) version of the function as opposed to the A (ANSI) version of the function and so I don't think I needed to specify the CharSet to be Unicode however I have done so for illustration purpose to show how you would force the non W version of the function to work with unicode (long) file paths.
Alternative Managed API:
System.IO.File.SetAttributes(String path, System.IO.FileAttributes fileAttributes);
The SetFileAttributes API
1/6/2010 5:46:18 AM - firstname.lastname@example.org
The file attributes used by file-handling functions, such as those of shlwapi.dll.
8/12/2012 5:26:10 AM - -126.96.36.199
Click to read this page
4/6/2008 2:23:14 PM - hlidftvbgb-188.8.131.52
Please edit this page!
Do you have...