forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ContentImporter.cs
48 lines (43 loc) · 2.68 KB
/
ContentImporter.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using System;
namespace Microsoft.Xna.Framework.Content.Pipeline
{
/// <summary>
/// Implements a file format importer for use with game assets.
/// Importers, either provided by the framework or written by a developer, must derive from ContentImporter, as well as being marked with a ContentImporterAttribute.
/// An importer should produce results in the standard intermediate object model. If an asset has information not supported by the object model, the importer should output it as opaque data (key/value attributes attached to the relevant object). By following this procedure, a content pipeline can access specialized digital content creation (DCC) tool information, even when that information has not been fully standardized into the official object model.
/// You can also design custom importers that accept and import types containing specific third-party extensions to the object model.
/// </summary>
public abstract class ContentImporter<T> : IContentImporter
{
/// <summary>
/// Initializes a new instance of ContentImporter.
/// </summary>
protected ContentImporter()
{
}
/// <summary>
/// Called by the framework when importing a game asset. This is the method called by XNA when an asset is to be imported into an object that can be recognized by the Content Pipeline.
/// </summary>
/// <param name="filename">Name of a game asset file.</param>
/// <param name="context">Contains information for importing a game asset, such as a logger interface.</param>
/// <returns>Resulting game asset.</returns>
public abstract T Import(string filename, ContentImporterContext context);
/// <summary>
/// Called by the framework when importing a game asset. This is the method called by XNA when an asset is to be imported into an object that can be recognized by the Content Pipeline.
/// </summary>
/// <param name="filename">Name of a game asset file.</param>
/// <param name="context">Contains information for importing a game asset, such as a logger interface.</param>
/// <returns>Resulting game asset.</returns>
Object IContentImporter.Import(string filename, ContentImporterContext context)
{
if (filename == null)
throw new ArgumentNullException("filename");
if (context == null)
throw new ArgumentNullException("context");
return Import(filename, context);
}
}
}