C# Class 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.
Inheritance: IDisposable
Afficher le fichier Open project: vchelaru/FlatRedBall

Méthodes publiques

Méthode Description
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

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

Implements the standard .NET IDisposable pattern.

Private Methods

Méthode Description
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.

Method Details

Add() public méthode

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
Résultat void

Build() public méthode

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
Résultat string

Clear() public méthode

Removes all content files from the MSBuild project.
public Clear ( ) : void
Résultat void

ContentBuilder() public méthode

Creates a new content builder.
public ContentBuilder ( ) : System
Résultat System

Dispose() public méthode

Disposes the content builder when it is no longer required.
public Dispose ( ) : void
Résultat void

Dispose() protected méthode

Implements the standard .NET IDisposable pattern.
protected Dispose ( bool disposing ) : void
disposing bool
Résultat void

IsReferencingAssembly() public méthode

public IsReferencingAssembly ( string assemblyName ) : bool
assemblyName string
Résultat bool

ReferenceAssembly() public méthode

public ReferenceAssembly ( string assemblyName ) : void
assemblyName string
Résultat void

RemoveReferencedAssembly() public méthode

public RemoveReferencedAssembly ( string assemblyName ) : void
assemblyName string
Résultat void

Save() public méthode

public Save ( ) : void
Résultat void