~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Core/frameworks/compare-framework-list.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System.Xml.Linq;
 
2
using System;
 
3
using System.Linq;
 
4
using System.Collections.Generic;
 
5
 
 
6
class CompareFrameworkList
 
7
{
 
8
        // compares a MSBuild framework list to a MonoDevelop framework list
 
9
        static void Main (string[] args)
 
10
        {
 
11
                var netHash = LoadMSBuildFrameworkList (args[0]);
 
12
                var monoHash = LoadMDFrameworkList (args [1]);
 
13
                Console.WriteLine ("MONOONLY");
 
14
                foreach (var s in monoHash.Except (netHash))
 
15
                        Console.WriteLine ("  {0}", s);
 
16
                Console.WriteLine ("NETONLY");
 
17
                foreach (var s in netHash.Except (monoHash))
 
18
                        Console.WriteLine ("  {0}", s);
 
19
        }
 
20
 
 
21
        HashSet<string> LoadMSBuildFrameworkList (string file)
 
22
        {
 
23
                var doc = XDocument.Load (file);
 
24
                var hash = new HashSet<string> ();
 
25
                foreach (var el in doc.Elements ("File")) {
 
26
                        string name = (string)el.Attribute ("AssemblyName") + ","
 
27
                                + (string)el.Attribute ("Version") + ","
 
28
                                        + (string)el.Attribute ("PublicKeyToken");
 
29
                        if (!hash.Add (name))
 
30
                                Console.WriteLine ("NETDUP {0}", name);
 
31
                }
 
32
                return hash;
 
33
        }
 
34
 
 
35
        HashSet<string> LoadMDFrameworkList (string file)
 
36
        {
 
37
                var doc = XDocument.Load (file);
 
38
                var hash = new HashSet<string> ();
 
39
                foreach (var el in doc.Root.Element ("Assemblies").Elements ("Assembly")) {
 
40
                        string name = (string)el.Attribute ("name") + ","
 
41
                                + (string)el.Attribute ("version") + "," 
 
42
                                        + (string)el.Attribute ("publicKeyToken");
 
43
                        if (!hash.Add (name))
 
44
                                Console.WriteLine ("MONODUP {0}", name);
 
45
                }
 
46
                return hash;
 
47
        }
 
48
}