anx.framework/Tools/XNAToANXConverter/DefinesConverter.cs
SND\AstrorEnales_cp 5505f7dcbf - Added PlatformSystem Plugins layer
- Started Windows, Metro and Linux Platform-Plugins
- Moved the RecordingSample to the Samples folder
- Started two samples for using the graphics device in a WinForms and Wpf Editor
- Refactorings in the AddIn-System
- Moved the Window initialization-code to the Platform modules
- Changed the License text in all code files which is now way smaller
- Started ProjectConverter tool which converts all the projects and solution to the target configuration
- Changed the SupportedPlatform names in the Resource files
- Changed the WIN8 define to WINDOWSMETRO which is actually meant
- Removed NLog and started our own Logger class
- Many more stuff...
2012-08-09 09:45:04 +00:00

58 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Reflection;
namespace ProjectConverter
{
public static class DefinesConverter
{
private static List<string> platformDefines;
static DefinesConverter()
{
UpdateAllDefines();
}
#region UpdateAllDefines
private static void UpdateAllDefines()
{
platformDefines = new List<string>();
Assembly assembly = Assembly.GetExecutingAssembly();
Type[] allTypes = assembly.GetTypes();
foreach (Type type in allTypes)
{
if (typeof(Converter).IsAssignableFrom(type) &&
type.IsAbstract == false)
{
Converter converter = (Converter)Activator.CreateInstance(type);
platformDefines.Add(converter.Postfix.ToUpper());
}
}
}
#endregion
#region ConvertDefines
public static string ConvertDefines(string defines, string postfix)
{
var defineParts = new List<string>(defines.Split(';'));
defineParts.Insert(0, postfix.ToUpper());
string resultDefines = "";
for (int index = 0; index < defineParts.Count; index++)
{
string define = defineParts[index];
if (index == 0 ||
platformDefines.Contains(define) == false)
{
resultDefines = define + ";" + resultDefines;
}
}
return resultDefines;
}
#endregion
}
}