Table of Contents

Class ModelPatternTokens

Namespace
CivitaiSharp.Tools.Downloads.Patterns
Assembly
CivitaiSharp.Tools.dll

Defines valid tokens for model file path patterns and extracts token values from model files.

public static class ModelPatternTokens
Inheritance
ModelPatternTokens
Inherited Members

Properties

AllTokens

The set of all valid token names when both ModelFile and ModelVersion are available.

public static FrozenSet<string> AllTokens { get; }

Property Value

FrozenSet<string>

FileOnlyTokens

The set of valid token names when only a ModelFile is available.

public static FrozenSet<string> FileOnlyTokens { get; }

Property Value

FrozenSet<string>

Methods

ExtractTokenValues(ModelFile)

Extracts token values from a model file for use in path pattern processing.

public static Dictionary<string, string> ExtractTokenValues(ModelFile file)

Parameters

file ModelFile

The model file to extract values from.

Returns

Dictionary<string, string>

A dictionary mapping token names to their values.

ExtractTokenValues(ModelFile, ModelVersion)

Extracts token values from a model file and model version for use in path pattern processing.

public static Dictionary<string, string> ExtractTokenValues(ModelFile file, ModelVersion version)

Parameters

file ModelFile

The model file to extract values from.

version ModelVersion

The model version providing additional context.

Returns

Dictionary<string, string>

A dictionary mapping token names to their values.

GetValidTokens(bool)

Determines the appropriate set of valid tokens based on whether a version is provided.

public static FrozenSet<string> GetValidTokens(bool hasVersion)

Parameters

hasVersion bool

Whether a ModelVersion is available.

Returns

FrozenSet<string>

The appropriate set of valid tokens.