<PackageReference Include="Relativity.Server.Utility.SDK" Version="5000.0.0" />

File

public class File : IFileHelper
public class BaseException : Exception

public class Downloader

Provides methods for chunked-downloads of a file.

public class HTMLizer

public class LineCounter

Counts the lines of files.

public class Logger

public class Uploader

Provides methods for chunked-uploads of a file.

public const int KILOBYTE_FILE_SIZE = 1024

public static File Instance { get; }

Gets the singleton instance of File.

protected File()

Initializes a new, empty, instance of File.

public string ConvertIllegalCharactersInFilename(string input, string convertTo = "_")

Replace known illegal characters in the provided string with the provided conversion string.

public virtual void Copy(string sourceFileName, string destFileName)

Copies the specified file to the specified destination.

public void Copy(string sourceFilePath, string destinationFilePath, bool overwrite)

Copies the specified file to the specified destination, optionally overwriting the file at the destination.

public int CountFilesInDirectory(string directoryName, bool includeSubDirectories)

Counts the files in the specified directory.

public int CountFilesInDirectory(DirectoryInfo dir, bool includeSubDirectories)

Counts the files in the specified directory.

public int CountLinesInFile(string path)

Counts the number of lines in the file specified by the provided path.

public FileStream Create(string filePath)

Creates a file at the provided path.

public FileStream Create(string filePath, bool append)

Opens a filestream over the provided path, optionally with append capablilites.

public virtual void CreateTextFile(string path, string bodyText, Encoding encoding)

Creates a file at the specified path with the provided text, using the specified encoding.

public void Delete(IEnumerable<string> deleteFileList)

Delete Files in a list

public virtual void Delete(string filePath)

Deletes the specified file path.

public virtual void Delete(FileInfo fileInfo)

Deletes the specified file.

public Task DeleteFilesTask(IEnumerable<string> fileList)

Background Deletion of Files

public virtual bool Exists(string filePath)

Determines if the file at the specified path exists.

public string GenerateHashForFile(string fileName)

Gets the SHA1 hash of the specified file.

public virtual long GetFileInfoLength(FileInfo fileInfo)

Gets the length of the specified file.

public string GetFileNameFromPath(string path)

Extracts the file name of the provided path.

public virtual long GetFileSize(string filePath)

Gets the file size of the specified file path.

public virtual string GetFullPath(string filePath)

Gets the full file path of the specified file.

public bool GetReadOnly(string path)

Indicates whether or not the specified File is read-only.

public long Length(string filename)

Gets the length, in bytes, of the specified file.

public void MakeNotReadOnly(string path)

Forces the file at the specified path to allow write.

public virtual void Move(string sourceFileName, string destFileName)

Moves the specified file to the specified destination.

public virtual byte[] ReadAllBytes(string filePath)

Opens a binary file, reads the contents of the file into a byte array, and then closes the file. Note: do not use if concerned with memory consumption (e.g. extra large files)

public virtual byte[] ReadFileAsByteArray(string fileName)

Reads the data of the specified file into an in-memory buffer.

public string ReadFileAsString(string path)

Reads the data of the specified file into an in-memory string.

public string ReadStringChunkFromFile(string path, int index, int count, Encoding encoding)

Reads a string of the specified length from the file.

public FileStream ReopenAndTruncate(string filePath, long position)

public void ValidateFile(string filePath)

Validates that a stream can be opened on the file.