Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    AssetResolver Class

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

    Helper to find available new asset locations and identifiers.

    System.Object → AssetResolver
    Derived from AssetResolver:

    public sealed class AssetResolver
    Name Description
    Constructors
    AssetResolver()

    Initializes a new instance of the AssetResolver class.

    AssetResolver(NamingHelper.ContainsLocationDelegate, AssetResolver.ContainsAssetWithIdDelegate)

    Initializes a new instance of the AssetResolver class.

    Properties
    AlwaysCreateNewId

    Gets or sets a value indicating whether to always generate a new id on RegisterId(AssetId, out AssetId).

    ContainsAssetWithId

    Gets or sets a delegate to test if an asset id is already used.

    ContainsLocation

    Gets or sets a delegate to test if a location is already used.

    ExistingIds

    Gets the asset ids already used.

    ExistingLocations

    Gets the locations already used.

    Methods
    FromPackage(Package)

    Creates a new AssetResolver using an existing package to check the existence of asset locations and ids.

    FromPackage(IList<Package>)

    Creates a new AssetResolver using an existing package to check the existence of asset locations and ids.

    RegisterId(AssetId, out AssetId)

    Registers an asset identifier for usage.

    RegisterLocation(UFile, out UFile)

    Finds a name available for a new asset. This method will try to create a name based on an existing name and will append "_" + (number++) on every try. The new location found is added to the known existing locations.

    | Improve this Doc View Source

    Constructors


    AssetResolver()

    Initializes a new instance of the AssetResolver class.

    public AssetResolver()

    AssetResolver(NamingHelper.ContainsLocationDelegate, AssetResolver.ContainsAssetWithIdDelegate)

    Initializes a new instance of the AssetResolver class.

    public AssetResolver(NamingHelper.ContainsLocationDelegate containsLocation, AssetResolver.ContainsAssetWithIdDelegate containsAssetWithId)
    Parameters
    Type Name Description
    Stride.Core.NamingHelper.ContainsLocationDelegate containsLocation

    The delegate used to check if an asset location is already used.

    AssetResolver.ContainsAssetWithIdDelegate containsAssetWithId

    The delegate used to check if an asset identifier is already used.

    | Improve this Doc View Source

    Properties


    AlwaysCreateNewId

    Gets or sets a value indicating whether to always generate a new id on RegisterId(AssetId, out AssetId).

    public bool AlwaysCreateNewId { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if [force new identifier]; otherwise, false.


    ContainsAssetWithId

    Gets or sets a delegate to test if an asset id is already used.

    public AssetResolver.ContainsAssetWithIdDelegate ContainsAssetWithId { get; set; }
    Property Value
    Type Description
    AssetResolver.ContainsAssetWithIdDelegate

    A delegate to test if an asset id is already used.


    ContainsLocation

    Gets or sets a delegate to test if a location is already used.

    public NamingHelper.ContainsLocationDelegate ContainsLocation { get; set; }
    Property Value
    Type Description
    Stride.Core.NamingHelper.ContainsLocationDelegate

    A delegate to test if a location is already used.


    ExistingIds

    Gets the asset ids already used.

    public HashSet<AssetId> ExistingIds { get; }
    Property Value
    Type Description
    System.Collections.Generic.HashSet<AssetId>

    The existing ids.


    ExistingLocations

    Gets the locations already used.

    public HashSet<string> ExistingLocations { get; }
    Property Value
    Type Description
    System.Collections.Generic.HashSet<System.String>

    The locations.

    | Improve this Doc View Source

    Methods


    FromPackage(Package)

    Creates a new AssetResolver using an existing package to check the existence of asset locations and ids.

    public static AssetResolver FromPackage(Package package)
    Parameters
    Type Name Description
    Package package

    The package.

    Returns
    Type Description
    AssetResolver

    A new AssetResolver.

    Exceptions
    Type Condition
    System.ArgumentNullException

    package


    FromPackage(IList<Package>)

    Creates a new AssetResolver using an existing package to check the existence of asset locations and ids.

    public static AssetResolver FromPackage(IList<Package> packages)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<Package> packages

    The packages.

    Returns
    Type Description
    AssetResolver

    A new AssetResolver.

    Exceptions
    Type Condition
    System.ArgumentNullException

    package


    RegisterId(AssetId, out AssetId)

    Registers an asset identifier for usage.

    public bool RegisterId(AssetId assetId, out AssetId newGuid)
    Parameters
    Type Name Description
    AssetId assetId

    The asset identifier.

    AssetId newGuid

    The new unique identifier if an asset has already been registered with the same id.

    Returns
    Type Description
    System.Boolean

    true if the asset id is already in used. newGuid contains a new guid, false otherwise.


    RegisterLocation(UFile, out UFile)

    Finds a name available for a new asset. This method will try to create a name based on an existing name and will append "_" + (number++) on every try. The new location found is added to the known existing locations.

    public bool RegisterLocation(UFile location, out UFile newLocation)
    Parameters
    Type Name Description
    Stride.Core.IO.UFile location

    The location.

    Stride.Core.IO.UFile newLocation

    The new location.

    Returns
    Type Description
    System.Boolean

    true if there is a new location, false otherwise.


    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

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