C# Class Octopus.Cli.Util.OctopusPhysicalFileSystem

Inheritance: IOctopusFileSystem
Mostra file Open project: OctopusDeploy/Octo.exe

Public Methods

Method Description
AppendToFile ( string path, string contents ) : void
CopyDirectory ( string sourceDirectory, string targetDirectory, CancellationToken cancel, int overwriteFileRetryAttempts = 3 ) : void
CopyDirectory ( string sourceDirectory, string targetDirectory, int overwriteFileRetryAttempts = 3 ) : void
CopyFile ( string sourceFile, string targetFile, int overwriteFileRetryAttempts = 3 ) : ReplaceStatus
CreateTemporaryDirectory ( ) : string
CreateTemporaryFile ( string extension, string &path ) : Stream
DeleteDirectory ( string path ) : void
DeleteDirectory ( string path, DeletionOptions options ) : void
DeleteFile ( string path ) : void
DeleteFile ( string path, DeletionOptions options ) : void
DirectoryExists ( string path ) : bool
DirectoryIsEmpty ( string path ) : bool
EnsureDirectoryExists ( string directoryPath ) : void
EnsureDiskHasEnoughFreeSpace ( string directoryPath ) : void
EnsureDiskHasEnoughFreeSpace ( string directoryPath, long requiredSpaceInBytes ) : void
EnumerateDirectories ( string parentDirectoryPath ) : IEnumerable
EnumerateDirectoriesRecursively ( string parentDirectoryPath ) : IEnumerable
EnumerateFiles ( string parentDirectoryPath ) : IEnumerable
EnumerateFilesRecursively ( string parentDirectoryPath ) : IEnumerable
EqualHash ( Stream first, Stream second ) : bool
FileExists ( string path ) : bool
GetFileSize ( string path ) : long
GetFullPath ( string relativeOrAbsoluteFilePath ) : string
MoveFile ( string sourceFile, string destinationFile ) : void
OctopusPhysicalFileSystem ( ILogger log ) : System
OpenFile ( string path, FileAccess access, FileShare share ) : Stream
OpenFile ( string path, FileMode mode, FileAccess access, FileShare share ) : Stream
OverwriteAndDelete ( string originalFile, string temporaryReplacement ) : void
OverwriteFile ( string path, string contents ) : void
ReadAllText ( string scriptFile ) : string
ReadFile ( string path ) : string
RemoveInvalidFileNameChars ( string path ) : string
Replace ( string oldFilePath, Stream newStream, int overwriteFileRetryAttempts = 3 ) : ReplaceStatus

Creates, updates or skips a file based on a file content comparison

Useful for cases where you do not want a file's timestamp to change when overwriting it with identical contents or you want clearer logging as to what changed.

WriteAllBytes ( string filePath, byte data ) : void

Private Methods

Method Description
GetDiskFreeSpaceEx ( string lpDirectoryName, ulong &lpFreeBytesAvailable, ulong &lpTotalNumberOfBytes, ulong &lpTotalNumberOfFreeBytes ) : bool
GetTempBasePath ( ) : string

Method Details

AppendToFile() public method

public AppendToFile ( string path, string contents ) : void
path string
contents string
return void

CopyDirectory() public method

public CopyDirectory ( string sourceDirectory, string targetDirectory, CancellationToken cancel, int overwriteFileRetryAttempts = 3 ) : void
sourceDirectory string
targetDirectory string
cancel System.Threading.CancellationToken
overwriteFileRetryAttempts int
return void

CopyDirectory() public method

public CopyDirectory ( string sourceDirectory, string targetDirectory, int overwriteFileRetryAttempts = 3 ) : void
sourceDirectory string
targetDirectory string
overwriteFileRetryAttempts int
return void

CopyFile() public method

public CopyFile ( string sourceFile, string targetFile, int overwriteFileRetryAttempts = 3 ) : ReplaceStatus
sourceFile string
targetFile string
overwriteFileRetryAttempts int
return ReplaceStatus

CreateTemporaryDirectory() public method

public CreateTemporaryDirectory ( ) : string
return string

CreateTemporaryFile() public method

public CreateTemporaryFile ( string extension, string &path ) : Stream
extension string
path string
return Stream

DeleteDirectory() public method

public DeleteDirectory ( string path ) : void
path string
return void

DeleteDirectory() public method

public DeleteDirectory ( string path, DeletionOptions options ) : void
path string
options DeletionOptions
return void

DeleteFile() public method

public DeleteFile ( string path ) : void
path string
return void

DeleteFile() public method

public DeleteFile ( string path, DeletionOptions options ) : void
path string
options DeletionOptions
return void

DirectoryExists() public method

public DirectoryExists ( string path ) : bool
path string
return bool

DirectoryIsEmpty() public method

public DirectoryIsEmpty ( string path ) : bool
path string
return bool

EnsureDirectoryExists() public method

public EnsureDirectoryExists ( string directoryPath ) : void
directoryPath string
return void

EnsureDiskHasEnoughFreeSpace() public method

public EnsureDiskHasEnoughFreeSpace ( string directoryPath ) : void
directoryPath string
return void

EnsureDiskHasEnoughFreeSpace() public method

public EnsureDiskHasEnoughFreeSpace ( string directoryPath, long requiredSpaceInBytes ) : void
directoryPath string
requiredSpaceInBytes long
return void

EnumerateDirectories() public method

public EnumerateDirectories ( string parentDirectoryPath ) : IEnumerable
parentDirectoryPath string
return IEnumerable

EnumerateDirectoriesRecursively() public method

public EnumerateDirectoriesRecursively ( string parentDirectoryPath ) : IEnumerable
parentDirectoryPath string
return IEnumerable

EnumerateFiles() public method

public EnumerateFiles ( string parentDirectoryPath ) : IEnumerable
parentDirectoryPath string
return IEnumerable

EnumerateFilesRecursively() public method

public EnumerateFilesRecursively ( string parentDirectoryPath ) : IEnumerable
parentDirectoryPath string
return IEnumerable

EqualHash() public method

public EqualHash ( Stream first, Stream second ) : bool
first Stream
second Stream
return bool

FileExists() public method

public FileExists ( string path ) : bool
path string
return bool

GetFileSize() public method

public GetFileSize ( string path ) : long
path string
return long

GetFullPath() public method

public GetFullPath ( string relativeOrAbsoluteFilePath ) : string
relativeOrAbsoluteFilePath string
return string

MoveFile() public method

public MoveFile ( string sourceFile, string destinationFile ) : void
sourceFile string
destinationFile string
return void

OctopusPhysicalFileSystem() public method

public OctopusPhysicalFileSystem ( ILogger log ) : System
log ILogger
return System

OpenFile() public method

public OpenFile ( string path, FileAccess access, FileShare share ) : Stream
path string
access FileAccess
share FileShare
return Stream

OpenFile() public method

public OpenFile ( string path, FileMode mode, FileAccess access, FileShare share ) : Stream
path string
mode FileMode
access FileAccess
share FileShare
return Stream

OverwriteAndDelete() public method

public OverwriteAndDelete ( string originalFile, string temporaryReplacement ) : void
originalFile string
temporaryReplacement string
return void

OverwriteFile() public method

public OverwriteFile ( string path, string contents ) : void
path string
contents string
return void

ReadAllText() public method

public ReadAllText ( string scriptFile ) : string
scriptFile string
return string

ReadFile() public method

public ReadFile ( string path ) : string
path string
return string

RemoveInvalidFileNameChars() public method

public RemoveInvalidFileNameChars ( string path ) : string
path string
return string

Replace() public method

Creates, updates or skips a file based on a file content comparison
Useful for cases where you do not want a file's timestamp to change when overwriting it with identical contents or you want clearer logging as to what changed.
public Replace ( string oldFilePath, Stream newStream, int overwriteFileRetryAttempts = 3 ) : ReplaceStatus
oldFilePath string
newStream Stream
overwriteFileRetryAttempts int
return ReplaceStatus

WriteAllBytes() public method

public WriteAllBytes ( string filePath, byte data ) : void
filePath string
data byte
return void