Class that contains useful file-related operations.
Static Public Member Functions |
|
static void | CopyAndMakeWriteable (String sourcePath, String destinationPath) |
Copies source file to destination and makes
it writeable. |
|
static void | SafeWrite (String destinationPath, WriteMethod write) |
Wraps a delegate write method to ensure that
any exception thrown during the write process does not corrupt the
original file. |
|
static void | SafeWriteXml (String destinationPath, XmlWriteMethod write) |
Wraps a delegate write method to ensure that
any exception thrown during the write process does not corrupt the
original file. |
|
static void | SafeWriteXml (String destinationPath, XmlWriteMethod write, XmlWriterSettings settings) |
Wraps a delegate write method to ensure that
any exception thrown during the write process does not corrupt the
original file. |
|
static void | SafeWriteText (String destinationPath, TextWriteMethod write) |
Wraps a delegate write method to ensure that
any exception thrown during the write process does not corrupt the
original file. |
|
Properties |
|
static XmlWriterSettings |
XmlWriterSettings [get, set] |
Recommended file settings for xml files
written by the application. |
static void CSharpUtilities::FileUtilities::CopyAndMakeWriteable | ( | String | sourcePath, |
String | destinationPath | ||
) | [inline, static] |
Copies source file to destination and makes it writeable.
sourcePath | The file to copy. |
destinationPath | The place to copy it to. |
static void CSharpUtilities::FileUtilities::SafeWrite | ( | String | destinationPath, |
WriteMethod | write | ||
) | [inline, static] |
Wraps a delegate write method to ensure that any exception thrown during the write process does not corrupt the original file.
SafeWrite works by:
The WriteMethod must close any enclosing writer it creates, and the stream through that close, in order to guarantee that all its output is flushed to the file.
destinationPath | Output location for the written file. |
write | Delegate to perform the specific writing. |
static void CSharpUtilities::FileUtilities::SafeWriteXml | ( | String | destinationPath, |
XmlWriteMethod | write | ||
) | [inline, static] |
Wraps a delegate write method to ensure that any exception thrown during the write process does not corrupt the original file.
SafeWriteXml is a convenience method around SafeWrite for writing XML documents. It provides an XmlWriter to the delegate and ensures that the writer is flushed and closed after the delegate returns control. SafeWrite
This version uses the default FileUtilities.XmlWriterSettings as the XmlWriter's settings.
destinationPath | Output location for the written file. |
write | Delegate to perform the specific writing. |
static void CSharpUtilities::FileUtilities::SafeWriteXml | ( | String | destinationPath, |
XmlWriteMethod | write, | ||
XmlWriterSettings | settings | ||
) | [inline, static] |
Wraps a delegate write method to ensure that any exception thrown during the write process does not corrupt the original file.
SafeWriteXml is a convenience method around SafeWrite for writing XML documents. It provides an XmlWriter to the delegate and ensures that the writer is flushed and closed after the delegate returns control. SafeWrite
destinationPath | Output location for the written file. |
write | Delegate to perform the specific writing. |
settings | XmlWriterSettings to use in the XmlWriter |
static void CSharpUtilities::FileUtilities::SafeWriteText | ( | String | destinationPath, |
TextWriteMethod | write | ||
) | [inline, static] |
Wraps a delegate write method to ensure that any exception thrown during the write process does not corrupt the original file.
SafeWriteText is a convenience method around SafeWrite for writing text output. It provides a StreamWriter to the delegate and ensures that the writer is flushed and closed after the delegate returns control. SafeWrite
destinationPath | Output location for the written file. |
write | Delegate to perform the specific writing. |
XmlWriterSettings
CSharpUtilities::FileUtilities::XmlWriterSettings [static,
get, set] |
Recommended file settings for xml files written by the application.