Interface IFile

Provides methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of System.IO.FileStream objects

Namespace: EPiServer.Framework.FileSystem
Assembly: EPiServer.Framework.AspNet.dll
Version: 11.20.7
Syntax
public interface IFile

Methods

AppendAllLines(String, IEnumerable<String>)

Declaration
void AppendAllLines(string path, IEnumerable<string> contents)
Parameters
Type Name Description
System.String path
System.Collections.Generic.IEnumerable<System.String> contents

AppendAllLines(String, IEnumerable<String>, Encoding)

Declaration
void AppendAllLines(string path, IEnumerable<string> contents, Encoding encoding)
Parameters
Type Name Description
System.String path
System.Collections.Generic.IEnumerable<System.String> contents
System.Text.Encoding encoding

AppendAllText(String, String)

Declaration
void AppendAllText(string path, string contents)
Parameters
Type Name Description
System.String path
System.String contents

AppendAllText(String, String, Encoding)

Declaration
void AppendAllText(string path, string contents, Encoding encoding)
Parameters
Type Name Description
System.String path
System.String contents
System.Text.Encoding encoding

AppendText(String)

Declaration
StreamWriter AppendText(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.IO.StreamWriter

Copy(String, String)

Declaration
void Copy(string sourceFileName, string destinationFileName)
Parameters
Type Name Description
System.String sourceFileName
System.String destinationFileName

Copy(String, String, Boolean)

Declaration
void Copy(string sourceFileName, string destinationFileName, bool overwrite)
Parameters
Type Name Description
System.String sourceFileName
System.String destinationFileName
System.Boolean overwrite

Create(String)

Declaration
FileStream Create(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.IO.FileStream

Create(String, Int32)

Declaration
FileStream Create(string path, int bufferSize)
Parameters
Type Name Description
System.String path
System.Int32 bufferSize
Returns
Type Description
System.IO.FileStream

Create(String, Int32, FileOptions)

Declaration
FileStream Create(string path, int bufferSize, FileOptions options)
Parameters
Type Name Description
System.String path
System.Int32 bufferSize
System.IO.FileOptions options
Returns
Type Description
System.IO.FileStream

CreateText(String)

Declaration
StreamWriter CreateText(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.IO.StreamWriter

Decrypt(String)

Declaration
void Decrypt(string path)
Parameters
Type Name Description
System.String path

Delete(String)

Declaration
void Delete(string path)
Parameters
Type Name Description
System.String path

Encrypt(String)

Declaration
void Encrypt(string path)
Parameters
Type Name Description
System.String path

Exists(String)

Declaration
bool Exists(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.Boolean

GetAttributes(String)

Declaration
FileAttributes GetAttributes(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.IO.FileAttributes

GetCreationTime(String)

Declaration
DateTime GetCreationTime(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.DateTime

GetCreationTimeUtc(String)

Declaration
DateTime GetCreationTimeUtc(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.DateTime

GetLastAccessTime(String)

Declaration
DateTime GetLastAccessTime(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.DateTime

GetLastAccessTimeUtc(String)

Declaration
DateTime GetLastAccessTimeUtc(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.DateTime

GetLastWriteTime(String)

Declaration
DateTime GetLastWriteTime(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.DateTime

GetLastWriteTimeUtc(String)

Declaration
DateTime GetLastWriteTimeUtc(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.DateTime

Move(String, String)

Declaration
void Move(string sourceFileName, string destinationFileName)
Parameters
Type Name Description
System.String sourceFileName
System.String destinationFileName

Open(String, FileMode)

Declaration
FileStream Open(string path, FileMode mode)
Parameters
Type Name Description
System.String path
System.IO.FileMode mode
Returns
Type Description
System.IO.FileStream

Open(String, FileMode, FileAccess)

Declaration
FileStream Open(string path, FileMode mode, FileAccess access)
Parameters
Type Name Description
System.String path
System.IO.FileMode mode
System.IO.FileAccess access
Returns
Type Description
System.IO.FileStream

Open(String, FileMode, FileAccess, FileShare)

Declaration
FileStream Open(string path, FileMode mode, FileAccess access, FileShare share)
Parameters
Type Name Description
System.String path
System.IO.FileMode mode
System.IO.FileAccess access
System.IO.FileShare share
Returns
Type Description
System.IO.FileStream

OpenRead(String)

Declaration
FileStream OpenRead(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.IO.FileStream

OpenText(String)

Declaration
StreamReader OpenText(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.IO.StreamReader

OpenWrite(String)

Declaration
FileStream OpenWrite(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.IO.FileStream

ReadAllBytes(String)

Declaration
byte[] ReadAllBytes(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.Byte[]

ReadAllLines(String)

Declaration
string[] ReadAllLines(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.String[]

ReadAllLines(String, Encoding)

Declaration
string[] ReadAllLines(string path, Encoding encoding)
Parameters
Type Name Description
System.String path
System.Text.Encoding encoding
Returns
Type Description
System.String[]

ReadAllText(String)

Declaration
string ReadAllText(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.String

ReadAllText(String, Encoding)

Declaration
string ReadAllText(string path, Encoding encoding)
Parameters
Type Name Description
System.String path
System.Text.Encoding encoding
Returns
Type Description
System.String

ReadLines(String)

Declaration
IEnumerable<string> ReadLines(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

ReadLines(String, Encoding)

Declaration
IEnumerable<string> ReadLines(string path, Encoding encoding)
Parameters
Type Name Description
System.String path
System.Text.Encoding encoding
Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

Replace(String, String, String)

Declaration
void Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName)
Parameters
Type Name Description
System.String sourceFileName
System.String destinationFileName
System.String destinationBackupFileName

Replace(String, String, String, Boolean)

Declaration
void Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors)
Parameters
Type Name Description
System.String sourceFileName
System.String destinationFileName
System.String destinationBackupFileName
System.Boolean ignoreMetadataErrors

SetAttributes(String, FileAttributes)

Declaration
void SetAttributes(string path, FileAttributes fileAttributes)
Parameters
Type Name Description
System.String path
System.IO.FileAttributes fileAttributes

SetCreationTime(String, DateTime)

Declaration
void SetCreationTime(string path, DateTime creationTime)
Parameters
Type Name Description
System.String path
System.DateTime creationTime

SetCreationTimeUtc(String, DateTime)

Declaration
void SetCreationTimeUtc(string path, DateTime creationTimeUtc)
Parameters
Type Name Description
System.String path
System.DateTime creationTimeUtc

SetLastAccessTime(String, DateTime)

Declaration
void SetLastAccessTime(string path, DateTime lastAccessTime)
Parameters
Type Name Description
System.String path
System.DateTime lastAccessTime

SetLastAccessTimeUtc(String, DateTime)

Declaration
void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc)
Parameters
Type Name Description
System.String path
System.DateTime lastAccessTimeUtc

SetLastWriteTime(String, DateTime)

Declaration
void SetLastWriteTime(string path, DateTime lastWriteTime)
Parameters
Type Name Description
System.String path
System.DateTime lastWriteTime

SetLastWriteTimeUtc(String, DateTime)

Declaration
void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)
Parameters
Type Name Description
System.String path
System.DateTime lastWriteTimeUtc

WriteAllBytes(String, Byte[])

Declaration
void WriteAllBytes(string path, byte[] bytes)
Parameters
Type Name Description
System.String path
System.Byte[] bytes

WriteAllLines(String, IEnumerable<String>)

Declaration
void WriteAllLines(string path, IEnumerable<string> contents)
Parameters
Type Name Description
System.String path
System.Collections.Generic.IEnumerable<System.String> contents

WriteAllLines(String, IEnumerable<String>, Encoding)

Declaration
void WriteAllLines(string path, IEnumerable<string> contents, Encoding encoding)
Parameters
Type Name Description
System.String path
System.Collections.Generic.IEnumerable<System.String> contents
System.Text.Encoding encoding

WriteAllLines(String, String[])

Declaration
void WriteAllLines(string path, string[] contents)
Parameters
Type Name Description
System.String path
System.String[] contents

WriteAllLines(String, String[], Encoding)

Declaration
void WriteAllLines(string path, string[] contents, Encoding encoding)
Parameters
Type Name Description
System.String path
System.String[] contents
System.Text.Encoding encoding

WriteAllText(String, String)

Declaration
void WriteAllText(string path, string contents)
Parameters
Type Name Description
System.String path
System.String contents

WriteAllText(String, String, Encoding)

Declaration
void WriteAllText(string path, string contents, Encoding encoding)
Parameters
Type Name Description
System.String path
System.String contents
System.Text.Encoding encoding

Extension Methods