public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj.GetType() == typeof(CppTypes)) { return(Equals(new CppType(obj))); } if (obj.GetType() != typeof(CppType)) { return(false); } CppType other = (CppType)obj; return((((internalModifiers == null || !internalModifiers.Any()) && (other.internalModifiers == null || !other.internalModifiers.Any())) || (internalModifiers != null && other.internalModifiers != null && CppModifiers.NormalizeOrder(internalModifiers).SequenceEqual(CppModifiers.NormalizeOrder(other.internalModifiers)))) && (((Namespaces == null || !Namespaces.Any()) && (other.Namespaces == null || !other.Namespaces.Any())) || (Namespaces != null && other.Namespaces != null && Namespaces.SequenceEqual(other.Namespaces))) && ElementType == other.ElementType && ElementTypeName == other.ElementTypeName); }
public CSharpDocument(string csFilePath) { //CS document tree var srcText = File.ReadAllText(csFilePath); SyntaxTree tree = CSharpSyntaxTree.ParseText(srcText); Assert.IsNotNull(tree, "Expects non null SyntaxTree."); CompilationUnit = tree.GetRoot() as CompilationUnitSyntax; Assert.IsNotNull(CompilationUnit, "Expects non null CompilationUnitSyntax."); //Namespace Namespaces = CompilationUnit.Members.OfType <NamespaceDeclarationSyntax>(); if (!Namespaces.Any()) { PrintWarning($"Warning: file '{csFilePath}' contains no namespaces."); return; } var classes = new List <ClassDeclarationSyntax>(); foreach (var nameSpace in Namespaces) { //Classes var nameSpaceClasses = nameSpace.Members.OfType <ClassDeclarationSyntax>(); Assert.IsNotNull(classes, "Expects non null ClassDeclarationSyntax list."); classes.AddRange(nameSpaceClasses); } Classes = classes; }