"Removed the SupportedPlatformsImpl classes and replaced them with a new SupportedPlatforms attribute on the assembly level. Removed a few class constructors which could cause problems when loading a game. Made ResetElapsedTime in the game class reset to 0 instead of TimeSpan.MinValue. Removed the restriction in the InputDeviceFactory for which InputDevices are supported. Added a Logger for Metro which works with the current Logger implementation. Changed that when a platform is recognized that is higher than Windows 8, it gets treated like Windows 8, not like Windows 7. Due to the SupportedPlatforms change, the assembly loader is now faster in finding out which assemblies contains addIns. For not Metro system, it's also added that a warning gets written if an AddIn references a different ANX version than that of the running assembly. OpenGL and DirectX have been updated to the newest versions. XAudio system uses now the same SharpDX version as all the other systems. ParameterBuffer for WindowsMetro gets now correctly created by considering the size constraints for constant buffers. Fixed an erroneous finalizer in the xaudio system. Made the metro projects convert to Windows 8.1, as Windows 8.0 is not supported by the newer SharpDX versions. It's now also necessary to use at least Visual Studio 2013 to build the Metro versions. Made the samples work again on Windows." "Fixed the creation of the swap chain for windows metro and removed the dependency of the Metro Rendersystem onto the Metro Platformsytem. All occurrences of WindowHandles have been replaced with a custom WindowHandle type which should work out of the box in most cases, but does still represent a breaking change to XNA. The ProjectConverter for Metro was adjusted so that with just changing the way the application is initialized, most projects that worked with ANX before should now work under win rt. The sample SimpleNoContent does now work out of the box for win rt, after a project conversion. The application name for win rt apps is now a guid, the display name stayed the same though. That's to be more compliant with the way win rt apps are normally created. The default namespace and namespace of the classes for the Sample "SimpleNoContent" is renamed from "SimpleModernUI" to "SimpleNoContent". With the new way win rt apps are initialized for ANX, it's necessary to first create the WindowsGameHost for WinRT with a handler how to create the game instance and give that to the CoreApplication object to run it. Also took care of a few annoying bugs when working with win rt and ANX where no InputDevices could be created on the first frame (Issue #1164 ) and that it wasn't possible to use the localfolder of the application on the first update and all the other stuff for which an instance of the Application class was necessary."
384 lines
10 KiB
C#
384 lines
10 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using ANXStatusComparer.Data;
|
|
using ANXStatusComparer.Excludes;
|
|
|
|
// This file is part of the ANX.Framework created by the
|
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
|
// For details see: http://anxframework.codeplex.com/license
|
|
|
|
namespace ANXStatusComparer
|
|
{
|
|
/// <summary>
|
|
/// The assembly comparer is the main logic component of the tool.
|
|
/// </summary>
|
|
public static class AssemblyComparer
|
|
{
|
|
#region Private
|
|
/// <summary>
|
|
/// Private caches of assemblies, so we don't need to pass them over
|
|
/// as parameters all the time.
|
|
/// </summary>
|
|
private static AssembliesData xnaAssemblies;
|
|
private static AssembliesData anxAssemblies;
|
|
private static IEnumerable<Exclude> excludes;
|
|
private static ResultData result;
|
|
#endregion
|
|
|
|
#region Compare
|
|
/// <summary>
|
|
/// Compare the assemblies of xna and anx and create a result data instance.
|
|
/// </summary>
|
|
/// <param name="xnaAssemblies">XNA assemblies.</param>
|
|
/// <param name="anxAssemblies">ANX assemblies.</param>
|
|
/// <param name="checkType">The type of check to do.</param>
|
|
/// <returns>Generated result data.</returns>
|
|
public static ResultData Compare(AssembliesData setXnaAssemblies,
|
|
AssembliesData setAnxAssemblies, CheckType checkType,
|
|
IEnumerable<Exclude> setExcludes)
|
|
{
|
|
xnaAssemblies = setXnaAssemblies;
|
|
anxAssemblies = setAnxAssemblies;
|
|
excludes = setExcludes;
|
|
|
|
result = new ResultData();
|
|
|
|
if (checkType == CheckType.All ||
|
|
(checkType | CheckType.Namespaces) == checkType)
|
|
{
|
|
CheckNamespaces();
|
|
}
|
|
|
|
if (checkType == CheckType.All ||
|
|
(checkType | CheckType.Structs) == checkType)
|
|
{
|
|
CheckStructs();
|
|
}
|
|
|
|
if (checkType == CheckType.All ||
|
|
(checkType | CheckType.Interfaces) == checkType)
|
|
{
|
|
CheckInterfaces();
|
|
}
|
|
|
|
if (checkType == CheckType.All ||
|
|
(checkType | CheckType.Classes) == checkType)
|
|
{
|
|
CheckClasses();
|
|
}
|
|
|
|
if (checkType == CheckType.All ||
|
|
(checkType | CheckType.Enumerations) == checkType)
|
|
{
|
|
CheckEnums();
|
|
}
|
|
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region CheckNamespaces
|
|
/// <summary>
|
|
/// Check all the namespaces.
|
|
/// </summary>
|
|
private static void CheckNamespaces()
|
|
{
|
|
if (xnaAssemblies.Namespaces == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
foreach (string name in xnaAssemblies.Namespaces.Keys)
|
|
{
|
|
if (xnaAssemblies.Namespaces[name].IsPublic == false)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
string compareName = TranslateNamespaceName(name);
|
|
|
|
if (anxAssemblies.Namespaces.ContainsKey(compareName) == false)
|
|
{
|
|
if (result.MissingNamespaces.Contains(name) == false)
|
|
{
|
|
result.MissingNamespaces.Add(name);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (result.ImplementedNamespaces.Contains(name) == false)
|
|
{
|
|
result.ImplementedNamespaces.Add(name);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region CheckInterfaces
|
|
private static void CheckInterfaces()
|
|
{
|
|
if (xnaAssemblies.Namespaces == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
foreach (string key in xnaAssemblies.Namespaces.Keys)
|
|
{
|
|
NamespaceData namespaceData = xnaAssemblies.Namespaces[key];
|
|
string compareName = TranslateNamespaceName(key);
|
|
|
|
foreach (string classKey in namespaceData.Interfaces.Keys)
|
|
{
|
|
CheckInterface(compareName, namespaceData.Interfaces[classKey]);
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void CheckInterface(string namespaceKey,
|
|
BaseObject xnaInterface)
|
|
{
|
|
// If the namespace is already missing, we can abort directly.
|
|
if (anxAssemblies.Namespaces.ContainsKey(namespaceKey) == false)
|
|
{
|
|
result.MissingInterfaces.Add(xnaInterface);
|
|
return;
|
|
}
|
|
|
|
NamespaceData anxNamespace = anxAssemblies.Namespaces[namespaceKey];
|
|
// Now check if we got this enum in the anx namespace.
|
|
if (anxNamespace.Interfaces.ContainsKey(xnaInterface.Handle.Name) == false)
|
|
{
|
|
result.MissingInterfaces.Add(xnaInterface);
|
|
return;
|
|
}
|
|
|
|
BaseObject anxInterface = anxNamespace.Interfaces[xnaInterface.Handle.Name];
|
|
|
|
ResultData.WrongObjectPair pair = new ResultData.WrongObjectPair()
|
|
{
|
|
XnaObject = xnaInterface,
|
|
AnxObject = anxInterface,
|
|
};
|
|
// Everything is present, so we do the in-depth checks.
|
|
if (xnaInterface.IsCorrect(anxInterface, excludes, pair) == false)
|
|
{
|
|
result.WrongInterfaces.Add(pair);
|
|
}
|
|
else
|
|
{
|
|
result.ImplementedInterfaces.Add(anxInterface);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region CheckClasses
|
|
private static void CheckClasses()
|
|
{
|
|
if (xnaAssemblies.Namespaces == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
foreach (string key in xnaAssemblies.Namespaces.Keys)
|
|
{
|
|
NamespaceData namespaceData = xnaAssemblies.Namespaces[key];
|
|
string compareName = TranslateNamespaceName(key);
|
|
|
|
foreach (string classKey in namespaceData.Classes.Keys)
|
|
{
|
|
CheckClass(compareName, namespaceData.Classes[classKey]);
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void CheckClass(string namespaceKey, BaseObject xnaClass)
|
|
{
|
|
// If the namespace is already missing, we can abort directly.
|
|
if (anxAssemblies.Namespaces.ContainsKey(namespaceKey) == false)
|
|
{
|
|
result.MissingClasses.Add(xnaClass);
|
|
return;
|
|
}
|
|
|
|
NamespaceData anxNamespace = anxAssemblies.Namespaces[namespaceKey];
|
|
// Now check if we got this enum in the anx namespace.
|
|
if (anxNamespace.Classes.ContainsKey(xnaClass.Handle.Name) == false)
|
|
{
|
|
result.MissingClasses.Add(xnaClass);
|
|
return;
|
|
}
|
|
|
|
BaseObject anxClass = anxNamespace.Classes[xnaClass.Handle.Name];
|
|
|
|
ResultData.WrongObjectPair pair = new ResultData.WrongObjectPair()
|
|
{
|
|
XnaObject = xnaClass,
|
|
AnxObject = anxClass,
|
|
};
|
|
// Everything is present, so we do the in-depth checks.
|
|
if (xnaClass.IsCorrect(anxClass, excludes, pair) == false)
|
|
{
|
|
result.WrongClasses.Add(pair);
|
|
}
|
|
else
|
|
{
|
|
result.ImplementedClasses.Add(anxClass);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region CheckStructs
|
|
private static void CheckStructs()
|
|
{
|
|
if (xnaAssemblies.Namespaces == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
foreach (string key in xnaAssemblies.Namespaces.Keys)
|
|
{
|
|
NamespaceData namespaceData = xnaAssemblies.Namespaces[key];
|
|
string compareName = TranslateNamespaceName(key);
|
|
|
|
foreach (string classKey in namespaceData.Structs.Keys)
|
|
{
|
|
CheckStruct(compareName, namespaceData.Structs[classKey]);
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void CheckStruct(string namespaceKey,
|
|
BaseObject xnaStruct)
|
|
{
|
|
// If the namespace is already missing, we can abort directly.
|
|
if (anxAssemblies.Namespaces.ContainsKey(namespaceKey) == false)
|
|
{
|
|
result.MissingStructs.Add(xnaStruct);
|
|
return;
|
|
}
|
|
|
|
NamespaceData anxNamespace = anxAssemblies.Namespaces[namespaceKey];
|
|
// Now check if we got this enum in the anx namespace.
|
|
if (anxNamespace.Structs.ContainsKey(xnaStruct.Handle.Name) == false)
|
|
{
|
|
result.MissingStructs.Add(xnaStruct);
|
|
return;
|
|
}
|
|
|
|
BaseObject anxStruct = anxNamespace.Structs[xnaStruct.Handle.Name];
|
|
|
|
ResultData.WrongObjectPair pair = new ResultData.WrongObjectPair()
|
|
{
|
|
XnaObject = xnaStruct,
|
|
AnxObject = anxStruct,
|
|
};
|
|
// Everything is present, so we do the in-depth checks.
|
|
if (xnaStruct.IsCorrect(anxStruct, excludes, pair) == false)
|
|
{
|
|
result.WrongStructs.Add(pair);
|
|
}
|
|
else
|
|
{
|
|
result.ImplementedStructs.Add(anxStruct);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region CheckEnums
|
|
/// <summary>
|
|
/// Compare all enumerations.
|
|
/// </summary>
|
|
private static void CheckEnums()
|
|
{
|
|
if (xnaAssemblies.Namespaces == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
foreach (string key in xnaAssemblies.Namespaces.Keys)
|
|
{
|
|
NamespaceData namespaceData = xnaAssemblies.Namespaces[key];
|
|
string compareName = TranslateNamespaceName(key);
|
|
|
|
foreach(string enumKey in namespaceData.Enums.Keys)
|
|
{
|
|
CheckEnum(compareName, namespaceData.Enums[enumKey]);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Compare a specific xna enumeration.
|
|
/// </summary>
|
|
/// <param name="namespaceKey">The name of the namespace this enum is in.
|
|
/// </param>
|
|
/// <param name="xnaEnum">XNA enumeration to compare.</param>
|
|
private static void CheckEnum(string namespaceKey, EnumData xnaEnum)
|
|
{
|
|
// If the namespace is already missing, we can abort directly.
|
|
if (anxAssemblies.Namespaces.ContainsKey(namespaceKey) == false)
|
|
{
|
|
result.MissingEnums.Add(xnaEnum);
|
|
return;
|
|
}
|
|
|
|
NamespaceData anxNamespace = anxAssemblies.Namespaces[namespaceKey];
|
|
// Now check if we got this enum in the anx namespace.
|
|
if (anxNamespace.Enums.ContainsKey(xnaEnum.Handle.Name) == false)
|
|
{
|
|
result.MissingEnums.Add(xnaEnum);
|
|
return;
|
|
}
|
|
|
|
EnumData anxEnum = anxNamespace.Enums[xnaEnum.Handle.Name];
|
|
|
|
// Everything is present, so we do the in-depth checks for names and
|
|
// values contained in the enumeration.
|
|
bool isWrong = false;
|
|
for (int index = 0; index < xnaEnum.Names.Count; index++)
|
|
{
|
|
int indexOfAnxValue = anxEnum.Names.IndexOf(xnaEnum.Names[index]);
|
|
if (indexOfAnxValue == -1)
|
|
{
|
|
isWrong = true;
|
|
break;
|
|
}
|
|
|
|
object value1 = anxEnum.Values.GetValue(indexOfAnxValue);
|
|
object value2 = xnaEnum.Values.GetValue(index);
|
|
if (value1.Equals(value2) == false)
|
|
{
|
|
isWrong = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (isWrong)
|
|
{
|
|
result.WrongEnums.Add(new KeyValuePair<EnumData, EnumData>(
|
|
xnaEnum, anxEnum));
|
|
}
|
|
else
|
|
{
|
|
result.ImplementedEnums.Add(anxEnum);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region TranslateNamespaceName
|
|
/// <summary>
|
|
/// Translate a namespace name if needed.
|
|
/// Used to get the ANX equivalent to the XNA namespace names.
|
|
/// </summary>
|
|
/// <param name="name">XNA namespace name.</param>
|
|
/// <returns>ANX valid namespace name.</returns>
|
|
public static string TranslateNamespaceName(string name)
|
|
{
|
|
name = name.Replace("Microsoft.Xna.", "ANX.");
|
|
return name;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|