Class WindowsCommonFiles
Provides the means to install files, such as a vendor's DLL and driver, into a folder of their own under Common Files, which only administrators may change.
public static class WindowsCommonFiles
- Inheritance
-
WindowsCommonFiles
- Inherited Members
Remarks
The folder is apart from every app's, so a driver that holds its file until a reboot blocks no update or cleanup, and it is named by the files' hash, so another build gets another folder and a file in use is never overwritten.
Methods
Install(string, IReadOnlyDictionary<string, Stream>)
Installs files into the folder of a name, such as WinTun-x64, and the files' hash, unless they are there
already. A folder or a file that others than administrators may change fails the install; it is never repaired.
public static string Install(string name, IReadOnlyDictionary<string, Stream> files)
Parameters
namestringThe folder's name, before the hash: a single name, not a path.
filesIReadOnlyDictionary<string, Stream>The files' names, single names too, and their contents. Each stream must seek: it is read from its start for its hash, and again to write a missing file.
Returns
- string
The folder's path.
Exceptions
- ArgumentException
nameor a file's name is no single name: empty, a path, or with a character no file name has.- UnauthorizedAccessException
The process is not an administrator's, or Common Files or the folder is a link or not only administrators may change it.
- InvalidOperationException
A file there is not the one installed, is a link, or not only administrators may change it.