diff options
author | Chris Toshok <toshok@novell.com> | 2008-02-10 23:30:02 +0300 |
---|---|---|
committer | Chris Toshok <toshok@novell.com> | 2008-02-10 23:30:02 +0300 |
commit | b0515bd72c5f9bbfb8251f5f150786b620c5943d (patch) | |
tree | 212f0c63f86a64fe823449a0cb2d44e1285a8667 /gui-compare | |
parent | 54224d5555d153c6d6296ed8a2e75a5b6f8b19a6 (diff) |
2008-02-10 Chris Toshok <toshok@ximian.com>
* 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.
svn path=/trunk/mono-tools/; revision=95405
Diffstat (limited to 'gui-compare')
-rw-r--r-- | gui-compare/CecilMetadata.cs | 57 | ||||
-rw-r--r-- | gui-compare/ChangeLog | 19 | ||||
-rw-r--r-- | gui-compare/MasterMetadata.cs | 21 |
3 files changed, 91 insertions, 6 deletions
diff --git a/gui-compare/CecilMetadata.cs b/gui-compare/CecilMetadata.cs index 6fce41a2..6c88ac62 100644 --- a/gui-compare/CecilMetadata.cs +++ b/gui-compare/CecilMetadata.cs @@ -650,7 +650,13 @@ namespace GuiCompare { 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 @@ namespace GuiCompare { 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 @@ namespace GuiCompare { 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 @@ namespace GuiCompare { 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; diff --git a/gui-compare/ChangeLog b/gui-compare/ChangeLog index bb8f3b75..5f210429 100644 --- a/gui-compare/ChangeLog +++ b/gui-compare/ChangeLog @@ -1,3 +1,22 @@ +2008-02-10 Chris Toshok <toshok@ximian.com> + + [ 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 <sdelcroix@novell.com> * MainWindow.cs: move the LoadConfiguration part at the end of diff --git a/gui-compare/MasterMetadata.cs b/gui-compare/MasterMetadata.cs index 1e5c614e..5611d70d 100644 --- a/gui-compare/MasterMetadata.cs +++ b/gui-compare/MasterMetadata.cs @@ -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 @@ namespace GuiCompare { : (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 @@ namespace GuiCompare { } 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 @@ namespace GuiCompare { 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; |