private static Diff[] GetDiffs(string[] files, ExcludeFolder[] excludeFolders)
        {
            List<Diff> diffs = new List<Diff>();

            foreach (string filename in files)
            {
                string FolderName = Path.GetFileName(Path.GetDirectoryName(filename));
                string ProjectName = Path.GetFileNameWithoutExtension(filename);

                XDocument xdoc;
                string AssemblyName, RootNamespace;

                try
                {
                    xdoc = XDocument.Load(filename);

                    AssemblyName = xdoc
                       .Descendants(xdoc.Root.Name.Namespace + "AssemblyName")
                       .FirstOrDefault()?.Value ?? string.Empty;
                    RootNamespace = xdoc
                       .Descendants(xdoc.Root.Name.Namespace + "RootNamespace")
                       .FirstOrDefault()?.Value ?? string.Empty;
                }
                catch (XmlException ex)
                {
                    if (ShouldExclude(filename, excludeFolders))
                    {
                        continue;
                    }

                    WriteColor("Project file: " + filename + ". " + ex.Message, ConsoleColor.Red);

                    Diff diff = new Diff();
                    diff.FolderName = FolderName;
                    diff.ProjectName = ProjectName;
                    diff.AssemblyName = string.Empty;
                    diff.RootNamespace = string.Empty;
                    diff.Level = Level.Error;
                    diffs.Add(diff);

                    continue;
                }

                string[] names = new string[] { FolderName, ProjectName, AssemblyName, RootNamespace };

                if (names.Any(n => n.Length > FolderName.Length && !n.EndsWith(FolderName)) ||
                    names.Any(n => n.Length >= ProjectName.Length && !n.EndsWith(ProjectName)) ||
                    names.Any(n => n.Length >= AssemblyName.Length && !n.EndsWith(AssemblyName)) ||
                    names.Any(n => n.Length >= RootNamespace.Length && !n.EndsWith(RootNamespace)))
                {
                    if (ShouldExclude(filename, excludeFolders))
                    {
                        continue;
                    }

                    Diff diff = new Diff();
                    diff.FolderName = FolderName;
                    diff.ProjectName = ProjectName;
                    diff.AssemblyName = AssemblyName;
                    diff.RootNamespace = RootNamespace;
                    diff.Level = Level.Error;
                    diffs.Add(diff);
                }
                else if (FolderName != ProjectName || FolderName != AssemblyName || FolderName != RootNamespace)
                {
                    if (ShouldExclude(filename, excludeFolders))
                    {
                        continue;
                    }

                    Diff diff = new Diff();
                    diff.FolderName = FolderName;
                    diff.ProjectName = ProjectName;
                    diff.AssemblyName = AssemblyName;
                    diff.RootNamespace = RootNamespace;
                    diff.Level = Level.Warning;
                    diffs.Add(diff);
                }
            }

            return diffs.ToArray();
        }
        private static void PrintDiffs(Diff[] diffs, bool onlyErrors)
        {
            Diff[] diffs2 = diffs
                .Where(d => !onlyErrors || d.Level == Level.Error)
                .ToArray();

            if (diffs2.Length == 0)
            {
                return;
            }

            string[] lengths = {
                "{0,-" + diffs2.Max(d => d.FolderName.Length) + "} ",
                "{0,-" + diffs2.Max(d => d.ProjectName.Length) + "} ",
                "{0,-" + diffs2.Max(d => d.AssemblyName.Length)+ "} "};

            Console.WriteLine(
                string.Format(lengths[0], "FolderName") +
                string.Format(lengths[1], "ProjectName") +
                string.Format(lengths[2], "AssemblyName") +
                "RootNamespace");

            WriteCollection(diffs
                .Where(d => d.Level == Level.Error)
                .OrderBy(d => d.FolderName)
                .ThenBy(d => d.ProjectName)
                .ThenBy(d => d.AssemblyName)
                .ThenBy(d => d.RootNamespace)
                .Select(d =>
                    string.Format(lengths[0], d.FolderName) +
                    string.Format(lengths[1], d.ProjectName) +
                    string.Format(lengths[2], d.AssemblyName) + d.RootNamespace),
                ConsoleColor.Red);

            if (!onlyErrors)
            {
                WriteCollection(diffs
                    .Where(d => d.Level == Level.Warning)
                    .OrderBy(d => d.FolderName)
                    .ThenBy(d => d.ProjectName)
                    .ThenBy(d => d.AssemblyName)
                    .ThenBy(d => d.RootNamespace)
                    .Select(d =>
                        string.Format(lengths[0], d.FolderName) +
                        string.Format(lengths[1], d.ProjectName) +
                        string.Format(lengths[2], d.AssemblyName) + d.RootNamespace),
                ConsoleColor.Yellow);
            }
        }