C# Class WizardWrx.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.
Mostrar archivo Open project: txwizard/WizardWrx_NET_API

Public Methods

Method Description
FileAttributeArchiveClear ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus

Clear the Archive FileAttributes on a file.

FileAttributeArchiveReinstate ( FileInfo pfi, FileInfoExtension.enmInitialStatus penmInitialStatus ) : FileInfoExtension.enmInitialStatus

Reinstate the Archive flag on the specified file.

FileAttributeArchiveSet ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus

Set the Archive FileAttributes on a file.

FileAttributeClear ( FileInfo pfi, FileAttributes penmFileAttributes ) : FileInfoExtension.enmInitialStatus

Clear the specified FileAttributes bit(s).

FileAttributeHiddenClear ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus

Clear the Hidden FileAttributes on a file.

FileAttributeHiddenSet ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus

Set the Hidden FileAttributes on a file.

FileAttributeHiddeneReinstate ( FileInfo pfi, FileInfoExtension.enmInitialStatus penmInitialStatus ) : FileInfoExtension.enmInitialStatus

Reinstate the Hidden flag on the specified file.

FileAttributeReadOnlyClear ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus

Clear the ReadOnly FileAttributes on a file.

FileAttributeReadOnlyReinstate ( FileInfo pfi, FileInfoExtension.enmInitialStatus penmInitialStatus ) : FileInfoExtension.enmInitialStatus

Reinstate the ReadOnly flag on the specified file.

FileAttributeReadOnlySet ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus

Set the ReadOnly FileAttributes on a file.

FileAttributeSet ( FileInfo pfi, FileAttributes penmFileAttributes ) : FileInfoExtension.enmInitialStatus

Set the specified FileAttributes bit(s).

FileAttributeSystemClear ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus

Clear the System FileAttributes on a file.

FileAttributeSystemReinstate ( FileInfo pfi, FileInfoExtension.enmInitialStatus penmInitialStatus ) : FileInfoExtension.enmInitialStatus

Reinstate the System flag on the specified file.

FileAttributeSystemSet ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus

Set the System FileAttributes on a file.

ShowFileDetails ( FileInfo pfi, FileDetailsToShow penmFileDetailsToShow = FileDetailsToShow.Everything, string pstrLabel = null, bool pfPrefixWithNewline = false, bool pfSuffixWithNewline = false ) : string

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

Private Methods

Method Description
ComputeLengthToReport ( FileInfo pfi ) : string

The cleanest way to handle this special case is by way of a private method that takes the whole FileInfo reference, since the outcome is dependent upon the value of its Exists property, along with the more obvious dependency upon the Length property.

ComputeTokenEnd ( int pintPosTokenBegin, int pintPosTokenEnd, string pstrToken ) : int

Given pintPosTokenBegin, the position of the beginning of a substring, pintPosTokenEnd, the position of the token that marks the end of the substring, and the token, itself, represented by pstrToken, from which to determine its length, return the length of the substring, inclusive of its terminal token.

Though intended for use by the static constructor, this method may warrant being exposed as a public static method for wider use.

FileInfoExtensionMethods ( ) : System

Method Details

FileAttributeArchiveClear() public static method

Clear the Archive FileAttributes on a file.
public static FileAttributeArchiveClear ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus
pfi FileInfo /// 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. ///
return FileInfoExtension.enmInitialStatus

FileAttributeArchiveReinstate() public static method

Reinstate the Archive flag on the specified file.
public static FileAttributeArchiveReinstate ( FileInfo pfi, FileInfoExtension.enmInitialStatus penmInitialStatus ) : FileInfoExtension.enmInitialStatus
pfi FileInfo /// 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. ///
penmInitialStatus FileInfoExtension.enmInitialStatus /// Specify the FileInfoExtension.enmInitialStatus value returned by the last call to /// FileAttributeArchiveClear. ///
return FileInfoExtension.enmInitialStatus

FileAttributeArchiveSet() public static method

Set the Archive FileAttributes on a file.
public static FileAttributeArchiveSet ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus
pfi FileInfo /// 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. ///
return FileInfoExtension.enmInitialStatus

FileAttributeClear() public static method

Clear the specified FileAttributes bit(s).
public static FileAttributeClear ( FileInfo pfi, FileAttributes penmFileAttributes ) : FileInfoExtension.enmInitialStatus
pfi FileInfo /// 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. ///
penmFileAttributes FileAttributes /// This argument specifies the member(s) of the FileAttributes bitwise /// enumeration to clear. ///
return FileInfoExtension.enmInitialStatus

FileAttributeHiddenClear() public static method

Clear the Hidden FileAttributes on a file.
public static FileAttributeHiddenClear ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus
pfi FileInfo /// 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. ///
return FileInfoExtension.enmInitialStatus

FileAttributeHiddenSet() public static method

Set the Hidden FileAttributes on a file.
public static FileAttributeHiddenSet ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus
pfi FileInfo /// 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. ///
return FileInfoExtension.enmInitialStatus

FileAttributeHiddeneReinstate() public static method

Reinstate the Hidden flag on the specified file.
public static FileAttributeHiddeneReinstate ( FileInfo pfi, FileInfoExtension.enmInitialStatus penmInitialStatus ) : FileInfoExtension.enmInitialStatus
pfi FileInfo /// 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. ///
penmInitialStatus FileInfoExtension.enmInitialStatus /// Specify the FileInfoExtension.enmInitialStatus value returned by the last call to /// FileAttributeArchiveClear. ///
return FileInfoExtension.enmInitialStatus

FileAttributeReadOnlyClear() public static method

Clear the ReadOnly FileAttributes on a file.
public static FileAttributeReadOnlyClear ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus
pfi FileInfo /// 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. ///
return FileInfoExtension.enmInitialStatus

FileAttributeReadOnlyReinstate() public static method

Reinstate the ReadOnly flag on the specified file.
public static FileAttributeReadOnlyReinstate ( FileInfo pfi, FileInfoExtension.enmInitialStatus penmInitialStatus ) : FileInfoExtension.enmInitialStatus
pfi FileInfo /// 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. ///
penmInitialStatus FileInfoExtension.enmInitialStatus /// Specify the FileInfoExtension.enmInitialStatus value returned by the last call to /// FileAttributeArchiveClear. ///
return FileInfoExtension.enmInitialStatus

FileAttributeReadOnlySet() public static method

Set the ReadOnly FileAttributes on a file.
public static FileAttributeReadOnlySet ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus
pfi FileInfo /// 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. ///
return FileInfoExtension.enmInitialStatus

FileAttributeSet() public static method

Set the specified FileAttributes bit(s).
public static FileAttributeSet ( FileInfo pfi, FileAttributes penmFileAttributes ) : FileInfoExtension.enmInitialStatus
pfi FileInfo /// 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. ///
penmFileAttributes FileAttributes /// This argument specifies the member(s) of the FileAttributes bitwise /// enumeration to clear. ///
return FileInfoExtension.enmInitialStatus

FileAttributeSystemClear() public static method

Clear the System FileAttributes on a file.
public static FileAttributeSystemClear ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus
pfi FileInfo /// 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. ///
return FileInfoExtension.enmInitialStatus

FileAttributeSystemReinstate() public static method

Reinstate the System flag on the specified file.
public static FileAttributeSystemReinstate ( FileInfo pfi, FileInfoExtension.enmInitialStatus penmInitialStatus ) : FileInfoExtension.enmInitialStatus
pfi FileInfo /// 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. ///
penmInitialStatus FileInfoExtension.enmInitialStatus /// Specify the FileInfoExtension.enmInitialStatus value returned by the last call to /// FileAttributeArchiveClear. ///
return FileInfoExtension.enmInitialStatus

FileAttributeSystemSet() public static method

Set the System FileAttributes on a file.
public static FileAttributeSystemSet ( FileInfo pfi ) : FileInfoExtension.enmInitialStatus
pfi FileInfo /// 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. ///
return FileInfoExtension.enmInitialStatus

ShowFileDetails() public static method

This is a general-purpose method for reporting details about a file.
public static ShowFileDetails ( FileInfo pfi, FileDetailsToShow penmFileDetailsToShow = FileDetailsToShow.Everything, string pstrLabel = null, bool pfPrefixWithNewline = false, bool pfSuffixWithNewline = false ) : string
pfi FileInfo /// The framework supplies a reference to the FileInfo instance with /// which the call is associated. ///
penmFileDetailsToShow FileDetailsToShow /// 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. ///
pstrLabel string /// 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. ///
pfPrefixWithNewline bool /// If TRUE, the whole string begins with a platform-dependent newline. /// Otherwise, the string begins with the label specified by parameter /// , if any, followed by the absolute file /// name. /// /// The default value is FALSE. ///
pfSuffixWithNewline bool /// If TRUE, the string is terminated with a platform-dependent newline. /// Otherwise, the string ends with the last value specified by the /// bit mask. /// /// The default value is FALSE. ///
return string