Konstantin Koch 8287c54432 Included the Visual Studio extension and made the necessary changes to make it run.
Replaced the old VS templates with ones that offer more flexiblity.
Started replacing the Content Project for the samples with our custom project type.
Inlcuded a basic not yet working AssimpImporter.
2015-04-08 14:50:03 +02:00

42 lines
1.4 KiB
C#

using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.Development;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace ANX.Framework.Content.Pipeline.Helpers
{
public static class ClassPreloader
{
/// <summary>
/// Preloads all classes of the currently loaded assemblies that have the <see cref="PreloadAttribute"/>.
/// </summary>
public static void Preload()
{
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
{
Preload(assembly);
}
}
/// <summary>
/// Preloads all classes of the given <paramref name="assembly"/> that have the <see cref="PreloadAttribute"/>.
/// </summary>
/// <param name="assembly"></param>
public static void Preload(Assembly assembly)
{
foreach (Type type in assembly.GetTypes())
{
//The versions of anx might not always be the same, that's why we're checking for the typename and not the type itself.
//if (type.GetCustomAttributes(true).Any((x) => x.GetType().Name == "PreloadAttribute"))
if (type.GetCustomAttributes(typeof(PreloadAttribute), true).Any())
{
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(type.TypeHandle);
}
}
}
}
}