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">
<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='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='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' />

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">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -58,14 +58,13 @@
<Compile Include="ResultData.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="SummaryStyle.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="SampleConfigFile.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<None Include="SummaryStyle.css">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SampleConfigFile.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
</Content>
<Content Include="TDD.txt" />
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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>
private static void CheckNamespaces()
{
if (xnaAssemblies.Namespaces == null)
{
return;
}
foreach (string name in xnaAssemblies.Namespaces.Keys)
{
if (xnaAssemblies.Namespaces[name].IsPublic == false)
@ -109,6 +114,11 @@ namespace ANXStatusComparer
#region CheckInterfaces
private static void CheckInterfaces()
{
if (xnaAssemblies.Namespaces == null)
{
return;
}
foreach (string key in xnaAssemblies.Namespaces.Keys)
{
NamespaceData namespaceData = xnaAssemblies.Namespaces[key];
@ -161,6 +171,11 @@ namespace ANXStatusComparer
#region CheckClasses
private static void CheckClasses()
{
if (xnaAssemblies.Namespaces == null)
{
return;
}
foreach (string key in xnaAssemblies.Namespaces.Keys)
{
NamespaceData namespaceData = xnaAssemblies.Namespaces[key];
@ -212,6 +227,11 @@ namespace ANXStatusComparer
#region CheckStructs
private static void CheckStructs()
{
if (xnaAssemblies.Namespaces == null)
{
return;
}
foreach (string key in xnaAssemblies.Namespaces.Keys)
{
NamespaceData namespaceData = xnaAssemblies.Namespaces[key];
@ -267,6 +287,11 @@ namespace ANXStatusComparer
/// </summary>
private static void CheckEnums()
{
if (xnaAssemblies.Namespaces == null)
{
return;
}
foreach (string key in xnaAssemblies.Namespaces.Keys)
{
NamespaceData namespaceData = xnaAssemblies.Namespaces[key];

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<Config>
<ANXAssemblies>
<Assembly>..\bin\Debug\ANX.Framework.dll</Assembly>
<Assembly>ANX.Framework.dll</Assembly>
</ANXAssemblies>
<XNAAssemblies>
<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