improved configuration handling of ANX.StatusComparer

This commit is contained in:
Glatzemann 2012-11-20 13:57:31 +00:00 committed by Konstantin Koch
parent 0820e0d24f
commit 0f9b1f4c02
8 changed files with 56 additions and 44 deletions

View File

@ -207,6 +207,7 @@
<ComponentGroup Id="Tools" Directory="TOOLSFOLDER"> <ComponentGroup Id="Tools" Directory="TOOLSFOLDER">
<Component Id='ANX.Tools' Guid='{4EC562B1-DCE2-48C8-A29A-3EC6C1F588E0}'> <Component Id='ANX.Tools' Guid='{4EC562B1-DCE2-48C8-A29A-3EC6C1F588E0}'>
<File Id='ANXStatusComparer' Name='asc.exe' DiskId='1' Source='../bin/Release/asc.exe' /> <File Id='ANXStatusComparer' Name='asc.exe' DiskId='1' Source='../bin/Release/asc.exe' />
<File Id='ANXStatusComparerStyleSheet' Name='SummaryStyle.css' DiskId='1' Source='../bin/SummaryStyle.css' />
<File Id='ContentBuilder' Name='ContentBuilder.exe' DiskId='1' Source='../bin/Release/ContentBuilder.exe' /> <File Id='ContentBuilder' Name='ContentBuilder.exe' DiskId='1' Source='../bin/Release/ContentBuilder.exe' />
<File Id='ProjectConverter' Name='ProjectConverter.exe' DiskId='1' Source='../bin/tools/ProjectConverter.exe' /> <File Id='ProjectConverter' Name='ProjectConverter.exe' DiskId='1' Source='../bin/tools/ProjectConverter.exe' />
<File Id='XNBInspector' Name='ANX.Tools.XNBInspector.exe' DiskId='1' Source='../bin/Release/ANX.Tools.XNBInspector.exe' /> <File Id='XNBInspector' Name='ANX.Tools.XNBInspector.exe' DiskId='1' Source='../bin/Release/ANX.Tools.XNBInspector.exe' />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -58,14 +58,13 @@
<Compile Include="ResultData.cs" /> <Compile Include="ResultData.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="SummaryStyle.css"> <None Include="SummaryStyle.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </None>
<Content Include="SampleConfigFile.xml"> <None Include="SampleConfigFile.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Content> </None>
<Content Include="TDD.txt" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -79,6 +79,11 @@ namespace ANXStatusComparer
/// </summary> /// </summary>
private static void CheckNamespaces() private static void CheckNamespaces()
{ {
if (xnaAssemblies.Namespaces == null)
{
return;
}
foreach (string name in xnaAssemblies.Namespaces.Keys) foreach (string name in xnaAssemblies.Namespaces.Keys)
{ {
if (xnaAssemblies.Namespaces[name].IsPublic == false) if (xnaAssemblies.Namespaces[name].IsPublic == false)
@ -109,6 +114,11 @@ namespace ANXStatusComparer
#region CheckInterfaces #region CheckInterfaces
private static void CheckInterfaces() private static void CheckInterfaces()
{ {
if (xnaAssemblies.Namespaces == null)
{
return;
}
foreach (string key in xnaAssemblies.Namespaces.Keys) foreach (string key in xnaAssemblies.Namespaces.Keys)
{ {
NamespaceData namespaceData = xnaAssemblies.Namespaces[key]; NamespaceData namespaceData = xnaAssemblies.Namespaces[key];
@ -161,6 +171,11 @@ namespace ANXStatusComparer
#region CheckClasses #region CheckClasses
private static void CheckClasses() private static void CheckClasses()
{ {
if (xnaAssemblies.Namespaces == null)
{
return;
}
foreach (string key in xnaAssemblies.Namespaces.Keys) foreach (string key in xnaAssemblies.Namespaces.Keys)
{ {
NamespaceData namespaceData = xnaAssemblies.Namespaces[key]; NamespaceData namespaceData = xnaAssemblies.Namespaces[key];
@ -212,6 +227,11 @@ namespace ANXStatusComparer
#region CheckStructs #region CheckStructs
private static void CheckStructs() private static void CheckStructs()
{ {
if (xnaAssemblies.Namespaces == null)
{
return;
}
foreach (string key in xnaAssemblies.Namespaces.Keys) foreach (string key in xnaAssemblies.Namespaces.Keys)
{ {
NamespaceData namespaceData = xnaAssemblies.Namespaces[key]; NamespaceData namespaceData = xnaAssemblies.Namespaces[key];
@ -267,6 +287,11 @@ namespace ANXStatusComparer
/// </summary> /// </summary>
private static void CheckEnums() private static void CheckEnums()
{ {
if (xnaAssemblies.Namespaces == null)
{
return;
}
foreach (string key in xnaAssemblies.Namespaces.Keys) foreach (string key in xnaAssemblies.Namespaces.Keys)
{ {
NamespaceData namespaceData = xnaAssemblies.Namespaces[key]; NamespaceData namespaceData = xnaAssemblies.Namespaces[key];

View File

@ -55,6 +55,13 @@ namespace ANXStatusComparer
#endregion #endregion
#region Constructor #region Constructor
public Configuration(String[] anxAssemblies, String stylesheet)
{
this.AnxAssemblies = anxAssemblies;
this.OutputType = "html";
this.StylesheetFile = stylesheet;
}
/// <summary> /// <summary>
/// Load a new configuration file from the specified filepath. /// Load a new configuration file from the specified filepath.
/// </summary> /// </summary>

View File

@ -29,6 +29,11 @@ namespace ANXStatusComparer.Data
/// <param name="filepaths">Filepaths to the assemblies to load.</param> /// <param name="filepaths">Filepaths to the assemblies to load.</param>
public AssembliesData(string[] filepaths) public AssembliesData(string[] filepaths)
{ {
if (filepaths == null)
{
return;
}
Namespaces = new Dictionary<string, NamespaceData>(); Namespaces = new Dictionary<string, NamespaceData>();
foreach (string file in filepaths) foreach (string file in filepaths)

View File

@ -24,17 +24,19 @@ namespace ANXStatusComparer
"./SampleConfigFile.xml" : "./SampleConfigFile.xml" :
args[0]; args[0];
if (File.Exists(configFilepath) == false) Configuration config;
if (File.Exists(configFilepath) == true)
{
// Load the config
config = new Configuration(configFilepath);
}
else
{ {
throw new FileNotFoundException("Failed to generate the status " + config = new Configuration(new String[] { Path.Combine(Environment.CurrentDirectory, "ANX.Framework.dll") }, Path.Combine(Environment.CurrentDirectory, "SummaryStyle.css"));
"because the configuration file '" + configFilepath +
"' doesn't exist! Aborting.");
} }
#endregion #endregion
// Load the config
Configuration config = new Configuration(configFilepath);
// Now load the actual assemblies and preparse them: // Now load the actual assemblies and preparse them:
// for xna... // for xna...
AssembliesData xnaAssemblies = new AssembliesData(config.XnaAssemblies); AssembliesData xnaAssemblies = new AssembliesData(config.XnaAssemblies);
@ -42,8 +44,7 @@ namespace ANXStatusComparer
AssembliesData anxAssemblies = new AssembliesData(config.AnxAssemblies); AssembliesData anxAssemblies = new AssembliesData(config.AnxAssemblies);
// Everything before was easy...now comes the main part. // Everything before was easy...now comes the main part.
ResultData result = AssemblyComparer.Compare(xnaAssemblies, anxAssemblies, ResultData result = AssemblyComparer.Compare(xnaAssemblies, anxAssemblies, CheckType.All);
CheckType.All);
switch(config.OutputType) switch(config.OutputType)
{ {

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Config> <Config>
<ANXAssemblies> <ANXAssemblies>
<Assembly>..\bin\Debug\ANX.Framework.dll</Assembly> <Assembly>ANX.Framework.dll</Assembly>
</ANXAssemblies> </ANXAssemblies>
<XNAAssemblies> <XNAAssemblies>
<Assembly>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.dll</Assembly> <Assembly>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.dll</Assembly>

View File

@ -1,26 +0,0 @@
- Command Line Tool (DONE)
- Input is Config-File (Xml) (DONE)
-> Paths to assemblies for:
-> XNA
-> ANX
- Reads from assemblies:
-> Namespaces (DONE)
-> Classes (DONE)
-> Structures (DONE)
-> Interfaces (DONE)
-> Enumerations (DONE)
- Cmd Parameter for which parts to compare (above)
- Compare XNA with ANX implementations
-> Equalities (DONE)
-> Missing stuff (DONE)
-> Wrong stuff (accessability, parameters, etc.) (DONE)
- Read Special Attributes in ANX for:
-> State description
-> Percentage complete
-> Percentage documentation complete
-> Percentage only raw construct