Search Results for

    Show / Hide Table of Contents

    Class FileKit

    FileKit used to download content for the game as you play or sit in a loading screen.

    Inheritance
    System.Object
    FileKit
    Namespace: Pley
    Assembly: Pley.dll
    Syntax
    public static class FileKit : object

    Methods

    GetCloudStoragePath()

    Returns the directory where to put files to be synchronized.

    Declaration
    public static string GetCloudStoragePath()
    Returns
    Type Description
    System.String

    Returns the path to the directory (usually /pley/cloud_storage).

    GetCloudStoragePath(out String)

    Returns the directory where to put files to be synchronized.

    Declaration
    public static PleyResult GetCloudStoragePath(out string path)
    Parameters
    Type Name Description
    System.String path

    Returns the path to the directory (usually /pley/cloud_storage).

    Returns
    Type Description
    PleyResult

    If the operation was successful or not.

    GetFileSize(String)

    Gets the size of the file at the specified file path.

    Declaration
    public static int GetFileSize(string path)
    Parameters
    Type Name Description
    System.String path

    path to the file, e.g. StreamingAssets/myfile.json

    Returns
    Type Description
    System.Int32

    Returns the size of the file at the file path or 0 if any errors.

    GetFileSize(String, out Int32)

    Gets the size of the file at the specified file path.

    Declaration
    public static PleyResult GetFileSize(string path, out int size)
    Parameters
    Type Name Description
    System.String path

    path to the file, e.g. StreamingAssets/myfile.json

    System.Int32 size

    output parameter giving the size of the file at the file path

    Returns
    Type Description
    PleyResult

    Returns result whether succeeds or not, possible errors are the following: FlkFileTooBig, FlkFileNotFound

    GetFileURL(String)

    Get the url of a file, used for videos UnityEngine.Video.VideoPlayer.url

    Declaration
    public static string GetFileURL(string filepath)
    Parameters
    Type Name Description
    System.String filepath

    The specified file path

    Returns
    Type Description
    System.String

    The url

    GetFileURL(String, out String)

    Get the url of a file, for example for use with videos UnityEngine.Video.VideoPlayer.url

    Declaration
    public static PleyResult GetFileURL(string filepath, out string url)
    Parameters
    Type Name Description
    System.String filepath

    The specified file path

    System.String url

    Returns the file url

    Returns
    Type Description
    PleyResult

    Possible errors are the following: FlkFileNotFound, FlkFileTooBig

    PreloadFile(String)

    Preloads a file, making it available for reading later.

    Declaration
    public static PleyResult PreloadFile(string filepath)
    Parameters
    Type Name Description
    System.String filepath

    The specified file path to preload

    Returns
    Type Description
    PleyResult

    Returns whether able to preload the file or not, it can return FlkFileNotFound

    ReadFileAsync(String)

    Reads the file at the specified file path.

    Declaration
    public static async Task<(PleyResult, FileKit.ReadFileData)> ReadFileAsync(string path)
    Parameters
    Type Name Description
    System.String path

    The specified path to read from.

    Returns
    Type Description
    Task<System.ValueTuple<PleyResult, FileKit.ReadFileData>>

    Possible errors are the following: FlkFileNotFound, FlkFileTooBig

    ReadFileNonAllocAsync(String, Byte[])

    Reads the file at the specified file path without allocating a new byte array.

    Declaration
    public static async Task<(PleyResult, FileKit.ReadFileData)> ReadFileNonAllocAsync(string path, byte[] data)
    Parameters
    Type Name Description
    System.String path

    The specified path to read from.

    System.Byte[] data

    The byte buffer to load the file content into.

    Returns
    Type Description
    Task<System.ValueTuple<PleyResult, FileKit.ReadFileData>>

    Possible errors are the following: FlkFileNotFound, FlkFileTooBig, FlkBufferTooSmall

    StartFileQueue()

    Start the download file queue

    Declaration
    public static PleyResult StartFileQueue()
    Returns
    Type Description
    PleyResult

    If the operation was successful or not.

    StopFileQueue()

    Stop the download file queue

    Declaration
    public static PleyResult StopFileQueue()
    Returns
    Type Description
    PleyResult

    If the operation was successful or not.

    SyncCloudStorageAsync()

    Synchronize all files in the cloud storage directory.

    Declaration
    public static async Task<PleyResult> SyncCloudStorageAsync()
    Returns
    Type Description
    Task<PleyResult>
    In This Article
    Back to top Generated by DocFX