Show / Hide Table of Contents

Class FileInfoExtensionMethods

The new extension methods that supersede the instance methods on the companion FileInfoExtension class go into a dedicated class, because a static class must expose them.

Inheritance
System.Object
FileInfoExtensionMethods
Namespace: WizardWrx
Assembly: WizardWrx.Core.dll
Syntax
public static class FileInfoExtensionMethods : object

Fields

| Improve this Doc View Source

LENGTH_REPORTED_WHEN_FILE_NOT_FOUND

Unless the specified file exists and is accessible via the current user's security token, Windows throws a FileNotFoundException Exception. Rather than allow that to happen, this method reports its length as -1, a patently invalid value for a file length.

Declaration
public const int LENGTH_REPORTED_WHEN_FILE_NOT_FOUND = null
Field Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

FileAttributeArchiveClear(FileInfo)

Clear the Archive FileAttributes on a file.

Declaration
public static FileInfoExtension.enmInitialStatus FileAttributeArchiveClear(this FileInfo pfi)
Parameters
Type Name Description
FileInfo pfi

As an extension method, the first argument must be a reference to the instance that invoked it, which is used in much the same way as the implicit this parameter that leads the list of parameters for a call to any C# instance method.

Returns
Type Description
FileInfoExtension.enmInitialStatus

If the Archive attribute is set on entry, the return value is WasSet; otherwise, it is WasCleared.

| Improve this Doc View Source

FileAttributeArchiveReinstate(FileInfo, FileInfoExtension.enmInitialStatus)

Reinstate the Archive flag on the specified file.

Declaration
public static FileInfoExtension.enmInitialStatus FileAttributeArchiveReinstate(this FileInfo pfi, FileInfoExtension.enmInitialStatus penmInitialStatus)
Parameters
Type Name Description
FileInfo pfi

As an extension method, the first argument must be a reference to the instance that invoked it, which is used in much the same way as the implicit this parameter that leads the list of parameters for a call to any C# instance method.

FileInfoExtension.enmInitialStatus penmInitialStatus

Specify the FileInfoExtension.enmInitialStatus value returned by the last call to FileAttributeArchiveClear.

Returns
Type Description
FileInfoExtension.enmInitialStatus

If the Archive attribute is set on entry, the return value is WasSet; otherwise, it is WasCleared.

| Improve this Doc View Source

FileAttributeArchiveSet(FileInfo)

Set the Archive FileAttributes on a file.

Declaration
public static FileInfoExtension.enmInitialStatus FileAttributeArchiveSet(this FileInfo pfi)
Parameters
Type Name Description
FileInfo pfi

As an extension method, the first argument must be a reference to the instance that invoked it, which is used in much the same way as the implicit this parameter that leads the list of parameters for a call to any C# instance method.

Returns
Type Description
FileInfoExtension.enmInitialStatus

If the Archive attribute is set on entry, the return value is WasSet; otherwise, it is WasCleared.

| Improve this Doc View Source

FileAttributeClear(FileInfo, FileAttributes)

Clear the specified FileAttributes bit(s).

Declaration
public static FileInfoExtension.enmInitialStatus FileAttributeClear(this FileInfo pfi, FileAttributes penmFileAttributes)
Parameters
Type Name Description
FileInfo pfi

As an extension method, the first argument must be a reference to the instance that invoked it, which is used in much the same way as the implicit this parameter that leads the list of parameters for a call to any C# instance method.

FileAttributes penmFileAttributes

This argument specifies the member(s) of the FileAttributes bitwise enumeration to clear.

Returns
Type Description
FileInfoExtension.enmInitialStatus

If the specified bit (It's usually just one.) is set on entry, the return value is WasSet; otherwise, it is WasCleared.

| Improve this Doc View Source

FileAttributeHiddenClear(FileInfo)

Clear the Hidden FileAttributes on a file.

Declaration
public static FileInfoExtension.enmInitialStatus FileAttributeHiddenClear(this FileInfo pfi)
Parameters
Type Name Description
FileInfo pfi

As an extension method, the first argument must be a reference to the instance that invoked it, which is used in much the same way as the implicit this parameter that leads the list of parameters for a call to any C# instance method.

Returns
Type Description
FileInfoExtension.enmInitialStatus

If the Hidden attribute is set on entry, the return value is WasSet; otherwise, it is WasCleared.

| Improve this Doc View Source

FileAttributeHiddeneReinstate(FileInfo, FileInfoExtension.enmInitialStatus)

Reinstate the Hidden flag on the specified file.

Declaration
public static FileInfoExtension.enmInitialStatus FileAttributeHiddeneReinstate(this FileInfo pfi, FileInfoExtension.enmInitialStatus penmInitialStatus)
Parameters
Type Name Description
FileInfo pfi

As an extension method, the first argument must be a reference to the instance that invoked it, which is used in much the same way as the implicit this parameter that leads the list of parameters for a call to any C# instance method.

FileInfoExtension.enmInitialStatus penmInitialStatus

Specify the FileInfoExtension.enmInitialStatus value returned by the last call to FileAttributeArchiveClear.

Returns
Type Description
FileInfoExtension.enmInitialStatus

If the Hidden attribute is set on entry, the return value is WasSet; otherwise, it is WasCleared.

| Improve this Doc View Source

FileAttributeHiddenSet(FileInfo)

Set the Hidden FileAttributes on a file.

Declaration
public static FileInfoExtension.enmInitialStatus FileAttributeHiddenSet(this FileInfo pfi)
Parameters
Type Name Description
FileInfo pfi

As an extension method, the first argument must be a reference to the instance that invoked it, which is used in much the same way as the implicit this parameter that leads the list of parameters for a call to any C# instance method.

Returns
Type Description
FileInfoExtension.enmInitialStatus

If the Hidden attribute is set on entry, the return value is WasSet; otherwise, it is WasCleared.

| Improve this Doc View Source

FileAttributeReadOnlyClear(FileInfo)

Clear the ReadOnly FileAttributes on a file.

Declaration
public static FileInfoExtension.enmInitialStatus FileAttributeReadOnlyClear(this FileInfo pfi)
Parameters
Type Name Description
FileInfo pfi

As an extension method, the first argument must be a reference to the instance that invoked it, which is used in much the same way as the implicit this parameter that leads the list of parameters for a call to any C# instance method.

Returns
Type Description
FileInfoExtension.enmInitialStatus

If the ReadOnly attribute is set on entry, the return value is WasSet; otherwise, it is WasCleared.

| Improve this Doc View Source

FileAttributeReadOnlyReinstate(FileInfo, FileInfoExtension.enmInitialStatus)

Reinstate the ReadOnly flag on the specified file.

Declaration
public static FileInfoExtension.enmInitialStatus FileAttributeReadOnlyReinstate(this FileInfo pfi, FileInfoExtension.enmInitialStatus penmInitialStatus)
Parameters
Type Name Description
FileInfo pfi

As an extension method, the first argument must be a reference to the instance that invoked it, which is used in much the same way as the implicit this parameter that leads the list of parameters for a call to any C# instance method.

FileInfoExtension.enmInitialStatus penmInitialStatus

Specify the FileInfoExtension.enmInitialStatus value returned by the last call to FileAttributeArchiveClear.

Returns
Type Description
FileInfoExtension.enmInitialStatus

If the ReadOnly attribute is set on entry, the return value is WasSet; otherwise, it is WasCleared.

| Improve this Doc View Source

FileAttributeReadOnlySet(FileInfo)

Set the ReadOnly FileAttributes on a file.

Declaration
public static FileInfoExtension.enmInitialStatus FileAttributeReadOnlySet(this FileInfo pfi)
Parameters
Type Name Description
FileInfo pfi

As an extension method, the first argument must be a reference to the instance that invoked it, which is used in much the same way as the implicit this parameter that leads the list of parameters for a call to any C# instance method.

Returns
Type Description
FileInfoExtension.enmInitialStatus

If the ReadOnly attribute is set on entry, the return value is WasSet; otherwise, it is WasCleared.

| Improve this Doc View Source

FileAttributeSet(FileInfo, FileAttributes)

Set the specified FileAttributes bit(s).

Declaration
public static FileInfoExtension.enmInitialStatus FileAttributeSet(this FileInfo pfi, FileAttributes penmFileAttributes)
Parameters
Type Name Description
FileInfo pfi

As an extension method, the first argument must be a reference to the instance that invoked it, which is used in much the same way as the implicit this parameter that leads the list of parameters for a call to any C# instance method.

FileAttributes penmFileAttributes

This argument specifies the member(s) of the FileAttributes bitwise enumeration to clear.

Returns
Type Description
FileInfoExtension.enmInitialStatus

If the specified bit (It's usually just one.) is set on entry, the return value is WasSet; otherwise, it is WasCleared.

| Improve this Doc View Source

FileAttributeSystemClear(FileInfo)

Clear the System FileAttributes on a file.

Declaration
public static FileInfoExtension.enmInitialStatus FileAttributeSystemClear(this FileInfo pfi)
Parameters
Type Name Description
FileInfo pfi

As an extension method, the first argument must be a reference to the instance that invoked it, which is used in much the same way as the implicit this parameter that leads the list of parameters for a call to any C# instance method.

Returns
Type Description
FileInfoExtension.enmInitialStatus

If the specified bit (It's usually just one.) is set on entry, the return value is WasSet; otherwise, it is WasCleared.

| Improve this Doc View Source

FileAttributeSystemReinstate(FileInfo, FileInfoExtension.enmInitialStatus)

Reinstate the System flag on the specified file.

Declaration
public static FileInfoExtension.enmInitialStatus FileAttributeSystemReinstate(this FileInfo pfi, FileInfoExtension.enmInitialStatus penmInitialStatus)
Parameters
Type Name Description
FileInfo pfi

As an extension method, the first argument must be a reference to the instance that invoked it, which is used in much the same way as the implicit this parameter that leads the list of parameters for a call to any C# instance method.

FileInfoExtension.enmInitialStatus penmInitialStatus

Specify the FileInfoExtension.enmInitialStatus value returned by the last call to FileAttributeArchiveClear.

Returns
Type Description
FileInfoExtension.enmInitialStatus

If the System attribute is set on entry, the return value is WasSet; otherwise, it is WasCleared.

| Improve this Doc View Source

FileAttributeSystemSet(FileInfo)

Set the System FileAttributes on a file.

Declaration
public static FileInfoExtension.enmInitialStatus FileAttributeSystemSet(this FileInfo pfi)
Parameters
Type Name Description
FileInfo pfi

As an extension method, the first argument must be a reference to the instance that invoked it, which is used in much the same way as the implicit this parameter that leads the list of parameters for a call to any C# instance method.

Returns
Type Description
FileInfoExtension.enmInitialStatus

If the specified bit (It's usually just one.) is set on entry, the return value is WasSet; otherwise, it is WasCleared.

| Improve this Doc View Source

ShowFileDetails(FileInfo, FileInfoExtensionMethods.FileDetailsToShow, String, Boolean, Boolean)

This is a general-purpose method for reporting details about a file.

Declaration
public static string ShowFileDetails(this FileInfo pfi, FileInfoExtensionMethods.FileDetailsToShow penmFileDetailsToShow = default(FileInfoExtensionMethods.FileDetailsToShow), string pstrLabel = null, bool pfPrefixWithNewline = false, bool pfSuffixWithNewline = false)
Parameters
Type Name Description
FileInfo pfi

The framework supplies a reference to the FileInfo instance with which the call is associated.

FileInfoExtensionMethods.FileDetailsToShow penmFileDetailsToShow

Use one or more members of the FileDetailsToShow enumeration to specify the details to display. The FileDetailsToShow enumeration is a bit mask, and the enumeration defines the combinations that are most likely to be useful as additional members.

The default value is FileDetailsToShow.Everything.

System.String pstrLabel

The label string is optional and, if specified, appears at the start of the returned string. String magic is thereafter employed to keep subsequent lines of text aligned vertically.

The default value is NULL, which resolves internally to the empty string.

System.Boolean pfPrefixWithNewline

If TRUE, the whole string begins with a platform-dependent newline. Otherwise, the string begins with the label specified by parameter pstrLabel, if any, followed by the absolute file name.

The default value is FALSE.

System.Boolean pfSuffixWithNewline

If TRUE, the string is terminated with a platform-dependent newline. Otherwise, the string ends with the last value specified by the penmFileDetailsToShow bit mask.

The default value is FALSE.

Returns
Type Description
System.String

The return value is a human-readable multi-line report suitable for display on a console log, event log, print file, or message box. When the file is absent, its length is reported as -1.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX