Table of Contents

Class ContentCollection

Namespace
MonoGame.Framework.Content.Pipeline.Builder
Assembly
MonoGame.Framework.Content.Pipeline.dll

Collection of rules on how the content should be handled.

The way this system works is by adding each call you make with include/exclude to a list of rules, then during the GetContentInfo(string, ref ContentInfo?) it will check if the filepath is valid for each one and return the last match it finds.

public class ContentCollection : IContentCollection
Inheritance
ContentCollection
Implements
Inherited Members

Methods

Exclude(string)

Marks the file at excludePath to be excluded from the content handling.

public void Exclude(string excludePath)

Parameters

excludePath string

Relative path to the content file.

Exclude<T>(string)

Marks the files that match the excludePattern to be excluded from the content handling.

public void Exclude<T>(string excludePattern) where T : ContentRule, new()

Parameters

excludePattern string

A pattern to use for exclusion of content files.

Type Parameters

T

A ContentRule to be used for matching the includePattern. Some built in options are:

WildcardRule - specifies that input pattern should be a wildcard.

RegexRule - specifies that input pattern should be a regex.

GetContentInfo(string, ref ContentInfo?)

Gets information about how the ocntent should be handled for the passed relative filepath.

public bool GetContentInfo(string filePath, ref ContentInfo? contentInfo)

Parameters

filePath string

Relative path to the content file.

contentInfo ContentInfo

ContentInfo describing the desired content handling.

Returns

bool

true if the content should be handled, false otherwise.

Include(string, IContentImporter?, IContentProcessor?)

Marks the file at inputPath to be built with specified settings.

public void Include(string inputPath, IContentImporter? contentImporter = null, IContentProcessor? contentProcessor = null)

Parameters

inputPath string

Relative path to the content file.

contentImporter IContentImporter

An IContentImporter to be used for the building, if its not specified, the system will use reflection to try to figure out an apropriate importer.

contentProcessor IContentProcessor

An IContentProcessor to be used for the building, if its not specified, the system will use reflection to try to figure out an apropriate processor.

Include(string, string, IContentImporter?, IContentProcessor?)

Marks the file at inputPath to be built with specified settings.

public void Include(string inputPath, string outputPath, IContentImporter? contentImporter = null, IContentProcessor? contentProcessor = null)

Parameters

inputPath string

Relative path to the content file.

outputPath string

Relative path for the output content, if its not specified, the inputPath will be used with .xnb extension.

contentImporter IContentImporter

An IContentImporter to be used for the building, if its not specified, the system will use reflection to try to figure out an apropriate importer.

contentProcessor IContentProcessor

An IContentProcessor to be used for the building, if its not specified, the system will use reflection to try to figure out an apropriate processor.

IncludeCopy(string, string?)

Marks the file at inputPath to be copied to the output directory.

public void IncludeCopy(string inputPath, string? outputPath)

Parameters

inputPath string

Relative path to the content file.

outputPath string

Relative path for the copy, if its not specified, the inputPath will be used.

IncludeCopy<T>(string, Func<string, string>?)

Marks the files that match the includePattern to be copied to the output directory.

public void IncludeCopy<T>(string includePattern, Func<string, string>? outputPath = null) where T : ContentRule, new()

Parameters

includePattern string

A pattern to use for building of content files.

outputPath Func<string, string>

Relative path for the output content, if its not specified, the relative filePath will be used with .xnb extension.

Type Parameters

T

A ContentRule to be used for matching the includePattern. Some built in options are:

WildcardRule - specifies that input pattern should be a wildcard.

RegexRule - specifies that input pattern should be a regex.

Include<T>(string, IContentImporter?, IContentProcessor?)

Marks the files that match the includePattern to be built with the specified settings.

public void Include<T>(string includePattern, IContentImporter? contentImporter = null, IContentProcessor? contentProcessor = null) where T : ContentRule, new()

Parameters

includePattern string

A pattern to use for building of content files.

contentImporter IContentImporter

An IContentImporter to be used for the building, if its not specified, the system will use reflection to try to figure out an apropriate importer.

contentProcessor IContentProcessor

An IContentProcessor to be used for the building, if its not specified, the system will use reflection to try to figure out an apropriate processor.

Type Parameters

T

A ContentRule to be used for matching the includePattern. Some built in options are:

WildcardRule - specifies that input pattern should be a wildcard.

RegexRule - specifies that input pattern should be a regex.

Include<T>(string, Func<string, string>, IContentImporter?, IContentProcessor?)

Marks the files that match the includePattern to be built with the specified settings.

public void Include<T>(string includePattern, Func<string, string> outputPath, IContentImporter? contentImporter = null, IContentProcessor? contentProcessor = null) where T : ContentRule, new()

Parameters

includePattern string

A pattern to use for building of content files.

outputPath Func<string, string>

A function that gives a relative output filepath for the specified relative content filepath.

contentImporter IContentImporter

An IContentImporter to be used for the building, if its not specified, the system will use reflection to try to figure out an apropriate importer.

contentProcessor IContentProcessor

An IContentProcessor to be used for the building, if its not specified, the system will use reflection to try to figure out an apropriate processor.

Type Parameters

T

A ContentRule to be used for matching the includePattern. Some built in options are:

WildcardRule - specifies that input pattern should be a wildcard.

RegexRule - specifies that input pattern should be a regex.

SetContentRoot(string)

Sets the content root path that will be used when generating the output paths during include methods.

public void SetContentRoot(string contentRoot)

Parameters

contentRoot string

Relative path that will get prefixed to the output paths.