Author: toshok
Date: 2008-02-10 15:30:02 -0500 (Sun, 10 Feb 2008)
New Revision: 95405
Modified:
trunk/mono-tools/gui-compare/CecilMetadata.cs
trunk/mono-tools/gui-compare/ChangeLog
trunk/mono-tools/gui-compare/MasterMetadata.cs
Log:
2008-02-10 Chris Toshok <[EMAIL PROTECTED]>
* CecilMetadata.cs (CecilProperty.ctor): we can't just use the
name - multiple "Item" properties were screwing things up.
(CecilProperty.FormatName): format the name for display and for
comparison against the masterinfo. Masterinfo version is "Type
Name [ param-types ]", and display version if "Name [
param-types]" (including the type in the display version made it a
little hard to actually see what the name of the property was.)
(CecilField.GetMemberAccess): convert FamORAssem to just Family.
(CecilMethod.GetMemberAccess): same.
* MasterMetadata.cs (MasterProperty.ctor): we need to format the
name based on the key, not on the name attribute alone.
(MasterProperty.FormatName): format the name to match up with
CecilProperty.FormatName.
Modified: trunk/mono-tools/gui-compare/CecilMetadata.cs
===================================================================
--- trunk/mono-tools/gui-compare/CecilMetadata.cs 2008-02-10 20:28:55 UTC
(rev 95404)
+++ trunk/mono-tools/gui-compare/CecilMetadata.cs 2008-02-10 20:30:02 UTC
(rev 95405)
@@ -650,7 +650,13 @@
FieldAttributes.HasFieldMarshal);
public override string GetMemberAccess ()
{
- return (field_def.Attributes &
masterInfoFieldMask).ToString();
+ FieldAttributes fa = field_def.Attributes &
masterInfoFieldMask;
+
+ // remove the Assem from FamORAssem
+ if ((fa & FieldAttributes.FamORAssem) ==
FieldAttributes.FamORAssem)
+ fa = (fa & ~(FieldAttributes.FamORAssem)) |
(FieldAttributes.Family);
+
+ return fa.ToString();
}
public override List<CompNamed> GetAttributes ()
@@ -706,7 +712,13 @@
MethodAttributes.SpecialName);
public override string GetMemberAccess ()
{
- return (method_def.Attributes &
masterInfoMethodMask).ToString();
+ MethodAttributes ma = method_def.Attributes &
masterInfoMethodMask;
+
+ // remove the Assem from FamORAssem
+ if ((ma & MethodAttributes.FamORAssem) ==
MethodAttributes.FamORAssem)
+ ma = (ma & ~(MethodAttributes.FamORAssem)) |
(MethodAttributes.Family);
+
+ return ma.ToString();
}
public override List<CompNamed> GetAttributes ()
@@ -798,10 +810,11 @@
public class CecilProperty : CompProperty
{
public CecilProperty (PropertyDefinition pd)
- : base (pd.Name)
+ : base (FormatName (pd, false))
{
this.pd = pd;
this.attributes = CecilUtils.GetCustomAttributes (pd,
todos);
+ this.DisplayName = FormatName (pd, true);
}
public override string GetMemberType()
@@ -830,6 +843,44 @@
return rv;
}
+
+ static string FormatName (PropertyDefinition pd, bool beautify)
+ {
+ StringBuilder sb = new StringBuilder ();
+
+#if INCLUDE_TYPE_IN_PROPERTY_DISPLAYNAME
+ sb.Append (beautify
+ ? CecilUtils.PrettyType
(pd.PropertyType.FullName)
+ :
CecilUtils.FormatTypeLikeCorCompare (pd.PropertyType.FullName));
+ sb.Append (" ");
+#else
+ if (!beautify) {
+ sb.Append (CecilUtils.FormatTypeLikeCorCompare
(pd.PropertyType.FullName));
+ sb.Append (" ");
+ }
+#endif
+ sb.Append (pd.Name);
+
+ if (pd.Parameters.Count > 0) {
+ sb.Append ('[');
+ bool first_p = true;
+ foreach (ParameterDefinition p in
pd.Parameters) {
+ if (!first_p)
+ sb.Append (", ");
+ first_p = false;
+ sb.Append (beautify
+ ? CecilUtils.PrettyType
(p.ParameterType.FullName)
+ :
CecilUtils.FormatTypeLikeCorCompare (p.ParameterType.FullName));
+ if (beautify) {
+ sb.Append (" ");
+ sb.Append (p.Name);
+ }
+ }
+ sb.Append (']');
+ }
+
+ return sb.ToString ();
+ }
PropertyDefinition pd;
List<CompNamed> attributes;
Modified: trunk/mono-tools/gui-compare/ChangeLog
===================================================================
--- trunk/mono-tools/gui-compare/ChangeLog 2008-02-10 20:28:55 UTC (rev
95404)
+++ trunk/mono-tools/gui-compare/ChangeLog 2008-02-10 20:30:02 UTC (rev
95405)
@@ -1,3 +1,22 @@
+2008-02-10 Chris Toshok <[EMAIL PROTECTED]>
+
+ [ Fix a couple of bugs reported by jpobst ]
+
+ * CecilMetadata.cs (CecilProperty.ctor): we can't just use the
+ name - multiple "Item" properties were screwing things up.
+ (CecilProperty.FormatName): format the name for display and for
+ comparison against the masterinfo. Masterinfo version is "Type
+ Name [ param-types ]", and display version if "Name [
+ param-types]" (including the type in the display version made it a
+ little hard to actually see what the name of the property was.)
+ (CecilField.GetMemberAccess): convert FamORAssem to just Family.
+ (CecilMethod.GetMemberAccess): same.
+
+ * MasterMetadata.cs (MasterProperty.ctor): we need to format the
+ name based on the key, not on the name attribute alone.
+ (MasterProperty.FormatName): format the name to match up with
+ CecilProperty.FormatName.
+
2008-02-07 Stephane Delcroix <[EMAIL PROTECTED]>
* MainWindow.cs: move the LoadConfiguration part at the end of
Modified: trunk/mono-tools/gui-compare/MasterMetadata.cs
===================================================================
--- trunk/mono-tools/gui-compare/MasterMetadata.cs 2008-02-10 20:28:55 UTC
(rev 95404)
+++ trunk/mono-tools/gui-compare/MasterMetadata.cs 2008-02-10 20:30:02 UTC
(rev 95405)
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading;
+using System.Text;
using System.Xml;
using Mono.Cecil;
using Gtk;
@@ -62,7 +63,6 @@
:
(XMLAttributes)xml_cls.properties.attributeMap[key]);
property_list.Add (new MasterProperty
((string)key,
-
(string)xml_cls.properties.keys[key],
xml_cls.properties.ConvertToString (Int32.Parse
((string)xml_cls.properties.access[key])),
(XMLMethods)xml_cls.properties.nameToMethod[key],
attributes));
@@ -558,8 +558,8 @@
}
public class MasterProperty : CompProperty {
- public MasterProperty (string key, string name, string
propertyAccess, XMLMethods xml_methods, XMLAttributes attributes)
- : base (name)
+ public MasterProperty (string key, string propertyAccess,
XMLMethods xml_methods, XMLAttributes attributes)
+ : base (FormatName (key))
{
string[] keyparts = key.Split(new char[] {':'}, 3);
@@ -592,6 +592,21 @@
return methods;
}
+ static string FormatName (string key)
+ {
+ string[] keyparts = key.Split(new char[] {':'}, 3);
+
+ StringBuilder sb = new StringBuilder ();
+ sb.Append (keyparts[1]);
+ sb.Append (" ");
+ sb.Append (keyparts[0]);
+
+ if (keyparts[2] != "")
+ sb.AppendFormat ("[{0}]", keyparts[2]);
+
+ return sb.ToString ();
+ }
+
List<CompNamed> methods;
XMLAttributes attributes;
string propertyType;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches