* Remove CorCompare.exe sources.
svn path=/trunk/mcs/; revision=120706
+2008-12-04 Jb Evain <jbevain@novell.com>
+
+ * Remove CorCompare.exe sources.
+
2008-12-04 Jb Evain <jbevain@novell.com>
* Makefile: don't build CorCompare.exe anymore as it's not even
+++ /dev/null
-// Mono.Util.CorCompare.CompletionInfo
-//
-// Author(s):
-// Piers Haken (piersh@friskit.com)
-//
-// (C) 2001-2002 Piers Haken
-
-using System;
-using System.Xml;
-using System.Collections;
-
-namespace Mono.Util.CorCompare
-{
- #region
- public struct CompletionType
- {
- private enum CompletionTypes
- {
- Present,
- Missing,
- Extra
- }
- private const int MASK_TYPE = 0x0f;
- private const int MASK_TODO = 0x10;
- //private const int MASK_ERROR = 0x20;
- private int m_type;
-
- private CompletionType (CompletionTypes type, bool fTodo)
- {
- m_type = (int) type;
-
- if (fTodo)
- m_type |= MASK_TODO;
- }
-
- public bool IsPresent
- {
- get { return Type == CompletionTypes.Present; }
- }
- public bool IsMissing
- {
- get { return Type == CompletionTypes.Missing; }
- }
- public bool IsExtra
- {
- get { return Type == CompletionTypes.Extra; }
- }
- public bool IsTodo
- {
- get { return (m_type & MASK_TODO) != 0; }
- }
- private CompletionTypes Type
- {
- get { return (CompletionTypes) (m_type & MASK_TYPE); }
- }
-
- public override string ToString ()
- {
- switch (Type)
- {
- case CompletionTypes.Missing:
- return "missing";
- case CompletionTypes.Extra:
- return "extra";
- case CompletionTypes.Present:
- return "present";
- default:
- throw new Exception ("Invalid CompletionType: "+Type);
- }
- }
-
- public static CompletionType Present
- {
- get { return new CompletionType (CompletionTypes.Present, false); }
- }
- public static CompletionType Missing
- {
- get { return new CompletionType (CompletionTypes.Missing, false); }
- }
- public static CompletionType Extra
- {
- get { return new CompletionType (CompletionTypes.Extra, false); }
- }
- public static CompletionType Compare (Object oMono, Object oMS)
- {
- if (oMono == null)
- return Missing;
- else if (oMS == null)
- return Extra;
- else
- return Present;
- }
- }
-
- /// <summary>
- /// Represents the amount of work done on a node
- /// </summary>
- /// <remarks>
- /// created by - Piersh
- /// created on - 3/2/2002 1:12:00 AM
- /// </remarks>
-
- public struct CompletionInfo
- {
- public int cPresent;
- public int cExtra;
- public int cMissing;
- public int cTodo;
-
- /// <summary>
- /// converts a CompletionTypes into a CompletionInfo
- /// sets the corresponding field to '1'
- /// </summary>
- /// <param name="ct">the CompletionTypes to convert</param>
- public CompletionInfo (CompletionType ct)
- {
- cPresent = cTodo = cMissing = cExtra = 0;
- if (ct.IsPresent)
- cPresent = 1;
- else if (ct.IsMissing)
- cMissing = 1;
- else if (ct.IsExtra)
- cExtra = 1;
-
- if (ct.IsTodo)
- cTodo = 1;
- }
-
- /// <summary>
- /// counts the total number of elements represented by this info
- /// </summary>
- public int cTotal
- {
- get
- {
- return cPresent + cTodo + cMissing;
- }
- }
-
- /// <summary>
- /// adds two CompletionInfos together
- /// </summary>
- /// <param name="m_nodeStatus"></param>
- public void Add (CompletionInfo m_nodeStatus)
- {
- cPresent += m_nodeStatus.cPresent;
- cTodo += m_nodeStatus.cTodo;
- cMissing += m_nodeStatus.cMissing;
- cExtra += m_nodeStatus.cExtra;
- }
-
- /// <summary>
- /// subtracts two CompletionInfos
- /// </summary>
- /// <param name="m_nodeStatus"></param>
- public void Sub (CompletionInfo m_nodeStatus)
- {
- cPresent -= m_nodeStatus.cPresent;
- cTodo -= m_nodeStatus.cTodo;
- cMissing -= m_nodeStatus.cMissing;
- cExtra -= m_nodeStatus.cExtra;
- if (cPresent < 0 || cTodo < 0 || cMissing < 0 || cExtra < 0)
- throw new Exception ("Completion underflow on subtract");
- }
-
- /// <summary>
- /// increments the corresponding field
- /// </summary>
- /// <param name="ct"></param>
- public void Add (CompletionType ct)
- {
- Add (new CompletionInfo (ct));
- }
- /// <summary>
- /// decrements the corresponding field
- /// </summary>
- /// <param name="ct"></param>
- public void Sub (CompletionType ct)
- {
- Sub (new CompletionInfo (ct));
- }
-
- /// <summary>
- /// adds appropriate 'missing', 'todo' & 'complete' attributes to an XmlElement
- /// </summary>
- /// <param name="elt"></param>
- public void SetAttributes (XmlElement elt)
- {
- elt.SetAttribute ("present", cPresent.ToString ());
- elt.SetAttribute ("missing", cMissing.ToString ());
- elt.SetAttribute ("extra", cExtra.ToString ());
- elt.SetAttribute ("todo", cTodo.ToString ());
-
- //int percentComplete = (cTotal == 0) ? 100 : (100 - 100 * (cMissing + cExtra) / cTotal);
- //elt.SetAttribute ("complete", percentComplete.ToString ());
- }
- }
-
- #endregion
-
- public enum PresenceTypes
- {
-// UNINITIALIZED = 0,
- Missing = 0,
- Present,
- Extra
- }
-
- public enum ErrorTypes
- {
- // TODO: order is important here... (see Status.SetError ())
-// UNINITIALIZED = 0,
- OK = 0,
- Todo,
- Warning,
- Error
- }
-
- public struct PresenceCounts
- {
- public int cMissing;
- public int cPresent;
- public int cExtra;
-
- public PresenceCounts (PresenceTypes type)
- {
- cMissing = cPresent = cExtra = 0;
- if (type == PresenceTypes.Missing)
- cMissing = 1;
- else if (type == PresenceTypes.Present)
- cPresent = 1;
- else if (type == PresenceTypes.Extra)
- cExtra = 1;
- else throw new Exception ("Invalid PresenceType");
- }
- public int Total
- {
- get { return cMissing + cPresent + cExtra; }
- }
- public void Add (PresenceCounts counts)
- {
- cMissing += counts.cMissing;
- cPresent += counts.cPresent;
- cExtra += counts.cExtra;
- }
- public void Sub (PresenceCounts counts)
- {
- cMissing -= counts.cMissing;
- cPresent -= counts.cPresent;
- cExtra -= counts.cExtra;
-
- if (cMissing < 0 || cPresent < 0 || cExtra < 0)
- throw new Exception ("Underflow");
- }
- public void Add (PresenceTypes type)
- {
- Add (new PresenceCounts (type));
- }
- public void Sub (PresenceTypes type)
- {
- Sub (new PresenceCounts (type));
- }
- public void SetAttributes (XmlElement elt, string strSuffix)
- {
- if (cMissing != 0)
- elt.SetAttribute ("missing"+strSuffix, cMissing.ToString ());
- if (cPresent != 0)
- elt.SetAttribute ("present"+strSuffix, cPresent.ToString ());
- if (cExtra != 0)
- elt.SetAttribute ("extra"+strSuffix, cExtra.ToString ());
- }
- }
-
- public struct ErrorCounts
- {
- public int cOK;
- public int cTodo;
- public int cWarning;
- public int cError;
-
- public ErrorCounts (ErrorTypes type)
- {
- cOK = cTodo = cWarning = cError = 0;
- if (type == ErrorTypes.OK)
- cOK = 1;
- else if (type == ErrorTypes.Todo)
- cTodo = 1;
- else if (type == ErrorTypes.Warning)
- cWarning = 1;
- else if (type == ErrorTypes.Error)
- cError = 1;
- else throw new Exception ("Invalid ErrorType");
- }
- public int Total
- {
- get { return cOK + cTodo + cWarning + cError; }
- }
- public void Add (ErrorCounts counts)
- {
- cOK += counts.cOK;
- cTodo += counts.cTodo;
- cWarning += counts.cWarning;
- cError += counts.cError;
- }
- public void Sub (ErrorCounts counts)
- {
- cOK -= counts.cOK;
- cTodo -= counts.cTodo;
- cWarning -= counts.cWarning;
- cError -= counts.cError;
- if (cOK < 0 || cTodo < 0 || cWarning < 0 || cError < 0)
- throw new Exception ("Underflow");
- }
- public void Add (ErrorTypes type)
- {
- Add (new ErrorCounts (type));
- }
- public void Sub (ErrorTypes type)
- {
- Sub (new ErrorCounts (type));
- }
- public void SetAttributes (XmlElement elt, string strSuffix)
- {
- if (cOK != 0)
- elt.SetAttribute ("ok"+strSuffix, cOK.ToString ());
- if (cTodo != 0)
- elt.SetAttribute ("todo"+strSuffix, cTodo.ToString ());
- if (cWarning != 0)
- elt.SetAttribute ("warning"+strSuffix, cWarning.ToString ());
- if (cError != 0)
- elt.SetAttribute ("error"+strSuffix, cError.ToString ());
- }
- }
-
- public struct Status
- {
- public PresenceTypes presence;
- public ErrorTypes error;
-
- public string PresenceName
- {
- get
- {
- if (presence == PresenceTypes.Missing)
- return "missing";
- else if (presence == PresenceTypes.Present)
- return "present";
- else if (presence == PresenceTypes.Extra)
- return "extra";
- else throw new Exception ("Invalid PresenceType");
- }
- }
- public string ErrorName
- {
- get
- {
- if (error == ErrorTypes.OK)
- return "OK";
- else if (error == ErrorTypes.Todo)
- return "todo";
- else if (error == ErrorTypes.Warning)
- return "warning";
- else if (error == ErrorTypes.Error)
- return "error";
- else throw new Exception ("Invalid ErrorType");
- }
- }
- public void SetAttributes (XmlElement elt)
- {
- if (presence != PresenceTypes.Present)
- elt.SetAttribute ("presence", PresenceName);
- if (error != ErrorTypes.OK)
- elt.SetAttribute ("error", ErrorName);
- }
- }
-
- public struct StatusCounts
- {
- public PresenceCounts presenceCounts;
- public ErrorCounts errorCounts;
-
- public void Add (StatusCounts statusCounts)
- {
- presenceCounts.Add (statusCounts.presenceCounts);
- errorCounts.Add (statusCounts.errorCounts);
- if (presenceCounts.Total != errorCounts.Total)
- throw new Exception ("invalid status counts");
- }
- public void Sub (StatusCounts statusCounts)
- {
- presenceCounts.Sub (statusCounts.presenceCounts);
- errorCounts.Sub (statusCounts.errorCounts);
- if (presenceCounts.Total != errorCounts.Total)
- throw new Exception ("invalid status counts");
- }
- public void Add (Status status)
- {
- presenceCounts.Add (status.presence);
- errorCounts.Add (status.error);
- if (presenceCounts.Total != errorCounts.Total)
- throw new Exception ("invalid status counts");
- }
- public void Sub (Status status)
- {
- presenceCounts.Sub (status.presence);
- errorCounts.Sub (status.error);
- if (presenceCounts.Total != errorCounts.Total)
- throw new Exception ("invalid status counts");
- }
- public void SetAttributes (XmlElement elt, string strSuffix)
- {
- presenceCounts.SetAttributes (elt, strSuffix);
- errorCounts.SetAttributes (elt, strSuffix);
-
- int cTotal = presenceCounts.cMissing + presenceCounts.cPresent;
- int cIncomplete =
- presenceCounts.cMissing +
- errorCounts.cTodo +
- errorCounts.cWarning +
- errorCounts.cError;
-
- if (presenceCounts.Total != errorCounts.Total)
- throw new Exception ("invalid status counts");
-
- if (cTotal != 0)
- {
- int percentComplete = 100 * (cTotal - cIncomplete) / cTotal;
- elt.SetAttribute ("complete" + strSuffix, percentComplete.ToString ());
- }
- }
- }
-
- public class NodeMessage
- {
- protected string msg;
-
- public NodeMessage (string _msg)
- {
- msg = _msg;
- }
-
- public string Message
- {
- get { return msg; }
- }
- }
-
- public class NodeStatus
- {
- public Status status;
- protected StatusCounts statusCountsChildren;
- protected StatusCounts statusCountsTotal;
- protected IList lstWarnings;
-
- public NodeStatus ()
- {
- status.error = ErrorTypes.OK;
- }
-
- /// <summary>
- /// Constructs a NodeStatus by comparing the presence of two objects
- /// it only sets the status.presence field
- /// </summary>
- /// <param name="objMono"></param>
- /// <param name="objMS"></param>
- public NodeStatus (Object objMono, Object objMS)
- {
- status.error = ErrorTypes.OK;
- statusCountsChildren = statusCountsTotal = new StatusCounts ();
- if (objMono == null)
- status.presence = PresenceTypes.Missing;
- else if (objMS == null)
- status.presence = PresenceTypes.Extra;
- else
- status.presence = PresenceTypes.Present;
- }
- public void Add (NodeStatus statusChild)
- {
- if ((int) statusChild.status.error > (int) status.error)
- status.error = statusChild.status.error;
- statusCountsTotal.Add (statusChild.statusCountsTotal);
- statusCountsChildren.Add (statusChild.statusCountsChildren);
- }
- public void AddChildren (NodeStatus statusChild)
- {
- statusCountsTotal.Add (statusChild.statusCountsTotal);
- statusCountsTotal.Add (statusChild.status);
- statusCountsChildren.Add (statusChild.status);
- }
-
- public void SubChildren (NodeStatus statusChild)
- {
- statusCountsTotal.Sub (statusChild.statusCountsTotal);
- statusCountsTotal.Sub (statusChild.status);
- statusCountsChildren.Sub (statusChild.status);
- }
-
- public void Add (StatusCounts statusCounts)
- {
- statusCountsChildren.Add (statusCounts);
- statusCountsTotal.Add (statusCounts);
- }
-
- public void Sub (StatusCounts statusCounts)
- {
- statusCountsChildren.Sub (statusCounts);
- statusCountsTotal.Sub (statusCounts);
- }
-
- public void Add (Status status)
- {
- statusCountsChildren.Add (status);
- statusCountsTotal.Add (status);
- }
-
- public void Sub (Status status)
- {
- statusCountsChildren.Sub (status);
- statusCountsTotal.Sub (status);
- }
-
-
- public bool IsMissing
- {
- get { return status.presence == PresenceTypes.Missing; }
- }
- public bool IsPresent
- {
- get { return status.presence == PresenceTypes.Present; }
- }
- public bool IsExtra
- {
- get { return status.presence == PresenceTypes.Extra; }
- }
-
- public void SetAttributes (XmlElement elt)
- {
- status.SetAttributes (elt);
- statusCountsChildren.SetAttributes (elt, "");
- statusCountsTotal.SetAttributes (elt, "_total");
-
- // add any warning messages
- if (lstWarnings != null)
- {
- XmlElement eltWarnings = elt.OwnerDocument.CreateElement ("warnings");
- elt.AppendChild (eltWarnings);
- foreach (NodeMessage msg in lstWarnings)
- {
- XmlElement eltWarning = elt.OwnerDocument.CreateElement ("warning");
- eltWarnings.AppendChild (eltWarning);
- eltWarning.SetAttribute ("text", msg.Message);
- }
- }
-
- //int percentComplete = (cTotal == 0) ? 100 : (100 - 100 * (cMissing + cExtra) / cTotal);
- //elt.SetAttribute ("complete", percentComplete.ToString ());
- }
- public void SetError (ErrorTypes errorNew)
- {
- // TODO: assumes order of error values
- if ((int) errorNew > (int) status.error)
- status.error = errorNew;
- }
- public void AddWarning (string strWarning)
- {
- if (lstWarnings == null)
- lstWarnings = new ArrayList ();
- lstWarnings.Add (new NodeMessage (strWarning));
- SetError (ErrorTypes.Warning);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-// Mono.Util.CorCompare.CorCompareDriver
-//
-// Author(s):
-// Nick Drochak (ndrochak@gol.com)
-//
-// (C) 2001-2002 Nick Drochak
-
-using System;
-using System.IO;
-
-namespace Mono.Util.CorCompare {
-
- /// <summary>
- /// Handles command line arguments, and generates appropriate report(s)
- /// based on those arguments
- /// </summary>
- /// <remarks>
- /// created by - Nick
- /// created on - 2/20/2002 10:43:57 PM
- /// </remarks>
- public class CorCompareDriver
- {
- public static void Main(string[] args) {
- // make sure we were called with the proper usage
- if (args.Length < 1) {
- Console.WriteLine("Usage: CorCompare [-t][-n][-x outfile][-ms assembly][-f friendly_name] assembly_to_compare");
- return;
- }
-
- bool fList = false;
- string strXML = null;
- string strMono = args [args.Length - 1];
- string strMS = null;
- string strFriendly = null;
-
- for (int i = 0; i < args.Length-1; i++) {
- if (args [i] == "-t") {
- fList = true;
- }
- if (args [i] == "-n") {
- }
- if (args [i] == "-x") {
- strXML = args [++i];
- }
- if (args [i] == "-ms") {
- strMS = args [++i];
- }
- if (args [i] == "-f") {
- strFriendly = args [++i];
- }
- }
-
- if (strMS == null)
- strMS = Path.GetFileNameWithoutExtension (strMono);
-
- if (strFriendly == null)
- strFriendly = strMS;
-
- if (strXML == null)
- strXML = strFriendly + ".xml";
-
- ToDoAssembly td = ToDoAssembly.Load (strMono, strFriendly, strMS);
-
- if (fList)
- Console.WriteLine(td.CreateClassListReport());
-
- if (strXML != null)
- td.CreateXMLReport(strXML);
-
- }
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <PropertyGroup>\r
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
- <ProductVersion>9.0.30729</ProductVersion>\r
- <SchemaVersion>2.0</SchemaVersion>\r
- <ProjectGuid>{B70C3661-DFA1-40EF-B1BB-F6908F853870}</ProjectGuid>\r
- <OutputType>Exe</OutputType>\r
- <RootNamespace>CorCompare</RootNamespace>\r
- <AssemblyName>CorCompare</AssemblyName>\r
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>\r
- <FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugSymbols>true</DebugSymbols>\r
- <DebugType>full</DebugType>\r
- <Optimize>false</Optimize>\r
- <OutputPath>bin\Debug\</OutputPath>\r
- <DefineConstants>DEBUG;TRACE</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- <UseVSHostingProcess>false</UseVSHostingProcess>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>pdbonly</DebugType>\r
- <Optimize>true</Optimize>\r
- <OutputPath>bin\Release\</OutputPath>\r
- <DefineConstants>TRACE</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <ItemGroup>\r
- <Reference Include="System" />\r
- <Reference Include="System.Core">\r
- <RequiredTargetFramework>3.5</RequiredTargetFramework>\r
- </Reference>\r
- <Reference Include="System.XML" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <Compile Include="AssemblyResolver.cs" />\r
- <Compile Include="CompletionInfo.cs" />\r
- <Compile Include="CorCompare.cs" />\r
- <Compile Include="MissingAttribute.cs" />\r
- <Compile Include="MissingBase.cs" />\r
- <Compile Include="MissingConstructor.cs" />\r
- <Compile Include="MissingEvent.cs" />\r
- <Compile Include="MissingField.cs" />\r
- <Compile Include="MissingInterface.cs" />\r
- <Compile Include="MissingMember.cs" />\r
- <Compile Include="MissingMethod.cs" />\r
- <Compile Include="MissingNameSpace.cs" />\r
- <Compile Include="MissingNestedType.cs" />\r
- <Compile Include="MissingProperty.cs" />\r
- <Compile Include="MissingType.cs" />\r
- <Compile Include="ToDoAssembly.cs" />\r
- <Compile Include="Util.cs" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="..\..\class\Mono.Cecil\Mono.Cecil-2008.csproj">\r
- <Project>{D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE}</Project>\r
- <Name>Mono.Cecil-2008</Name>\r
- </ProjectReference>\r
- </ItemGroup>\r
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->\r
-</Project>
\ No newline at end of file
+++ /dev/null
-// Mono.Util.CorCompare.MissingAttribute
-//
-// Author(s):
-// Piers Haken (piersh@friskit.com)
-//
-// (C) 2001-2002 Piers Haken
-
-using System;
-using System.Xml;
-using System.Collections;
-using Mono.Cecil;
-
-namespace Mono.Util.CorCompare
-{
-
- /// <summary>
- /// Represents an Attribute that is completely missing
- /// </summary>
- /// <remarks>
- /// created by - Piersh
- /// created on - 3/2/2002 9:47:00 pm
- /// </remarks>
- class MissingAttribute : MissingBase
- {
- // e.g. <attribute name="Equals" status="missing"/>
- Object attributeMono;
- Object attributeMS;
- static Hashtable htIgnore;
-
- static MissingAttribute ()
- {
- htIgnore = new Hashtable ();
- htIgnore.Add ("System.Runtime.InteropServices.ClassInterfaceAttribute", null);
- htIgnore.Add ("System.Diagnostics.DebuggerHiddenAttribute", null);
- htIgnore.Add ("System.Diagnostics.DebuggerStepThroughAttribute", null);
- htIgnore.Add ("System.Runtime.InteropServices.GuidAttribute", null);
- htIgnore.Add ("System.Runtime.InteropServices.InterfaceTypeAttribute", null);
- htIgnore.Add ("System.Runtime.InteropServices.ComVisibleAttribute", null);
- htIgnore.Add ("System.Runtime.CompilerServices.InternalsVisibleToAttribute", null);
- }
-
- public MissingAttribute (Object _attributeMono, Object _attributeMS)
- {
- attributeMono = _attributeMono;
- attributeMS = _attributeMS;
- m_nodeStatus = new NodeStatus (attributeMono, attributeMS);
- }
-
- public override string Name
- {
- get { return Attribute.ToString (); }
- }
-
- public override string Type
- {
- get { return "attribute"; }
- }
-
- public override NodeStatus Analyze ()
- {
- return m_nodeStatus;
- }
-
-
- public Object Attribute
- {
- get { return (attributeMono != null) ? attributeMono : attributeMS; }
- }
-
- /// <summary>
- /// creates a map from a list of attributes
- /// the hashtable maps from name to attribute
- /// </summary>
- /// <param name="rgAttributes">the list of attributes</param>
- /// <returns>a map</returns>
- public static Hashtable GetAttributeMap (CustomAttributeCollection rgAttributes)
- {
- Hashtable map = new Hashtable ();
- foreach (CustomAttribute attribute in rgAttributes)
- {
- if (attribute != null)
- {
- string strName = attribute.Constructor.DeclaringType.FullName;
- if (!map.Contains (strName) && !htIgnore.Contains (strName))
- map.Add (strName, attribute);
- }
- }
- return map;
- }
-
- /// <summary>
- /// analyzes two sets of reflected attributes, generates a list
- /// of MissingAttributes according to the completion of the first set wrt the second.
- /// </summary>
- /// <param name="rgAttributesMono">mono attributes</param>
- /// <param name="rgAttributesMS">microsoft attributes</param>
- /// <param name="rgAttributes">where the results are put</param>
- /// <returns>completion info for the whole set</returns>
- public static NodeStatus AnalyzeAttributes (CustomAttributeCollection rgAttributesMono, CustomAttributeCollection rgAttributesMS, ArrayList rgAttributes)
- {
- NodeStatus nodeStatus = new NodeStatus ();
-
- Hashtable mapAttributesMono = (rgAttributesMono == null) ? new Hashtable () : MissingAttribute.GetAttributeMap (rgAttributesMono);
- Hashtable mapAttributesMS = (rgAttributesMS == null) ? new Hashtable () : MissingAttribute.GetAttributeMap (rgAttributesMS);
-
- foreach (Object attribute in mapAttributesMS.Values)
- {
- string strAttribute = attribute.ToString ();
- Object attributeMono = mapAttributesMono [strAttribute];
- MissingAttribute ma = new MissingAttribute (attributeMono, attribute);
- rgAttributes.Add (ma);
- NodeStatus nsAttribute = ma.Analyze ();
- nodeStatus.AddChildren (nsAttribute);
-
- if (attributeMono != null)
- mapAttributesMono.Remove (strAttribute);
- }
- foreach (Object attribute in mapAttributesMono.Values)
- {
- if (attribute.ToString ().EndsWith ("MonoTODOAttribute"))
- {
- nodeStatus.SetError (ErrorTypes.Todo);
- //nodeStatus.statusCountsChildren.errorCounts.Add (ErrorTypes.Todo);
- //nodeStatus.statusCountsTotal.errorCounts.Add (ErrorTypes.Todo);
- //nodeStatus.cTodo ++; // this is where ALL the 'todo's come from
- }
- else if (attribute.ToString ().EndsWith ("DllImportAttribute") || attribute.ToString ().EndsWith ("PreserveSigAttribute")) {
- // Ignore these
- }
- else
- {
- MissingAttribute ma = new MissingAttribute (attribute, null);
- rgAttributes.Add (ma);
- NodeStatus nsAttribute = ma.Analyze ();
- nodeStatus.AddChildren (nsAttribute);
- }
- }
- return nodeStatus;
- }
- }
-}
+++ /dev/null
-// Mono.Util.CorCompare.MissingBase
-//
-// Author(s):
-// Piers Haken (piersh@friskit.com)
-//
-// (C) 2001-2002 Piers Haken
-using System;
-using System.Xml;
-using System.Collections;
-using Mono.Cecil;
-
-namespace Mono.Util.CorCompare
-{
- /// <summary>
- /// Base class for all comparison items
- /// </summary>
- /// <remarks>
- /// created by - Piersh
- /// created on - 3/3/2002 10:23:24 AM
- /// </remarks>
- public abstract class MissingBase
- {
- protected NodeStatus m_nodeStatus;
- protected ArrayList rgAttributes;
- protected NodeStatus nsAttributes;
-
- public enum Accessibility
- {
- Public,
- Assembly,
- FamilyOrAssembly,
- Family,
- FamilyAndAssembly,
- Private,
- }
-
- /// <summary>
- /// The name of the element (eg "System.Xml")
- /// </summary>
- public abstract string Name { get ; }
-
- /// <summary>
- /// The type of the element (eg "namespace")
- /// </summary>
- public abstract string Type { get; }
-
- /// <summary>
- /// Generates an XmlElement describint this element
- /// </summary>
- /// <param name="doc">The document in which to create the element</param>
- /// <returns></returns>
- public virtual XmlElement CreateXML (XmlDocument doc)
- {
- XmlElement eltMissing = doc.CreateElement (Type);
- eltMissing.SetAttribute ("name", Name);
- //Status.status.SetAttributes (eltMissing);
- Status.SetAttributes (eltMissing);
-
- XmlElement eltAttributes = MissingBase.CreateMemberCollectionElement ("attributes", rgAttributes, nsAttributes, doc);
- if (eltAttributes != null)
- eltMissing.AppendChild (eltAttributes);
-
- return eltMissing;
- }
-
- public virtual NodeStatus Status
- {
- get { return m_nodeStatus; }
- }
-
- public abstract NodeStatus Analyze ();
-
- /// <summary>
- /// Creates an XmlElement grouping together a set of sub-elements
- /// </summary>
- /// <param name="name">the name of the element to create</param>
- /// <param name="rgMembers">a list of sub-elements</param>
- /// <param name="doc">the document in which to create the element</param>
- /// <returns></returns>
- public static XmlElement CreateMemberCollectionElement (string name, ArrayList rgMembers, NodeStatus ns, XmlDocument doc)
- {
- XmlElement element = null;
- if (rgMembers != null && rgMembers.Count > 0)
- {
- element = doc.CreateElement(name);
- foreach (MissingBase mm in rgMembers)
- element.AppendChild (mm.CreateXML (doc));
-
- //ns.SetAttributes (element);
- }
- return element;
- }
- protected void AddFakeAttribute (bool fMono, bool fMS, string strName)
- {
- if (fMono || fMS)
- {
- MissingAttribute ma = new MissingAttribute (
- (fMono) ? strName : null,
- (fMS) ? strName : null);
- ma.Analyze ();
- rgAttributes.Add (ma);
- nsAttributes.AddChildren (ma.Status);
- }
- }
-
- protected void AddFlagWarning (bool fMono, bool fMS, string strName)
- {
- if (!fMono && fMS)
- m_nodeStatus.AddWarning ("Should be " + strName);
- else if (fMono && !fMS)
- m_nodeStatus.AddWarning ("Should not be " + strName);
- }
-
- protected string AccessibilityToString (Accessibility ac)
- {
- switch (ac)
- {
- case Accessibility.Public:
- return "public";
- case Accessibility.Assembly:
- return "internal";
- case Accessibility.FamilyOrAssembly:
- return "protected internal";
- case Accessibility.Family:
- return "protected";
- case Accessibility.FamilyAndAssembly:
- return "protected"; // TODO:
- case Accessibility.Private:
- return "private";
- }
- throw new Exception ("Invalid accessibility: "+ac.ToString ());
- }
- }
-}
+++ /dev/null
-// Mono.Util.CorCompare.MissingConstructor
-//
-// Author(s):
-// Nick Drochak (ndrochak@gol.com)
-//
-// (C) 2001-2002 Nick Drochak
-
-using System;
-using Mono.Cecil;
-
-namespace Mono.Util.CorCompare {
-
- /// <summary>
- /// Represents a class event that is completely missing
- /// </summary>
- /// <remarks>
- /// created by - Nick
- /// created on - 2/24/2002 10:43:57 PM
- /// </remarks>
- class MissingConstructor : MissingMethod {
- // e.g. <method name="Equals" status="missing"/>
- public MissingConstructor (MethodDefinition infoMono, MethodDefinition infoMS) : base (infoMono, infoMS) { }
-
- public override string Type {
- get {
- return "constructor";
- }
- }
- }
-}
+++ /dev/null
-// Mono.Util.CorCompare.MissingEvent
-//
-// Author(s):
-// Nick Drochak (ndrochak@gol.com)
-//
-// (C) 2001-2002 Nick Drochak
-
-using System;
-using System.Xml;
-using Mono.Cecil;
-
-namespace Mono.Util.CorCompare {
-
- /// <summary>
- /// Represents a class event that is completely missing
- /// </summary>
- /// <remarks>
- /// created by - Nick
- /// created on - 2/24/2002 10:43:57 PM
- /// </remarks>
- class MissingEvent : MissingMember {
- // e.g. <method name="Equals" status="missing"/>
- public MissingEvent (EventDefinition infoMono, EventDefinition infoMS) : base (infoMono, infoMS) { }
- MissingMethod mmAdd;
- MissingMethod mmRemove;
- MissingMethod mmRaise;
-
- public override string Type {
- get {
- return "event";
- }
- }
-
- public override CustomAttributeCollection GetCustomAttributes (MemberReference mref) {
- return ((EventDefinition) mref).CustomAttributes;
- }
-
- public override Accessibility GetAccessibility (MemberReference mref) {
- //EventDefinition member = (EventDefinition) mref;
- return Accessibility.Public;
- }
-
- public override NodeStatus Analyze ()
- {
- m_nodeStatus = base.Analyze ();
-
- EventDefinition eiMono = (EventDefinition) mInfoMono;
- EventDefinition eiMS = (EventDefinition) mInfoMS;
-
- MethodDefinition miAddMono, miRemoveMono, miRaiseMono;
- if (eiMono == null)
- miAddMono = miRemoveMono = miRaiseMono = null;
- else
- {
- miAddMono = eiMono.AddMethod;
- miRemoveMono = eiMono.RemoveMethod;
- miRaiseMono = eiMono.InvokeMethod;
- }
-
- MethodDefinition miAddMS, miRemoveMS, miRaiseMS;
- if (eiMS == null)
- miAddMS = miRemoveMS = miRaiseMS = null;
- else
- {
- miAddMS = eiMS.AddMethod;
- miRemoveMS = eiMS.RemoveMethod;
- miRaiseMS = eiMS.InvokeMethod;
- }
-
- if (miAddMono != null || miAddMS != null)
- {
- mmAdd = new MissingMethod (miAddMono, miAddMS);
- m_nodeStatus.AddChildren (mmAdd.Analyze ());
- }
- if (miRemoveMono != null || miRemoveMS != null)
- {
- mmRemove = new MissingMethod (miRemoveMono, miRemoveMS);
- m_nodeStatus.AddChildren (mmRemove.Analyze ());
- }
- if (miRaiseMono != null || miRaiseMS != null)
- {
- mmRaise = new MissingMethod (miRemoveMono, miRemoveMS);
- m_nodeStatus.AddChildren (mmRaise.Analyze ());
- }
- return m_nodeStatus;
- }
-
- public override XmlElement CreateXML (XmlDocument doc)
- {
- XmlElement eltMember = base.CreateXML (doc);
-
- if (mInfoMono != null && mmRaise != null)
- {
- XmlElement eltAccessors = (XmlElement) eltMember.SelectSingleNode ("accessors");
- if (eltAccessors == null)
- {
- eltAccessors = doc.CreateElement ("accessors");
- eltMember.AppendChild (eltAccessors);
- }
- if (mmAdd != null)
- {
- XmlElement eltAdd = mmAdd.CreateXML (doc);
- eltAccessors.AppendChild (eltAdd);
- }
- if (mmRemove != null)
- {
- XmlElement eltRemove = mmRemove.CreateXML (doc);
- eltAccessors.AppendChild (eltRemove);
- }
- if (mmRaise != null)
- {
- XmlElement eltRaise = mmRaise.CreateXML (doc);
- eltAccessors.AppendChild (eltRaise);
- }
- }
- return eltMember;
- }
- }
-}
+++ /dev/null
-// Mono.Util.CorCompare.MissingField
-//
-// Author(s):
-// Nick Drochak (ndrochak@gol.com)
-//
-// (C) 2001-2002 Nick Drochak
-
-using System;
-using Mono.Cecil;
-
-namespace Mono.Util.CorCompare {
-
- /// <summary>
- /// Represents a class event that is completely missing
- /// </summary>
- /// <remarks>
- /// created by - Nick
- /// created on - 2/24/2002 10:43:57 PM
- /// </remarks>
- class MissingField : MissingMember {
- // e.g. <method name="Equals" status="missing"/>
- public MissingField (FieldDefinition infoMono, FieldDefinition infoMS) : base (infoMono, infoMS) { }
-
- public override string Type {
- get {
- return "field";
- }
- }
-
- public override CustomAttributeCollection GetCustomAttributes (MemberReference mref) {
- return ((FieldDefinition) mref).CustomAttributes;
- }
-
- public override Accessibility GetAccessibility (MemberReference mref) {
- FieldDefinition member = (FieldDefinition) mref;
- FieldAttributes maskedMemberAccess = member.Attributes & FieldAttributes.FieldAccessMask;
- if (maskedMemberAccess == FieldAttributes.Public)
- return Accessibility.Public;
- else if (maskedMemberAccess == FieldAttributes.Assembly)
- return Accessibility.Assembly;
- else if (maskedMemberAccess == FieldAttributes.FamORAssem)
- return Accessibility.FamilyOrAssembly;
- else if (maskedMemberAccess == FieldAttributes.Family)
- return Accessibility.Family;
- else if (maskedMemberAccess == FieldAttributes.FamANDAssem)
- return Accessibility.FamilyAndAssembly;
- else if (maskedMemberAccess == FieldAttributes.Private)
- return Accessibility.Private;
- throw new Exception ("Missing handler for Member " + mref.Name);
- }
-
- public override NodeStatus Analyze ()
- {
- base.Analyze ();
-
- if (mInfoMono != null && mInfoMS != null)
- {
- FieldDefinition fiMono = (FieldDefinition) mInfoMono;
- FieldDefinition fiMS = (FieldDefinition) mInfoMS;
- bool fiMonoIsNotSerialized = (fiMono.Attributes & FieldAttributes.NotSerialized) != 0;
- bool fiMSIsNotSerialized = (fiMS.Attributes & FieldAttributes.NotSerialized) != 0;
- bool fiMonoIsPinvokeImpl = (fiMono.Attributes & FieldAttributes.PInvokeImpl) != 0;
- bool fiMSIsPinvokeImpl = (fiMS.Attributes & FieldAttributes.PInvokeImpl) != 0;
- bool fiMonoIsInitOnly = (fiMono.Attributes & FieldAttributes.InitOnly) != 0;
- bool fiMSIsInitOnly = (fiMS.Attributes & FieldAttributes.InitOnly) != 0;
-
-
- AddFakeAttribute (fiMonoIsNotSerialized, fiMSIsNotSerialized, "System.NonSerializedAttribute");
- AddFakeAttribute (fiMonoIsPinvokeImpl, fiMSIsPinvokeImpl, "System.PInvokeImplAttribute");
-
- AddFlagWarning (fiMono.IsStatic, fiMS.IsStatic, "static");
- AddFlagWarning (fiMono.IsLiteral, fiMS.IsLiteral, "const");
- AddFlagWarning (fiMonoIsInitOnly, fiMSIsInitOnly, "readonly");
-
- string strTypeMono = fiMono.FieldType.FullName;
- string strTypeMS = fiMS.FieldType.FullName;
- if (strTypeMono != strTypeMS)
- {
- Status.AddWarning ("Invalid type: is '"+strTypeMono+"', should be '"+strTypeMS+"'");
- }
-
- try
- {
- if (fiMono.IsStatic && fiMS.IsStatic &&
- fiMono.IsLiteral && fiMS.IsLiteral)
- {
- byte[] objMono = fiMono.InitialValue;
- byte[] objMS = fiMS.InitialValue;
- long lMono = Convert.ToInt64 (objMono);
- long lMS = Convert.ToInt64 (objMS);
-
- if (lMono != lMS)
- {
- string strValMono = ((lMono < 0) ? "-0x" : "0x") + lMono.ToString ("x");
- string strValMS = ((lMS < 0) ? "-0x" : "0x") + lMS.ToString ("x");
- Status.AddWarning ("Invalid value: is '"+strValMono+"', should be '"+strValMS+"'");
- }
- }
- }
- catch (Exception) {}
- }
- return m_nodeStatus;
- }
- }
-}
+++ /dev/null
-// Mono.Util.CorCompare.MissingField
-//
-// Author(s):
-// Piers Haken (piersh@friskit.com)
-//
-// (C) 2002 Piers Haken
-
-using System;
-using Mono.Cecil;
-
-namespace Mono.Util.CorCompare
-{
-
- /// <summary>
- /// Represents an interface implemented on a class
- /// </summary>
- /// <remarks>
- /// created by - Piers
- /// created on - 10:34 AM 3/12/2002
- /// </remarks>
- class MissingInterface : MissingBase
- {
- protected TypeReference ifaceMono;
- protected TypeReference ifaceMS;
-
- // e.g. <method name="Equals" status="missing"/>
- public MissingInterface (TypeReference _ifaceMono, TypeReference _ifaceMS)
- {
- ifaceMono = _ifaceMono;
- ifaceMS = _ifaceMS;
- m_nodeStatus = new NodeStatus (ifaceMono, ifaceMS);
- }
-
- public override string Type
- {
- get { return "interface"; }
- }
- public override string Name
- {
- get { return Interface.FullName; }
- }
- protected TypeReference Interface
- {
- get { return (ifaceMono != null) ? ifaceMono : ifaceMS; }
- }
- public override NodeStatus Analyze ()
- {
- return m_nodeStatus;
- }
- }
-}
+++ /dev/null
-using System;
-using System.Xml;
-using System.Collections;
-using Mono.Cecil;
-
-namespace Mono.Util.CorCompare
-{
-
- /// <summary>
- /// Represents a generic member that is completely missing
- /// </summary>
- /// <remarks>
- /// created by - Piersh
- /// created on - 3/1/2002 3:37:00 am
- /// </remarks>
- abstract class MissingMember : MissingBase
- {
- // e.g. <method name="Equals" status="missing"/>
- protected MemberReference mInfoMono;
- protected MemberReference mInfoMS;
-
- public MissingMember (MemberReference infoMono, MemberReference infoMS)
- {
- mInfoMono = infoMono;
- mInfoMS = infoMS;
- m_nodeStatus = new NodeStatus (infoMono, infoMS);
- }
-
- public override string Name
- {
- get { return Info.Name; }
- }
-
- public abstract CustomAttributeCollection GetCustomAttributes (MemberReference mref);
-
- public abstract Accessibility GetAccessibility (MemberReference mref);
-
- public override NodeStatus Analyze ()
- {
- if (!Status.IsMissing)
- {
- rgAttributes = new ArrayList ();
- nsAttributes = MissingAttribute.AnalyzeAttributes (
- (mInfoMono == null) ? null : GetCustomAttributes (mInfoMono),
- (mInfoMS == null) ? null : GetCustomAttributes (mInfoMS),
- rgAttributes);
-
- if (mInfoMono != null && mInfoMS != null)
- {
- Accessibility acMono = GetAccessibility (mInfoMono);
- Accessibility acMS = GetAccessibility (mInfoMS);
- if (acMono != acMS)
- Status.AddWarning ("Should be "+AccessibilityToString (acMS));
- }
-
- m_nodeStatus.Add (nsAttributes);
- }
- return m_nodeStatus;
- }
-
- /// <summary>
- /// returns the MemberInfo for this member.
- /// if it's a missing member then the microsoft MemberInfo is returned instead
- /// </summary>
- public MemberReference Info
- {
- get { return (mInfoMono != null) ? mInfoMono : mInfoMS; }
- }
-
- /// <summary>
- /// returns the 'best' info for this member. the 'best' info is the microsoft info, if it's available, otherwise the mono info.
- /// </summary>
- public MemberReference BestInfo
- {
- get { return (mInfoMS != null) ? mInfoMS : mInfoMono; }
- }
-
- public static string GetUniqueName (MemberReference mi)
- {
- return mi.GetType().Name + mi.Name;//(mi.MemberType).ToString () + mi.ToString ();
- }
- }
-}
+++ /dev/null
-// Mono.Util.CorCompare.MissingMethod
-//
-// Author(s):
-// Nick Drochak (ndrochak@gol.com)
-//
-// (C) 2001-2002 Nick Drochak
-
-using System;
-using System.Text;
-using Mono.Cecil;
-
-namespace Mono.Util.CorCompare {
-
- /// <summary>
- /// Represents a class method that is completely missing
- /// </summary>
- /// <remarks>
- /// created by - Nick
- /// created on - 2/20/2002 10:43:57 PM
- /// </remarks>
- class MissingMethod : MissingMember
- {
- // e.g. <method name="Equals" status="missing"/>
- public MissingMethod (MethodDefinition infoMono, MethodDefinition infoMS) : base (infoMono, infoMS) { }
-
- public override string Name {
- get {
- string s = Info.ToString();
- int index = s.IndexOf(' ');
- return s.Substring(index + 1);
- }
- }
-
- public override CustomAttributeCollection GetCustomAttributes (MemberReference mref) {
- return ((MethodDefinition) mref).CustomAttributes;
- }
-
- public override Accessibility GetAccessibility (MemberReference mref) {
- MethodDefinition member = (MethodDefinition) mref;
- MethodAttributes maskedMemberAccess = member.Attributes & MethodAttributes.MemberAccessMask;
- if (maskedMemberAccess == MethodAttributes.Public)
- return Accessibility.Public;
- else if (maskedMemberAccess == MethodAttributes.Assem)
- return Accessibility.Assembly;
- else if (maskedMemberAccess == MethodAttributes.FamORAssem)
- return Accessibility.FamilyOrAssembly;
- else if (maskedMemberAccess == MethodAttributes.Family)
- return Accessibility.Family;
- else if (maskedMemberAccess == MethodAttributes.FamANDAssem)
- return Accessibility.FamilyAndAssembly;
- else if (maskedMemberAccess == MethodAttributes.Private)
- return Accessibility.Private;
- throw new Exception ("Missing handler for Member " + mref.Name);
- }
-
- public override string Type {
- get {
- return "method";
- }
- }
-
- public override NodeStatus Analyze ()
- {
- m_nodeStatus = base.Analyze ();
-
- if (mInfoMono != null && mInfoMS != null)
- {
- MethodDefinition miMono = (MethodDefinition) mInfoMono;
- MethodDefinition miMS = (MethodDefinition) mInfoMS;
-
- AddFlagWarning (miMono.IsAbstract, miMS.IsAbstract, "abstract");
- AddFlagWarning (miMono.IsStatic, miMS.IsStatic, "static");
- AddFlagWarning (miMono.IsVirtual && !miMono.IsFinal, miMS.IsVirtual && !miMS.IsFinal, "virtual");
- AddFlagWarning (miMono.IsConstructor, miMS.IsConstructor, "a constructor");
- //AddFlagWarning (miMono.IsFinal, miMS.IsFinal, "sealed");
- }
- return m_nodeStatus;
- }
- }
-}
+++ /dev/null
-// Mono.Util.CorCompare.MissingNameSpace
-//
-// Author(s):
-// Nick Drochak (ndrochak@gol.com)
-//
-// (C) 2001-2002 Nick Drochak
-
-using System;
-using System.Collections;
-using System.Xml;
-using Mono.Cecil;
-
-namespace Mono.Util.CorCompare {
-
- /// <summary>
- /// Represents a namespace that has missing and/or MonoTODO classes.
- /// </summary>
- /// <remarks>
- /// created by - Nick
- /// created on - 2/20/2002 10:43:57 PM
- /// </remarks>
- class MissingNameSpace : MissingBase
- {
- // e.g. <namespace name="System" missing="267" todo="453" complete="21">
- protected TypeDefinitionCollection rgTypesMono, rgTypesMS;
- string strNamespace;
- ArrayList rgTypes = new ArrayList ();
- protected static Hashtable htGhostTypes;
- static string[] rgstrGhostTypes = {"System.Object", "System.ValueType", "System.Delegate", "System.Enum"};
-
-
- static MissingNameSpace ()
- {
- htGhostTypes = new Hashtable ();
-
- foreach (string strGhostType in rgstrGhostTypes)
- {
- htGhostTypes.Add (strGhostType, null);
- }
- }
-
- public MissingNameSpace (string nameSpace, TypeDefinitionCollection _rgTypesMono, TypeDefinitionCollection _rgTypesMS)
- {
- strNamespace = nameSpace;
- rgTypesMono = _rgTypesMono;
- rgTypesMS = _rgTypesMS;
- m_nodeStatus = new NodeStatus (_rgTypesMono, _rgTypesMS);
- }
-
- public virtual string [] MissingTypeNames (bool f)
- {
- return null;
- }
-
- public virtual ArrayList ToDoTypeNames
- {
- get { return null; }
- }
-
- public override string Name
- {
- get { return strNamespace; }
- }
- public override string Type
- {
- get { return "namespace"; }
- }
-
-
- /// <summary>
- /// first we go through all the microsoft types adding any mono types that match, or missing types otherwise
- /// then we go through the unmatched mono types adding those
- /// uses a hashtable to speed up lookups
- /// </summary>
- /// <returns></returns>
- public override NodeStatus Analyze ()
- {
- Hashtable htMono = new Hashtable ();
- if (rgTypesMono != null)
- {
- foreach (TypeDefinition t in rgTypesMono)
- {
- htMono.Add (t.FullName, t);
- }
- }
- if (rgTypesMS != null)
- {
- foreach (TypeDefinition t in rgTypesMS)
- {
- TypeDefinition tMono = (TypeDefinition) htMono [t.FullName];
- MissingType mt = null;
- bool tIsPublic = (t.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.Public;
- if (tMono == null)
- {
- if (tIsPublic && !htGhostTypes.Contains (t.FullName))
- mt = new MissingType (null, t);
- }
- else
- {
- if (tIsPublic)
- {
- htMono.Remove (t.FullName);
- mt = new MissingType (tMono, t);
- }
- }
- if (mt != null)
- {
- NodeStatus nsType = mt.Analyze ();
- m_nodeStatus.AddChildren (nsType);
- rgTypes.Add (mt);
- }
- }
- }
- // do any mono types that aren't in microsoft's namespace
- foreach (TypeDefinition tMono in htMono.Values)
- {
- if ((tMono.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.Public)
- {
- MissingType tdt = new MissingType (tMono, null);
- NodeStatus nsType = tdt.Analyze ();
- m_nodeStatus.AddChildren (nsType);
- rgTypes.Add (tdt);
- }
- }
- return m_nodeStatus;
- }
-
- public override XmlElement CreateXML (XmlDocument doc)
- {
- XmlElement eltNameSpace = base.CreateXML (doc);
-
- // TODO: include complete namespaces?
-// if (m_nodeStatus.statusCountsTotal.cMissing > 0 || m_nodeStatus.statusCountsTotal.cTodo > 0)
- {
- XmlElement eltClasses = doc.CreateElement("classes");
- eltNameSpace.AppendChild (eltClasses);
-
- foreach (MissingType type in rgTypes)
- {
- XmlElement eltClass = type.CreateXML (doc);
- if (eltClass != null)
- eltClasses.AppendChild (eltClass);
- }
- }
- return eltNameSpace;
- }
-
-
- public static ArrayList GetNamespaces (TypeDefinitionCollection types)
- {
- ArrayList nsList = new ArrayList();
- foreach (TypeDefinition t in types)
- {
- if (!nsList.Contains(t.Namespace))
- {
- nsList.Add(t.Namespace);
- }
- }
- return nsList;
- }
- }
-}
-
+++ /dev/null
-// Mono.Util.CorCompare.MissingNestedType
-//
-// Author(s):
-// Nick Drochak (ndrochak@gol.com)
-//
-// (C) 2001-2002 Nick Drochak
-
-using System;
-//using System.Reflection;
-using Mono.Cecil;
-
-namespace Mono.Util.CorCompare {
-
- /// <summary>
- /// Represents a class event that is completely missing
- /// </summary>
- /// <remarks>
- /// created by - Nick
- /// created on - 2/24/2002 10:43:57 PM
- /// </remarks>
- class MissingNestedType : MissingMember {
- // e.g. <method name="Equals" status="missing"/>
- public MissingNestedType (TypeDefinition infoMono, TypeDefinition infoMS) : base (infoMono, infoMS) { }
-
- public override string Type {
- get {
- return "nestedType";
- }
- }
-
- public override Accessibility GetAccessibility (MemberReference mref) {
- TypeDefinition member = (TypeDefinition) mref;
- TypeAttributes maskedMVisibility = member.Attributes & TypeAttributes.VisibilityMask;
- if (maskedMVisibility == TypeAttributes.Public)
- return Accessibility.Public;
- else if (maskedMVisibility == TypeAttributes.NestedAssembly)
- return Accessibility.Assembly;
- else if (maskedMVisibility == TypeAttributes.NestedFamORAssem)
- return Accessibility.FamilyOrAssembly;
- else if (maskedMVisibility == TypeAttributes.NestedFamily)
- return Accessibility.Family;
- else if (maskedMVisibility == TypeAttributes.NestedFamANDAssem)
- return Accessibility.FamilyAndAssembly;
- else if (maskedMVisibility == TypeAttributes.NestedPrivate)
- return Accessibility.Private;
- throw new Exception ("Missing handler for Member " + mref.Name);
- }
-
- public override CustomAttributeCollection GetCustomAttributes (MemberReference mref) {
- return ((TypeDefinition) mref).CustomAttributes;
- }
-
- public override string Name
- {
- get { return Info.DeclaringType.Name + "+" + Info.Name; }
- }
-
- }
-}
+++ /dev/null
-// Mono.Util.CorCompare.MissingProperty
-//
-// Author(s):
-// Nick Drochak (ndrochak@gol.com)
-//
-// (C) 2001-2002 Nick Drochak
-
-using System;
-using System.Text;
-using System.Xml;
-using Mono.Cecil;
-
-namespace Mono.Util.CorCompare {
-
- /// <summary>
- /// Represents a missing property from a class
- /// </summary>
- /// <remarks>
- /// created by - Nick
- /// created on - 2/20/2002 10:43:57 PM
- /// </remarks>
- class MissingProperty : MissingMember
- {
- // e.g. <property name="Length" status="missing"/>
- public MissingProperty (PropertyDefinition infoMono, PropertyDefinition infoMS) : base (infoMono, infoMS) { }
-
- public override string Type
- {
- get { return "property"; }
- }
-
- protected MissingMethod mmGet;
- protected MissingMethod mmSet;
-
- public override CustomAttributeCollection GetCustomAttributes (MemberReference mref) {
- return ((PropertyDefinition) mref).CustomAttributes;
- }
-
- public override Accessibility GetAccessibility (MemberReference mref) {
- //PropertyDefinition member = (PropertyDefinition) mref;
- return Accessibility.Public;
- }
-
- public override NodeStatus Analyze ()
- {
- m_nodeStatus = base.Analyze ();
-
- PropertyDefinition piMono = (PropertyDefinition) mInfoMono;
- PropertyDefinition piMS = (PropertyDefinition) mInfoMS;
-
- MethodDefinition miGetMono, miSetMono;
- if (piMono == null)
- miGetMono = miSetMono = null;
- else
- {
- miGetMono = piMono.GetMethod;
- miSetMono = piMono.SetMethod;
- }
-
- MethodDefinition miGetMS, miSetMS;
- if (piMS == null)
- miGetMS = miSetMS = null;
- else
- {
- miGetMS = piMS.GetMethod;
- miSetMS = piMS.SetMethod;
- }
-
- if (miGetMono != null || miGetMS != null)
- {
- mmGet = new MissingMethod (miGetMono, miGetMS);
- m_nodeStatus.AddChildren (mmGet.Analyze ());
- }
- if (miSetMono != null || miSetMS != null)
- {
- mmSet = new MissingMethod (miSetMono, miSetMS);
- m_nodeStatus.AddChildren (mmSet.Analyze ());
- }
-
- if (piMono != null && piMS != null)
- {
- string strTypeMono = piMono.PropertyType.FullName;
- string strTypeMS = piMS.PropertyType.FullName;
- if (strTypeMono != strTypeMS)
- Status.AddWarning ("Invalid type: is '"+strTypeMono+"', should be '"+strTypeMS+"'");
- }
-
- return m_nodeStatus;
- }
-
- public override XmlElement CreateXML (XmlDocument doc)
- {
- XmlElement eltMember = base.CreateXML (doc);
-
- if (mInfoMono != null) // missing
- {
- if (mmGet != null || mmSet != null)
- {
- XmlElement eltAccessors = doc.CreateElement ("accessors");
- eltMember.AppendChild (eltAccessors);
-
- if (mmGet != null)
- {
- XmlElement eltGet = mmGet.CreateXML (doc);
- eltAccessors.AppendChild (eltGet);
- }
- if (mmSet != null)
- {
- XmlElement eltSet = mmSet.CreateXML (doc);
- eltAccessors.AppendChild (eltSet);
- }
- }
- }
- return eltMember;
- }
- }
-}
+++ /dev/null
-// Mono.Util.CorCompare.MissingType
-//
-// Author(s):
-// Nick Drochak (ndrochak@gol.com)
-//
-// (C) 2001-2002 Nick Drochak
-
-using System;
-using System.Xml;
-using System.Collections;
-using Mono.Cecil;
-using Mono.Util.CorCompare.Cecil;
-
-namespace Mono.Util.CorCompare
-{
-
- /// <summary>
- /// Represents a class method that missing.
- /// </summary>
- /// <remarks>
- /// created by - Nick
- /// created on - 2/20/2002 10:43:57 PM
- /// </remarks>
- class MissingType : MissingBase
- {
- // e.g. <class name="System.Byte" status="missing"/>
- // e.g. <class name="System.Array" status="todo" missing="5" todo="6" complete="45">
- TypeDefinition typeMono, typeMS;
-// ArrayList rgAttributes = new ArrayList ();
- ArrayList rgMethods = new ArrayList ();
- ArrayList rgProperties = new ArrayList ();
- ArrayList rgEvents = new ArrayList ();
- ArrayList rgFields = new ArrayList ();
- ArrayList rgConstructors = new ArrayList ();
- ArrayList rgNestedTypes = new ArrayList ();
- ArrayList rgInterfaces = new ArrayList ();
-// NodeStatus nsAttributes = new NodeStatus ();
- NodeStatus nsMethods = new NodeStatus ();
- NodeStatus nsProperties = new NodeStatus ();
- NodeStatus nsEvents = new NodeStatus ();
- NodeStatus nsFields = new NodeStatus ();
- NodeStatus nsConstructors = new NodeStatus ();
- NodeStatus nsNestedTypes = new NodeStatus ();
- NodeStatus nsInterfaces = new NodeStatus ();
-
- public MissingType (TypeDefinition _typeMono, TypeDefinition _typeMS)
- {
- typeMono = _typeMono;
- typeMS = _typeMS;
- m_nodeStatus = new NodeStatus (_typeMono, _typeMS);
- }
-
- public override string Name
- {
- get
- {
- TypeDefinition type = TypeInfoBest;
- if (type.DeclaringType != null)
- return type.DeclaringType.Name + "+" + type.Name;
- return type.Name;
- }
- }
-
- public override string Type
- {
- get
- {
- Console.WriteLine ("For: {0} -> {1}", Name, r);
- return r;
- }
-
- }
-
- string r {
- get {
- TypeDefinition type = TypeInfo;
-
- if (type.IsEnum)
- return "enum";
- else if (type.IsInterface)
- return "interface";
- else if (type.IsValueType)
- return "struct";
- else if (IsDelegate)
- return "delegate";
- else
- return "class";
- }
- }
-
- public TypeDefinition TypeInfo
- {
- get { return (typeMono != null) ? typeMono : typeMS; }
- }
-
- public TypeDefinition TypeInfoBest
- {
- get { return (typeMS == null) ? typeMono : typeMS; }
- }
-
- public bool IsDelegate
- {
- get
- {
- return TypeHelper.IsDelegate (TypeInfoBest);
- }
- }
-
- public MissingMember CreateMember (MemberReference infoMono, MemberReference infoMS, bool add)
- {
- MemberReference mref = (infoMono != null) ? infoMono : infoMS;
- MissingMember mm;
-
- if(mref.GetType().Equals(typeof(MethodDefinition)))
- {
- if (((MethodDefinition) mref).IsConstructor) {
- mm = new MissingConstructor((MethodDefinition) infoMono, (MethodDefinition) infoMS);
- if (add) {
- nsConstructors.AddChildren (mm.Status);
- rgConstructors.Add (mm);
- }
- }
- else {
- mm = new MissingMethod ((MethodDefinition) infoMono, (MethodDefinition) infoMS);
- if (add) {
- nsMethods.AddChildren (mm.Status);
- rgMethods.Add (mm);
- }
- }
- }
- else if (mref.GetType().Equals(typeof(PropertyDefinition)))
- {
- mm = new MissingProperty ((PropertyDefinition) infoMono, (PropertyDefinition) infoMS);
- if (add) {
- nsProperties.AddChildren (mm.Status);
- rgProperties.Add (mm);
- }
- }
- else if (mref.GetType().Equals(typeof(EventDefinition)))
- {
- mm = new MissingEvent ((EventDefinition) infoMono, (EventDefinition) infoMS);
- if (add) {
- nsEvents.AddChildren (mm.Status);
- rgEvents.Add (mm);
- }
- }
- else if (mref.GetType().Equals(typeof(FieldDefinition)))
- {
- mm = new MissingField ((FieldDefinition) infoMono, (FieldDefinition) infoMS);
- if (add) {
- nsFields.AddChildren (mm.Status);
- rgFields.Add (mm);
- }
- }
- else if (mref.GetType().Equals(typeof(TypeDefinition)) && ((TypeDefinition)mref).DeclaringType == null)//nested type
- {
- mm = new MissingNestedType ((TypeDefinition) infoMono, (TypeDefinition) infoMS);
- if (add) {
- nsNestedTypes.AddChildren (mm.Status);
- rgNestedTypes.Add (mm);
- }
- }
- else
- throw new Exception ("Unexpected MemberType");
-
- mm.Analyze ();
- return mm;
- }
-
- public void AddMember (MemberReference infoMono, MemberReference infoMS)
- {
- CreateMember (infoMono, infoMS, true);
- }
-
- public override XmlElement CreateXML (XmlDocument doc)
- {
- XmlElement eltClass = base.CreateXML (doc);
- XmlElement eltMember;
-
- eltMember = MissingBase.CreateMemberCollectionElement ("methods", rgMethods, nsMethods, doc);
- if (eltMember != null)
- eltClass.AppendChild (eltMember);
-
- eltMember = MissingBase.CreateMemberCollectionElement ("properties", rgProperties, nsProperties, doc);
- if (eltMember != null)
- eltClass.AppendChild (eltMember);
-
- eltMember = MissingBase.CreateMemberCollectionElement ("events", rgEvents, nsEvents, doc);
- if (eltMember != null)
- eltClass.AppendChild (eltMember);
-
- eltMember = MissingBase.CreateMemberCollectionElement ("fields", rgFields, nsFields, doc);
- if (eltMember != null)
- eltClass.AppendChild (eltMember);
-
- eltMember = MissingBase.CreateMemberCollectionElement ("constructors", rgConstructors, nsConstructors, doc);
- if (eltMember != null)
- eltClass.AppendChild (eltMember);
-
- eltMember = MissingBase.CreateMemberCollectionElement ("nestedTypes", rgNestedTypes, nsNestedTypes, doc);
- if (eltMember != null)
- eltClass.AppendChild (eltMember);
-
- eltMember = MissingBase.CreateMemberCollectionElement ("interfaces", rgInterfaces, nsInterfaces, doc);
- if (eltMember != null)
- eltClass.AppendChild (eltMember);
-
- return eltClass;
- }
-
- private static void FillMembersMap (Hashtable members, TypeDefinition type) {
- if (type != null) {
- foreach (PropertyDefinition p in type.Properties) {
- if (p.DeclaringType.Equals (type)) {
- string strName = MissingMember.GetUniqueName (p);
- members.Add (strName, p);
- }
- }
-
- foreach (EventDefinition e in type.Events) {
- if (e.DeclaringType.Equals (type)) {
- string strName = MissingMember.GetUniqueName (e);
- members.Add (strName, e);
- }
- }
-
- foreach (MethodDefinition c in type.Constructors) {
- if ((c.Attributes & MethodAttributes.MemberAccessMask) != MethodAttributes.Private) {
- string strName = MissingMember.GetUniqueName (c);
- members.Add (strName, c);
- }
- }
-
- foreach (MethodDefinition m in type.Methods) {
- if ((m.Attributes & MethodAttributes.MemberAccessMask) != MethodAttributes.Private && m.DeclaringType.Equals (type)) {
- string strName = MissingMember.GetUniqueName (m);
- members.Add (strName, m);
- }
- }
-
- foreach (FieldDefinition f in type.Fields) {
- if ((f.Attributes & FieldAttributes.FieldAccessMask) != FieldAttributes.Private && f.DeclaringType.Equals (type)) {
- string strName = MissingMember.GetUniqueName (f);
- members.Add (strName, f);
- }
- }
- }
- }
-
- public override NodeStatus Analyze ()
- {
- Hashtable htMono = new Hashtable ();
- FillMembersMap (htMono, typeMono);
-
- Hashtable htMS = new Hashtable ();
- FillMembersMap (htMS, typeMS);
-
- Hashtable htMethodsMS = new Hashtable ();
-
- foreach (MemberReference miMS in htMS)
- {
- string strNameUnique = MissingMember.GetUniqueName (miMS);
- MemberReference miMono = (MemberReference) htMono [strNameUnique];
- AddMember (miMono, miMS);
- if (miMono != null) {
- htMono.Remove (strNameUnique);
- }
-
- if ( miMS is MethodDefinition && !((MethodDefinition)miMS).IsConstructor)
- {
- string strNameMSFull = miMS.ToString ();
- int ichMS = strNameMSFull.IndexOf (' ');
- string strNameMS = strNameMSFull.Substring (ichMS + 1);
- if (!htMethodsMS.Contains (strNameMS))
- htMethodsMS.Add (strNameMSFull.Substring (ichMS + 1), miMS);
- }
- }
- foreach (MemberReference miMono in htMono.Values)//ADDED MEMBERS (not found in MS)
- {
- MissingMember mm = CreateMember (miMono, null, true);
- if (miMono is MethodDefinition && !((MethodDefinition)miMono).IsConstructor)
- {
- string strNameMonoFull = miMono.ToString ();
- int ichMono = strNameMonoFull.IndexOf (' ');
- string strNameMono = strNameMonoFull.Substring (ichMono + 1);
- MemberReference miMS = (MemberReference) htMethodsMS [strNameMono];
- if (miMS != null)
- {
- string strNameMSFull = miMS.ToString ();
- int ichMS = strNameMSFull.IndexOf (' ');
- string strReturnTypeMS = strNameMSFull.Substring (0, ichMS);
- string strReturnTypeMono = strNameMonoFull.Substring (0, ichMono);
- mm.Status.AddWarning ("Return type mismatch, is: '"+strReturnTypeMono+"' [should be: '"+strReturnTypeMS+"']");
- }
- }
- }
-
- // compare the attributes
- rgAttributes = new ArrayList ();
- nsAttributes = MissingAttribute.AnalyzeAttributes (
- (typeMono == null) ? null : typeMono.CustomAttributes,
- (typeMS == null) ? null : typeMS.CustomAttributes,
- rgAttributes);
-
- rgInterfaces = new ArrayList ();
- if (typeMono != null && typeMS != null)
- {
- // compare base types
- string strBaseMono = (typeMono.BaseType == null) ? null : typeMono.BaseType.FullName;
- string strBaseMS = ( typeMS.BaseType == null) ? null : typeMS.BaseType.FullName;
- if (strBaseMono != strBaseMS)
- {
- m_nodeStatus.AddWarning ("Base class mismatch, is '"+strBaseMono+"' [should be: '"+strBaseMS+"']");
- //Console.WriteLine ("WARNING: Base class mismatch on "+typeMono.FullName+", is: '"+strBaseMono+"' [should be: '"+strBaseMS+"']");
- }
-
- // compare the interfaces
- Hashtable htInterfacesMono = new Hashtable ();
- InterfaceCollection rgInterfacesMono = typeMono.Interfaces;
- foreach (TypeReference ifaceMono in rgInterfacesMono)
- {
- if (ifaceMono != null)
- {
- string strName = ifaceMono.FullName;
- htInterfacesMono.Add (strName, ifaceMono);
- }
- }
- InterfaceCollection rgInterfacesMS = typeMS.Interfaces;
- foreach (TypeReference ifaceMS in rgInterfacesMS)
- {
- if (ifaceMS != null)
- {
- string strName = ifaceMS.FullName;
- TypeReference ifaceMono = (TypeReference) htInterfacesMono [strName];
- MissingInterface mi = new MissingInterface (ifaceMono, ifaceMS);
- mi.Analyze ();
- rgInterfaces.Add (mi);
- if (ifaceMono != null)
- htInterfacesMono.Remove (strName);
- nsInterfaces.AddChildren (mi.Status);
- }
- }
- foreach (TypeReference ifaceMono in htInterfacesMono.Values)
- {
- MissingInterface mi = new MissingInterface (ifaceMono, null);
- mi.Analyze ();
- rgInterfaces.Add (mi);
- //Console.WriteLine ("WARNING: additional interface on "+typeMono.FullName+": '"+ifaceMono.FullName+"'");
- nsInterfaces.AddChildren (mi.Status);
- }
-
- // serializable attribute
- // AddFakeAttribute (typeMono.IsSerializable, typeMS.IsSerializable, "System.SerializableAttribute");
- AddFakeAttribute ((typeMono.Attributes & TypeAttributes.LayoutMask) == TypeAttributes.AutoLayout, (typeMS.Attributes & TypeAttributes.LayoutMask) == TypeAttributes.AutoLayout, "System.AutoLayoutAttribute");
- AddFakeAttribute ((typeMono.Attributes & TypeAttributes.LayoutMask) == TypeAttributes.ExplicitLayout, (typeMS.Attributes & TypeAttributes.LayoutMask) == TypeAttributes.ExplicitLayout, "System.ExplicitLayoutAttribute");
- AddFakeAttribute ((typeMono.Attributes & TypeAttributes.LayoutMask) == TypeAttributes.SequentialLayout, (typeMS.Attributes & TypeAttributes.LayoutMask) == TypeAttributes.SequentialLayout, "System.SequentialLayoutAttribute");
-
- Accessibility accessibilityMono = GetAccessibility (typeMono);
- Accessibility accessibilityMS = GetAccessibility (typeMS);
- if (accessibilityMono != accessibilityMS)
- m_nodeStatus.AddWarning ("Should be "+AccessibilityToString (accessibilityMono));
-
- AddFlagWarning (typeMono.IsSealed, typeMS.IsSealed, "sealed");
- AddFlagWarning (typeMono.IsAbstract, typeMS.IsAbstract, "abstract");
- }
-
- // sum up the sub-sections
- m_nodeStatus.Add (nsAttributes);
- m_nodeStatus.Add (nsMethods);
- m_nodeStatus.Add (nsProperties);
- m_nodeStatus.Add (nsEvents);
- m_nodeStatus.Add (nsFields);
- m_nodeStatus.Add (nsConstructors);
- m_nodeStatus.Add (nsNestedTypes);
- m_nodeStatus.Add (nsInterfaces);
-
- return m_nodeStatus;
- }
-
- static Accessibility GetAccessibility (TypeDefinition type)
- {
- TypeAttributes maskedMVisibility = type.Attributes & TypeAttributes.VisibilityMask;
- if (maskedMVisibility == TypeAttributes.Public)
- return Accessibility.Public;
- else if (maskedMVisibility == TypeAttributes.NestedAssembly)
- return Accessibility.Assembly;
- else if (maskedMVisibility == TypeAttributes.NestedFamORAssem)
- return Accessibility.FamilyOrAssembly;
- else if (maskedMVisibility == TypeAttributes.NestedFamily)
- return Accessibility.Family;
- else if (maskedMVisibility == TypeAttributes.NestedFamANDAssem)
- return Accessibility.FamilyAndAssembly;
- else if (maskedMVisibility == TypeAttributes.NestedPrivate)
- return Accessibility.Private;
- throw new Exception ("Unexpected error in MissingType.GetAccessibility");
- }
- }
-}
+++ /dev/null
-// Mono.Util.CorCompare.ToDoAssembly
-//
-// Author(s):
-// Nick Drochak (ndrochak@gol.com)
-//
-// (C) 2001-2002 Nick Drochak
-
-using System;
-using System.Collections;
-using System.IO;
-using System.Text;
-using System.Xml;
-using Mono.Cecil;
-
-namespace Mono.Util.CorCompare {
-
- /// <summary>
- /// Represents an assembly that has missing or MonoTODO classes
- /// </summary>
- /// <remarks>
- /// created by - Nick
- /// created on - 2/20/2002 10:43:57 PM
- /// </remarks>
- class ToDoAssembly : MissingBase
- {
- // these types are in mono corlib, but not in the dll we are going to examine.
- ArrayList MissingTypes = new ArrayList();
- ArrayList rgNamespaces = new ArrayList();
- string strName;
- AssemblyDefinition assMono;
- AssemblyDefinition assMS;
- TypeDefinitionCollection rgTypesMono;
- TypeDefinitionCollection rgTypesMS;
-
- protected static Hashtable htGhostTypes;
- private static string[] rgstrGhostTypes = {"System.Object", "System.ValueType", "System.Delegate", "System.Enum"};
-
-
- static ToDoAssembly ()
- {
- htGhostTypes = new Hashtable ();
-
- foreach (string strGhostType in rgstrGhostTypes)
- {
- htGhostTypes.Add (strGhostType, null);
- }
- }
-
- public static ToDoAssembly Load (string strFileMono, string strName, string strNameMS)
- {
- AssemblyDefinition assemblyMono = null;//TODO AssemblyDefinition.LoadFrom (strFileMono);
- AssemblyDefinition assemblyMS = null;//TODO AssemblyDefinition.LoadWithPartialName (strNameMS);
-
- return new ToDoAssembly (strName, assemblyMono, assemblyMS);
- }
-
- public ToDoAssembly (string _strName, AssemblyDefinition _assMono, AssemblyDefinition _assMS)
- {
- strName = _strName;
- assMono = _assMono;
- assMS = _assMS;
-
- rgTypesMono = assMono.MainModule.Types;
- rgTypesMS = assMS.MainModule.Types;
- m_nodeStatus = new NodeStatus (_assMono, _assMS);
- }
-
- public override string Name {
- get {
- return strName;
- }
- }
-
- public override string Type
- {
- get { return "assembly"; }
- }
-
- private Hashtable GetNamespaceMap (TypeDefinitionCollection rgTypes)
- {
- Hashtable mapTypes = new Hashtable ();
- foreach (TypeDefinition t in rgTypes)
- {
- if (t != null)
- {
- string strName = t.FullName;
- string strNamespace = t.Namespace;
- if (strNamespace != null && strNamespace.Length > 0 &&
- strName != null && strName.Length > 0 &&
- !htGhostTypes.Contains (strName))
- {
- TypeDefinitionCollection rgContainedTypes = (TypeDefinitionCollection) mapTypes [strNamespace];
- if (rgContainedTypes == null)
- {
- rgContainedTypes = new TypeDefinitionCollection (t.Module);
- mapTypes [strNamespace] = rgContainedTypes;
- }
- rgContainedTypes.Add (t);
- }
- }
- }
- return mapTypes;
- }
-
- public override NodeStatus Analyze ()
- {
- Hashtable mapTypesMono = GetNamespaceMap (rgTypesMono);
- Hashtable mapTypesMS = GetNamespaceMap (rgTypesMS);
-
- foreach (string strNamespaceMS in mapTypesMS.Keys)
- {
- if (strNamespaceMS != null)
- {
- TypeDefinitionCollection rgContainedTypesMS = (TypeDefinitionCollection) mapTypesMS [strNamespaceMS];
- TypeDefinitionCollection rgContainedTypesMono = (TypeDefinitionCollection) mapTypesMono [strNamespaceMS];
- MissingNameSpace mns = new MissingNameSpace (strNamespaceMS, rgContainedTypesMono, rgContainedTypesMS);
- NodeStatus nsNamespace = mns.Analyze ();
- m_nodeStatus.AddChildren (nsNamespace);
- if (rgTypesMono != null)
- mapTypesMono.Remove (strNamespaceMS);
- rgNamespaces.Add (mns);
- }
- }
- foreach (string strNamespaceMono in mapTypesMono.Keys)
- {
- if (strNamespaceMono != null)
- {
- TypeDefinitionCollection rgContainedTypesMono = (TypeDefinitionCollection) mapTypesMono [strNamespaceMono];
- MissingNameSpace mns = new MissingNameSpace (strNamespaceMono, rgContainedTypesMono, null);
- NodeStatus nsNamespace = mns.Analyze ();
- m_nodeStatus.AddChildren (nsNamespace);
- rgNamespaces.Add (mns);
- }
- }
-
- rgAttributes = new ArrayList ();
- NodeStatus nsAttributes = MissingAttribute.AnalyzeAttributes (
- assMono.CustomAttributes,
- assMS.CustomAttributes,
- rgAttributes);
- m_nodeStatus.Add (nsAttributes);
-
- return m_nodeStatus;
- }
-
-
- public string CreateClassListReport() {
- Analyze ();
- if (rgNamespaces.Count == 0) return "";
-
- StringBuilder output = new StringBuilder();
- foreach (MissingNameSpace ns in rgNamespaces)
- {
- string[] missingTypes = ns.MissingTypeNames(true);
- if (missingTypes != null && missingTypes.Length > 0) {
- string joinedNames = String.Join("\n", missingTypes);
- output.Append(joinedNames + "\n");
- }
- }
- return output.ToString();
- }
-
- public override XmlElement CreateXML (XmlDocument doc)
- {
- XmlElement assemblyElem = base.CreateXML (doc);
-
- if (rgNamespaces.Count > 0)
- {
- XmlElement eltNamespaces = doc.CreateElement ("namespaces");
- assemblyElem.AppendChild (eltNamespaces);
-
- foreach (MissingNameSpace ns in rgNamespaces)
- {
- XmlElement eltNameSpace = ns.CreateXML (doc);
- if (eltNameSpace != null)
- eltNamespaces.AppendChild (eltNameSpace);
- }
- }
- return assemblyElem;
- }
-
- public void CreateXMLReport(string filename) {
- Analyze();
-
- XmlDocument outDoc;
- outDoc = new XmlDocument();
- outDoc.AppendChild(outDoc.CreateXmlDeclaration("1.0", null, null));
-
- XmlElement assembliesElem = outDoc.CreateElement("assemblies");
- outDoc.AppendChild(assembliesElem);
-
- XmlElement assemblyElem = CreateXML (outDoc);
- assembliesElem.AppendChild(assemblyElem);
-
- outDoc.Save(filename);
- }
- }
-}
# Visual Studio 2008\r
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mono-api-diff", "mono-api-diff.csproj", "{51FD9965-3B42-41FF-ADF1-F71545F5C08E}"\r
EndProject\r
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CorCompare", "CorCompare.csproj", "{B70C3661-DFA1-40EF-B1BB-F6908F853870}"\r
-EndProject\r
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mono-api-info", "mono-api-info.csproj", "{6446D5E1-8F4E-4692-8EF3-B1D4CA290ECF}"\r
EndProject\r
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil-2008", "..\..\class\Mono.Cecil\Mono.Cecil-2008.csproj", "{D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE}"\r
{51FD9965-3B42-41FF-ADF1-F71545F5C08E}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{51FD9965-3B42-41FF-ADF1-F71545F5C08E}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{51FD9965-3B42-41FF-ADF1-F71545F5C08E}.Release|Any CPU.Build.0 = Release|Any CPU\r
- {B70C3661-DFA1-40EF-B1BB-F6908F853870}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
- {B70C3661-DFA1-40EF-B1BB-F6908F853870}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
- {B70C3661-DFA1-40EF-B1BB-F6908F853870}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
- {B70C3661-DFA1-40EF-B1BB-F6908F853870}.Release|Any CPU.Build.0 = Release|Any CPU\r
{6446D5E1-8F4E-4692-8EF3-B1D4CA290ECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{6446D5E1-8F4E-4692-8EF3-B1D4CA290ECF}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{6446D5E1-8F4E-4692-8EF3-B1D4CA290ECF}.Release|Any CPU.ActiveCfg = Release|Any CPU\r