Class FileInfoExtension
Extend the System.IO.FileInfo class with methods for testing, setting, and clearing file attribute flags, including the ability to save and restore flags to their initial states.
Inheritance
Namespace: WizardWrx
Assembly: WizardWrx.Core.dll
Syntax
public class FileInfoExtension : object
Constructors
| Improve this Doc View SourceFileInfoExtension(String)
We insist on a file name.
Declaration
public FileInfoExtension(string pstrFileName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | pstrFileName | String containing the name of a file to process. This string must point to an existing file. |
Remarks
Because of its intended use, this class is designed without a public default constructor. I believe that it is extremely unlikely that a user would need to serialize an instance of this class.
Properties
| Improve this Doc View SourceArchive
This property returns the current state of the Archive attribute.
Declaration
public bool Archive { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Compressed
This property returns the current state of the Compressed attribute.
Declaration
public bool Compressed { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Encrypted
This property returns the current state of the Encrypted attribute.
Declaration
public bool Encrypted { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Hidden
This property returns the current state of the Hidden attribute.
Declaration
public bool Hidden { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
NotContentIndexed
This property returns the current state of the NotContentIndexed attribute.
Declaration
public bool NotContentIndexed { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Offline
This property returns the current state of the Offline attribute.
Declaration
public bool Offline { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ReadOnly
This property returns the current state of the ReadOnly attribute.
Declaration
public bool ReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
System
This property returns the current state of the System attribute.
Declaration
public bool System { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Temporary
This property returns the current state of the Temporary attribute.
Declaration
public bool Temporary { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
TheFile
Return the underlying FileInfo object, which is initialized by the constructor.
Declaration
public FileInfo TheFile { get; }
Property Value
| Type | Description |
|---|---|
| FileInfo |
WasArchive
Return the initial state of the Archive flag.
Declaration
public FileInfoExtension.enmInitialStatus WasArchive { get; }
Property Value
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus |
Remarks
The value of this property is meaningless after the ArchiveReinstate method is called, and before either ArchiveClear or ArchiveSet has been called on an instance.
WasHidden
Return the initial state of the Hidden flag.
Declaration
public FileInfoExtension.enmInitialStatus WasHidden { get; }
Property Value
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus |
Remarks
The value of this property is meaningless after the HiddenReinstate method is called, and before either HiddenClear or HiddenSet has been called on an instance.
WasReadOnly
Return the initial state of the ReadOnly flag.
Declaration
public FileInfoExtension.enmInitialStatus WasReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus |
Remarks
The value of this property is meaningless after the ReadOnlyReinstate method is called, and before either ReadOnlyClear or ReadOnlySet has been called on an instance.
WasSystem
Return the initial state of the System flag.
Declaration
public FileInfoExtension.enmInitialStatus WasSystem { get; }
Property Value
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus |
Remarks
The value of this property is meaningless after the SystemReinstate method is called, and before either SystemClear or SystemSet has been called on an instance.
Methods
| Improve this Doc View SourceArchiveClear()
Clear the Archive flag.
Declaration
public FileInfoExtension.enmInitialStatus ArchiveClear()
Returns
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus | Previous state of the Archive flag. |
Remarks
Since the initial state of the flag is preserved internally by the class, and can be read from the WasArchive property, callers may safely ignore or discard the return value.
ArchiveReinstate()
Restore the initial state of the Archive flag.
Declaration
public FileInfoExtension.enmInitialStatus ArchiveReinstate()
Returns
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus | Previous state of the Archive flag. |
Remarks
Since the return value is strictly informational, callers may safely ignore or discard it.
ArchiveSet()
Set the Archive flag.
Declaration
public FileInfoExtension.enmInitialStatus ArchiveSet()
Returns
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus | Previous state of the Archive flag. |
Remarks
Since the initial state of the flag is preserved internally by the class, and can be read from the WasArchive property, callers may safely ignore or discard the return value.
HiddenClear()
Clear the Hidden flag.
Declaration
public FileInfoExtension.enmInitialStatus HiddenClear()
Returns
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus | Previous state of the Hidden flag. |
Remarks
Since the initial state of the flag is preserved internally by the class, and can be read from the WasHidden property, callers may safely ignore or discard the return value.
HiddenReinstate()
Restore the initial state of the Hidden flag.
Declaration
public FileInfoExtension.enmInitialStatus HiddenReinstate()
Returns
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus | Previous state of the Hidden flag. |
Remarks
Since the return value is strictly informational, callers may safely ignore or discard it.
HiddenSet()
Set the Hidden flag.
Declaration
public FileInfoExtension.enmInitialStatus HiddenSet()
Returns
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus | Previous state of the Hidden flag. |
Remarks
Since the initial state of the flag is preserved internally by the class, and can be read from the WasHidden property, callers may safely ignore or discard the return value.
ReadOnlyClear()
Clear the Read ONly flag.
Declaration
public FileInfoExtension.enmInitialStatus ReadOnlyClear()
Returns
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus | Previous state of the Read ONly flag. |
Remarks
Since the initial state of the flag is preserved internally by the class, and can be read from the WasReadOnly property, callers may safely ignore or discard the return value.
ReadOnlyReinstate()
Restore the initial state of the Read Only flag.
Declaration
public FileInfoExtension.enmInitialStatus ReadOnlyReinstate()
Returns
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus | Previous state of the Read ONly flag. |
Remarks
Since the return value is strictly informational, callers may safely ignore or discard it.
ReadOnlySet()
Set the Read Only flag.
Declaration
public FileInfoExtension.enmInitialStatus ReadOnlySet()
Returns
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus | Previous state of the Read ONly flag. |
Remarks
Since the initial state of the flag is preserved internally by the class, and can be read from the WasReadOnly property, callers may safely ignore or discard the return value.
SystemClear()
Clear the System flag.
Declaration
public FileInfoExtension.enmInitialStatus SystemClear()
Returns
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus | Previous state of the System flag. |
Remarks
Since the initial state of the flag is preserved internally by the class, and can be read from the WasSystem property, callers may safely ignore or discard the return value.
SystemReinstate()
Restore the initial state of the System flag.
Declaration
public FileInfoExtension.enmInitialStatus SystemReinstate()
Returns
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus | Previous state of the System flag. |
Remarks
Since the return value is strictly informational, callers may safely ignore or discard it.
SystemSet()
Set the System flag.
Declaration
public FileInfoExtension.enmInitialStatus SystemSet()
Returns
| Type | Description |
|---|---|
| FileInfoExtension.enmInitialStatus | Previous state of the System flag. |
Remarks
Since the initial state of the flag is preserved internally by the class, and can be read from the WasSystem property, callers may safely ignore or discard the return value.