diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Project/CreateNewWixProjectObjectTestFixture.cs b/src/AddIns/BackendBindings/WixBinding/Test/Project/CreateNewWixProjectObjectTestFixture.cs index 5aeae4075c..657aef8420 100644 --- a/src/AddIns/BackendBindings/WixBinding/Test/Project/CreateNewWixProjectObjectTestFixture.cs +++ b/src/AddIns/BackendBindings/WixBinding/Test/Project/CreateNewWixProjectObjectTestFixture.cs @@ -59,15 +59,7 @@ namespace WixBinding.Tests.Project [Test] public void Imports() { - MSBuildImport wixProjectImport = new MSBuildImport(WixProject.DefaultTargetsFile); - bool found = false; - foreach (MSBuildImport import in project.Imports) { - if (import.Project == wixProjectImport.Project) { - found = true; - break; - } - } - Assert.IsTrue(found); + Assert.IsTrue(project.Imports.Contains(new MSBuildImport(WixProject.DefaultTargetsFile))); } [Test] diff --git a/src/Main/Base/Project/Src/Project/MSBuildImport.cs b/src/Main/Base/Project/Src/Project/MSBuildImport.cs index e3839fce39..a6df3e9dd3 100644 --- a/src/Main/Base/Project/Src/Project/MSBuildImport.cs +++ b/src/Main/Base/Project/Src/Project/MSBuildImport.cs @@ -12,7 +12,7 @@ namespace ICSharpCode.SharpDevelop.Project /// /// An <Import>-node in an MSBuild file. /// - public class MSBuildImport : ICloneable + public class MSBuildImport : ICloneable, IEquatable { string project; string condition; @@ -48,5 +48,23 @@ namespace ICSharpCode.SharpDevelop.Project n.Condition = this.Condition; return n; } + + public sealed override bool Equals(object obj) + { + return Equals(obj as MSBuildImport); + } + + public override int GetHashCode() + { + return this.Project.GetHashCode() ^ (this.Condition ?? "").GetHashCode(); + } + + public virtual bool Equals(MSBuildImport obj) + { + if (obj == null) + return false; + else + return obj.Condition == this.Condition && obj.Project == this.Project; + } } } diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs index 3973f50853..b413da200f 100644 --- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs +++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs @@ -36,7 +36,7 @@ namespace ICSharpCode.SharpDevelop.Dom { foreach (CustomAttribute att in attributes) { DefaultAttribute a = new DefaultAttribute(att.Constructor.DeclaringType.FullName); - // TODO: attribute arguments + // TODO: add only attributes marked "important", and include attribute arguments list.Add(a); } } @@ -197,11 +197,11 @@ namespace ICSharpCode.SharpDevelop.Dom modifiers |= ModifierEnum.Abstract; } - if ((td.Attributes & TypeAttributes.NestedPublic) == TypeAttributes.NestedPublic) { + if ((td.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPublic) { modifiers |= ModifierEnum.Public; - } else if ((td.Attributes & TypeAttributes.NestedFamily) == TypeAttributes.NestedFamily) { + } else if ((td.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamily) { modifiers |= ModifierEnum.Protected; - } else if ((td.Attributes & TypeAttributes.NestedFamORAssem) == TypeAttributes.NestedFamORAssem) { + } else if ((td.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamORAssem) { modifiers |= ModifierEnum.Protected; } else { modifiers |= ModifierEnum.Public; @@ -235,9 +235,10 @@ namespace ICSharpCode.SharpDevelop.Dom } foreach (TypeDefinition nestedType in type.NestedTypes) { - if ((nestedType.Attributes & TypeAttributes.NestedPublic) == TypeAttributes.NestedPublic) + TypeAttributes visibility = nestedType.Attributes & TypeAttributes.VisibilityMask; + if (visibility == TypeAttributes.NestedPublic || visibility == TypeAttributes.NestedFamily + || visibility == TypeAttributes.NestedFamORAssem) { - // NestedFamily somehow also finds internal inner classes (e.g. Environment.ResourceHelper) string name = nestedType.Name; int pos = name.LastIndexOf('/'); if (pos > 0) @@ -252,7 +253,7 @@ namespace ICSharpCode.SharpDevelop.Dom } foreach (FieldDefinition field in type.Fields) { - if (IsVisible(field.Attributes)) { + if (IsVisible(field.Attributes) && !field.IsSpecialName) { DefaultField f = new DefaultField(this, field.Name); f.Modifiers = TranslateModifiers(field); f.ReturnType = CreateType(this.ProjectContent, this, field.FieldType); diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/DomPersistence.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/DomPersistence.cs index 59722abeeb..72077d6356 100644 --- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/DomPersistence.cs +++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/DomPersistence.cs @@ -20,7 +20,7 @@ namespace ICSharpCode.SharpDevelop.Dom { public const long FileMagic = 0x11635233ED2F428C; public const long IndexFileMagic = 0x11635233ED2F427D; - public const short FileVersion = 7; + public const short FileVersion = 8; ProjectContentRegistry registry; string cacheDirectory;