C# Класс FlatRedBall.Content.ContentBuilder

This class wraps the MSBuild functionality needed to build XNA Framework content dynamically at runtime. It creates a temporary MSBuild project in memory, and adds whatever content files you choose to this project. It then builds the project, which will create compiled .xnb content files in a temporary directory. After the build finishes, you can use a regular ContentManager to load these temporary .xnb files in the usual way.
Наследование: IDisposable
Показать файл Открыть проект

Открытые методы

Метод Описание
Add ( string filename, string name, string importer, string processor ) : void

Adds a new content file to the MSBuild project. The importer and processor are optional: if you leave the importer null, it will be autodetected based on the file extension, and if you leave the processor null, data will be passed through without any processing.

Build ( ) : string

Builds all the content files which have been added to the project, dynamically creating .xnb files in the OutputDirectory. Returns an error message if the build fails.

Clear ( ) : void

Removes all content files from the MSBuild project.

ContentBuilder ( ) : System

Creates a new content builder.

Dispose ( ) : void

Disposes the content builder when it is no longer required.

IsReferencingAssembly ( string assemblyName ) : bool
ReferenceAssembly ( string assemblyName ) : void
RemoveReferencedAssembly ( string assemblyName ) : void
Save ( ) : void

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

Implements the standard .NET IDisposable pattern.

Приватные методы

Метод Описание
CreateBuildProject ( ) : void

Creates a temporary MSBuild content project in memory.

CreateTempDirectory ( ) : void

Creates a temporary directory in which to build content.

DeleteTempDirectory ( ) : void

Deletes our temporary directory when we are finished with it.

PurgeStaleTempDirectories ( ) : void

Ideally, we want to delete our temp directory when we are finished using it. The DeleteTempDirectory method (called by whichever happens first out of Dispose or our finalizer) does exactly that. Trouble is, sometimes these cleanup methods may never execute. For instance if the program crashes, or is halted using the debugger, we never get a chance to do our deleting. The next time we start up, this method checks for any temp directories that were left over by previous runs which failed to shut down cleanly. This makes sure these orphaned directories will not just be left lying around forever.

Описание методов

Add() публичный Метод

Adds a new content file to the MSBuild project. The importer and processor are optional: if you leave the importer null, it will be autodetected based on the file extension, and if you leave the processor null, data will be passed through without any processing.
public Add ( string filename, string name, string importer, string processor ) : void
filename string
name string
importer string
processor string
Результат void

Build() публичный Метод

Builds all the content files which have been added to the project, dynamically creating .xnb files in the OutputDirectory. Returns an error message if the build fails.
public Build ( ) : string
Результат string

Clear() публичный Метод

Removes all content files from the MSBuild project.
public Clear ( ) : void
Результат void

ContentBuilder() публичный Метод

Creates a new content builder.
public ContentBuilder ( ) : System
Результат System

Dispose() публичный Метод

Disposes the content builder when it is no longer required.
public Dispose ( ) : void
Результат void

Dispose() защищенный Метод

Implements the standard .NET IDisposable pattern.
protected Dispose ( bool disposing ) : void
disposing bool
Результат void

IsReferencingAssembly() публичный Метод

public IsReferencingAssembly ( string assemblyName ) : bool
assemblyName string
Результат bool

ReferenceAssembly() публичный Метод

public ReferenceAssembly ( string assemblyName ) : void
assemblyName string
Результат void

RemoveReferencedAssembly() публичный Метод

public RemoveReferencedAssembly ( string assemblyName ) : void
assemblyName string
Результат void

Save() публичный Метод

public Save ( ) : void
Результат void