TriLib
Search Results for

    Show / Hide Table of Contents

    Class FileUtils

    Represents a series of file utility methods.

    Inheritance
    object
    FileUtils
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: TriLibCore.Utils
    Assembly: TriLibCore.dll
    Syntax
    public static class FileUtils

    Methods

    FindFile(string, string, bool)

    Tries to find a file at the given path.

    Declaration
    public static string FindFile(string basePath, string originalPath, bool recursively = false)
    Parameters
    Type Name Description
    string basePath

    The base path to do the search.

    string originalPath

    The original file path.

    bool recursively

    Should the file be searched recursively?

    Returns
    Type Description
    string

    The file path, if found, otherwise, null.

    GetFileDirectory(string)

    Gets the given file directory.

    Declaration
    public static string GetFileDirectory(string filename)
    Parameters
    Type Name Description
    string filename

    The full filename.

    Returns
    Type Description
    string

    The file directory.

    GetFileExtension(string, bool)

    Gets the given file extension.

    Declaration
    public static string GetFileExtension(string path, bool includeDot = true)
    Parameters
    Type Name Description
    string path

    The file name.

    bool includeDot

    If true, includes the dot (.) in the result.

    Returns
    Type Description
    string

    The filename extension.

    GetFilename(string)

    Gets the file name from the given path.

    Declaration
    public static string GetFilename(string path)
    Parameters
    Type Name Description
    string path

    The full file path.

    Returns
    Type Description
    string

    The filename.

    GetFilenameWithoutExtension(string)

    Gets the given file name without the extension.

    Declaration
    public static string GetFilenameWithoutExtension(string filename)
    Parameters
    Type Name Description
    string filename

    The full filename.

    Returns
    Type Description
    string

    The filename without extension.

    GetShortFilename(string)

    Gets the given file name with the extension.

    Declaration
    public static string GetShortFilename(string filename)
    Parameters
    Type Name Description
    string filename

    The full filename.

    Returns
    Type Description
    string

    The short filename.

    LoadFileData(string)

    Synchronously loads all the file data.

    Declaration
    public static byte[] LoadFileData(string filename)
    Parameters
    Type Name Description
    string filename

    The full filename.

    Returns
    Type Description
    byte[]

    The file data.

    LoadFileStream(string)

    Creates a file Stream for the given filename.

    Declaration
    public static FileStream LoadFileStream(string filename)
    Parameters
    Type Name Description
    string filename

    The full filename.

    Returns
    Type Description
    FileStream

    The created FileStream.

    SanitizePath(string)

    Normalizes a path (replaces slashes with backslashes).

    Declaration
    public static string SanitizePath(string path)
    Parameters
    Type Name Description
    string path

    The original Path.

    Returns
    Type Description
    string

    The normalized path.

    TrySaveFileAtPersistentDataPath(AssetLoaderContext, string, string, IEnumerator<byte>, out string, Action<IEnumerator<byte>, string>)

    Tries to save an embedded file at the persistent data path.

    Declaration
    public static bool TrySaveFileAtPersistentDataPath(AssetLoaderContext assetLoaderContext, string objectName, string filename, IEnumerator<byte> inputData, out string finalPath, Action<IEnumerator<byte>, string> decoder = null)
    Parameters
    Type Name Description
    AssetLoaderContext assetLoaderContext
    string objectName
    string filename
    IEnumerator<byte> inputData
    string finalPath
    Action<IEnumerator<byte>, string> decoder
    Returns
    Type Description
    bool
    In this article
    Back to top Generated by DocFX