Table of Contents

Class AssetUtility

Namespace
Uncreated.Warfare.Util
Assembly
Uncreated.Warfare.dll
public static class AssetUtility
Inheritance
AssetUtility
Inherited Members

Methods

FindAsset<TAsset>(string, out int, bool)

public static TAsset? FindAsset<TAsset>(string name, out int numberOfSimilarNames, bool additionalCheckWithoutNonAlphanumericCharacters = true) where TAsset : Asset

Parameters

name string
numberOfSimilarNames int
additionalCheckWithoutNonAlphanumericCharacters bool

Returns

TAsset

Type Parameters

TAsset

GetAssetCategory(Type)

Returns the asset category (SDG.Unturned.EAssetType) of assetType.

[Pure]
public static EAssetType GetAssetCategory(Type assetType)

Parameters

assetType Type

Returns

EAssetType

GetAssetCategory<TAsset>()

Returns the asset category (SDG.Unturned.EAssetType) of TAsset. Efficiently cached.

[Pure]
public static EAssetType GetAssetCategory<TAsset>() where TAsset : Asset

Returns

EAssetType

Type Parameters

TAsset

GetAssetCategory<TAsset>(TAsset)

Returns the asset category (SDG.Unturned.EAssetType) of TAsset. Efficiently cached usually.

[Pure]
public static EAssetType GetAssetCategory<TAsset>(TAsset asset) where TAsset : Asset

Parameters

asset TAsset

Returns

EAssetType

Type Parameters

TAsset

GetItemType(ClothingType)

public static EItemType GetItemType(this ClothingType type)

Parameters

type ClothingType

Returns

EItemType

Exceptions

ArgumentOutOfRangeException

Thrown if type is not a valid value.

LoadAsset(string, AssetOrigin)

Synchronously loads an asset file.

public static string[]? LoadAsset(string filePath, AssetOrigin origin)

Parameters

filePath string
origin AssetOrigin

Returns

string[]

A list of all errors.

ReadFileWithoutHash(string)

public static IDatDictionary ReadFileWithoutHash(string path)

Parameters

path string

Returns

IDatDictionary

SyncAssetsFromOrigin(AssetOrigin)

public static void SyncAssetsFromOrigin(AssetOrigin origin)

Parameters

origin AssetOrigin

TryGetAsset<TAsset>(string, out TAsset?, out bool, bool, Predicate<TAsset>?)

public static bool TryGetAsset<TAsset>(string assetName, out TAsset? asset, out bool multipleResultsFound, bool allowMultipleResults = false, Predicate<TAsset>? selector = null) where TAsset : Asset

Parameters

assetName string
asset TAsset
multipleResultsFound bool
allowMultipleResults bool
selector Predicate<TAsset>

Returns

bool

Type Parameters

TAsset

TryGetAssets<TAsset>(string, Predicate<TAsset>?, bool)

public static List<TAsset> TryGetAssets<TAsset>(string assetName, Predicate<TAsset>? selector = null, bool pool = false) where TAsset : Asset

Parameters

assetName string
selector Predicate<TAsset>
pool bool

Returns

List<TAsset>

Type Parameters

TAsset