Example #1
0
 /// <summary>
 ///     Adds a new <see cref="IContentSerializationReader" /> to the content pipeline.
 /// </summary>
 /// <param name="type">   The type the reader can read. </param>
 /// <param name="reader"> The <see cref="IContentSerializationReader" />. </param>
 /// <exception cref="ArgumentNullException"> Thrown when one or more required arguments are null. </exception>
 /// <exception cref="CSReaderException">     Thrown when a Create struct Reader error condition occurs. </exception>
 public static void AddReader(Type type, IContentSerializationReader reader)
 {
     if (reader == null)
     {
         throw new ArgumentNullException(nameof(reader));
     }
     if (!s_contentPipeLineReaders.ContainsKey(type))
     {
         s_contentPipeLineReaders.Add(type, reader);
         AddAssembly(type.Assembly);
         return;
     }
     throw new CSReaderException(
               "The content pipeline has already registered a reader of the type: '" + type + "'");
 }
Example #2
0
 /// <summary>
 ///     Adds a new content pipeline reader to the content pipeline.
 /// </summary>
 /// <typeparam name="T"> Generic type parameter. </typeparam>
 /// <param name="reader"> The <see cref="IContentSerializationReader" />. </param>
 public static void AddReader <T>(IContentSerializationReader reader)
 {
     AddReader(typeof(T), reader);
 }