Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    AssetFileSerializer Class

    Namespace: Stride.Core.Assets
    Assembly: Stride.Core.Assets.dll

    Main entry point for serializing/deserializing Asset.

    System.Object → AssetFileSerializer
    Derived from AssetFileSerializer:

    public static class AssetFileSerializer
    Name Description
    Fields
    Default

    The default serializer.

    Methods
    FindSerializer(String)

    Finds a serializer for the specified asset file extension.

    Load<T>(Stream, UFile, ILogger)
    Load<T>(String, ILogger)

    Deserializes an Asset from the specified stream.

    Register(IAssetSerializerFactory)

    Registers the specified serializer factory.

    Save(Stream, Object, AttachedYamlAssetMetadata, ILogger)

    Serializes an Asset to the specified stream.

    Save(String, Object, AttachedYamlAssetMetadata, ILogger)

    Serializes an Asset to the specified file path.

    | Improve this Doc View Source

    Fields


    Default

    The default serializer.

    public static readonly IAssetSerializer Default
    Field Value
    Type Description
    IAssetSerializer
    | Improve this Doc View Source

    Methods


    FindSerializer(String)

    Finds a serializer for the specified asset file extension.

    public static IAssetSerializer FindSerializer(string assetFileExtension)
    Parameters
    Type Name Description
    System.String assetFileExtension

    The asset file extension.

    Returns
    Type Description
    IAssetSerializer

    IAssetSerializerFactory.


    Load<T>(Stream, UFile, ILogger)

    public static AssetLoadResult<T> Load<T>(Stream stream, UFile filePath, ILogger log = null)
    Parameters
    Type Name Description
    System.IO.Stream stream
    Stride.Core.IO.UFile filePath
    ILogger log
    Returns
    Type Description
    AssetLoadResult<T>
    Type Parameters
    Name Description
    T

    Load<T>(String, ILogger)

    Deserializes an Asset from the specified stream.

    public static AssetLoadResult<T> Load<T>(string filePath, ILogger log = null)
    Parameters
    Type Name Description
    System.String filePath

    The file path.

    ILogger log

    The logger.

    Returns
    Type Description
    AssetLoadResult<T>

    An instance of Asset not a valid asset asset object file.

    Type Parameters
    Name Description
    T

    Type of the asset


    Register(IAssetSerializerFactory)

    Registers the specified serializer factory.

    public static void Register(IAssetSerializerFactory serializerFactory)
    Parameters
    Type Name Description
    IAssetSerializerFactory serializerFactory

    The serializer factory.

    Exceptions
    Type Condition
    System.ArgumentNullException

    serializerFactory


    Save(Stream, Object, AttachedYamlAssetMetadata, ILogger)

    Serializes an Asset to the specified stream.

    public static void Save(Stream stream, object asset, AttachedYamlAssetMetadata yamlMetadata, ILogger log = null)
    Parameters
    Type Name Description
    System.IO.Stream stream

    The stream.

    System.Object asset

    The asset object.

    AttachedYamlAssetMetadata yamlMetadata
    ILogger log

    The logger.

    Exceptions
    Type Condition
    System.ArgumentNullException

    stream or assetFileExtension


    Save(String, Object, AttachedYamlAssetMetadata, ILogger)

    Serializes an Asset to the specified file path.

    public static void Save(string filePath, object asset, AttachedYamlAssetMetadata yamlMetadata, ILogger log = null)
    Parameters
    Type Name Description
    System.String filePath

    The file path.

    System.Object asset

    The asset object.

    AttachedYamlAssetMetadata yamlMetadata
    ILogger log

    The logger.

    Exceptions
    Type Condition
    System.ArgumentNullException

    filePath


    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation