// 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 { /// /// Provides a base class to use when developing custom processor components. All processors must derive from this class. /// public abstract class ContentProcessor : IContentProcessor { /// /// Initializes a new instance of the ContentProcessor class. /// protected ContentProcessor() { } /// /// Processes the specified input data and returns the result. /// /// Existing content object being processed. /// Contains any required custom process parameters. /// A typed object representing the processed input. public abstract TOutput Process(TInput input, ContentProcessorContext context); /// /// Gets the expected object type of the input parameter to IContentProcessor.Process. /// Type IContentProcessor.InputType { get { return typeof(TInput); } } /// /// Gets the object type returned by IContentProcessor.Process. /// Type IContentProcessor.OutputType { get { return typeof(TOutput); } } /// /// Processes the specified input data and returns the result. /// /// Existing content object being processed. /// Contains any required custom process parameters. /// The processed input. object IContentProcessor.Process(object input, ContentProcessorContext context) { if (input == null) throw new ArgumentNullException("input"); if (context == null) throw new ArgumentNullException("context"); if (!(input is TInput)) throw new InvalidOperationException("input is not of the expected type"); return Process((TInput)input, context); } } }