Click or drag to resize

Utils_File Class

Files utilities.
Inheritance Hierarchy
SystemObject
  MicaSystems.UtilsUtils_File

Namespace:  MicaSystems.Utils
Assembly:  MicaSystems.Utils (in MicaSystems.Utils.dll) Version: 1.0.0.0 (1.1.0.123)
Syntax
C#
public static class Utils_File

The Utils_File type exposes the following members.

Methods
  NameDescription
Public methodStatic memberCheckAssembliesVersions(DirectoryInfo, DictionaryString, String, Boolean)
Checks all assemblies versions inside a folder, based on a dictionary containing files name as key and version as value.
Public methodStatic memberCheckAssembliesVersions(String, DictionaryString, String, Boolean)
Checks all assemblies versions inside a folder, based on a dictionary containing files name as key and version as value.
Public methodStatic memberCheckDirectoryPathValidity
Checks the validity of a given folder path.

This checks if the path contains any invalid characters.

This also checks if the first part of the path exists.

Public methodStatic memberCheckInvalidCharacters
Checks if a path contains invalid characters (according to Path.GetInvalidPathChars).
Public methodStatic memberCopy
Creates a copy of an array of bytes.
Public methodStatic memberCopyDirectory

Copies the content of a directory to another.

This is done recursively.

Public methodStatic memberCopyDirectoryContent(String, String)

Copies the content of a directory to another.

This is done recursively but the code is not recurcive.

All directories are ensured first, then all files are copied.

Public methodStatic memberCopyDirectoryContent(String, String, Boolean)

Copies the content of a directory to another.

This is done recursively but the code is not recurcive.

All directories are ensured first, then all files are copied.

Public methodStatic memberCopyFileFromStream
Sets a stream content to a file without affecting the given stream.

(Because the given stream is copied).

Public methodStatic memberCopyStream
Copies a stream to another stream.
Public methodStatic memberCopyStreamFromFile
Gets a stream from a file that will not keep the file locked.

(Because the file stream is copied).

Public methodStatic memberCopyTo
Copies a file to a new location.
Public methodStatic memberFilesAreEqual
Checks if two files are equals. https://support.microsoft.com/fr-fr/help/320348/how-to-create-a-file-compare-function-in-visual-c
Public methodStatic memberFilesAreEqual_Hash(FileInfo, FileInfo)
Checks if two files' content are equal.
Public methodStatic memberFilesAreEqual_Hash(FileInfo, Stream)
Checks if two files' content are equal.
Public methodStatic memberGetAssembliesVersions(ListFileInfo, Boolean)
Gets all assemblies versions inside a folder.
Public methodStatic memberGetAssembliesVersions(DirectoryInfo, Boolean, Boolean)
Gets all assemblies versions inside a folder.
Public methodStatic memberGetAssembliesVersions(String, Boolean, Boolean)
Gets all assemblies versions inside a folder.
Public methodStatic memberGetByteArrayFromStream
Converts a stream to an array of bytes.
Public methodStatic memberGetBytes
Converts a memory stream to an array of bytes.
Public methodStatic memberGetDestinationPath
Creates a file path corresponding to the file in the source inside the destination folder.
Public methodStatic memberGetExtension(FileInfo)
Gets a file's extension. Uses Path.GetExtension.
Public methodStatic memberGetExtension(String)
Gets a file's name extension. Uses Path.GetExtension.
Public methodStatic memberGetFileContent
Gets the text content of a file. Currentlty same as System.IO.File.ReadAllText.
Public methodStatic memberGetMemoryStream(Byte)
Converts an array of bytes to a memory stream.
Public methodStatic memberGetMemoryStream(Byte, Boolean)
Converts an array of bytes to a memory stream.
Public methodStatic memberGetOfficeExtensions
Gets all extensions known to be used by an Office application.
Public methodStatic memberGetWord2010Extensions
Returns known extensions used for a recent Word file.
Public methodStatic memberGiveFullControlTo
Gives all permissions on a file to a user.
Public methodStatic memberIsImageFile
Checks if a file name extension is known to be related to an image.
Public methodStatic memberIsOfficeFile
Checks if a file name extension is known to be used by an Office application.
Public methodStatic memberIsWord2010File
Checks if a file name has a ".docx" or a ".docm" extension.
Public methodStatic memberReplaceFileNameInvalidCharacters
Replaces "Path.GetInvalidFileNameChars" by a given character.
Public methodStatic memberSaveToFile
Sets the text content of a file. Currently the same as System.IO.File.WriteAllText. Uses UTF8 encoding.
Public methodStatic memberToFile
Changes the content of a file to this text. Currently the same as System.IO.File.WriteAllText. Uses UTF8 encoding.
Public methodStatic memberValidateFileName
Throws exception if not valid. (valid is ****.extension without forbidden characters)
Top
See Also