~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to contrib/Mono.Cecil/Mono.Cecil/Mono.Cecil.Cil/SymbolStoreHelper.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2010-02-02 11:39:59 UTC
  • mfrom: (1.4.4 upstream)
  • mto: (1.5.1 sid)
  • mto: This revision was merged to the branch mainline in revision 47.
  • Revision ID: james.westby@ubuntu.com-20100202113959-n3u848nfj35yyd03
* New upstream release
* debian/control:
  + Standards version 3.8.4 (no changes needed)
* debian/patches/remove_support_for_non_debian_functionality.patch,
  debian/patches/remove_support_for_soft_debugger.patch,
  debian/patches/remove_support_for_moonlight.patch,
  debian/rules:
  + Split patch into two pieces, to make it easier to enable either
    SDB or Moonlight support with a rebuild
* debian/monodevelop-moonlight.install,
  debian/monodevelop-debugger-sdb.install,
  debian/control:
  + Create packaging data for the Soft Debugger addin and Moonlight addin -
    and comment them out of debian/control as we can't provide them on
    Debian for now

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
        sealed class SymbolStoreHelper {
35
35
 
36
 
                static readonly string MonoSymbolSupport = "Mono.Cecil.Mdb.MdbFactory, Mono.Cecil.Mdb";
37
 
                static readonly string DotNetSymbolSupport = "Mono.Cecil.Pdb.PdbFactory, Mono.Cecil.Pdb";
38
 
 
39
36
                static ISymbolStoreFactory s_factory;
40
37
 
41
38
                SymbolStoreHelper ()
61
58
                        if (s_factory != null)
62
59
                                return;
63
60
 
64
 
                        Type factoryType = Type.GetType (OnMono () ?
65
 
                                MonoSymbolSupport :
66
 
                                DotNetSymbolSupport,
67
 
                                true);
 
61
                        string assembly_name;
 
62
                        string type_name = GetSymbolSupportType (out assembly_name);
 
63
 
 
64
                        Type factoryType = Type.GetType (type_name + ", " + assembly_name, false);
 
65
                        if (factoryType == null) {
 
66
                                try {
 
67
                                        SR.Assembly assembly = SR.Assembly.LoadWithPartialName (assembly_name);
 
68
                                        factoryType = assembly.GetType (type_name);
 
69
                                } catch {}
 
70
                        }
 
71
 
 
72
                        if (factoryType == null)
 
73
                                throw new NotSupportedException ();
68
74
 
69
75
                        s_factory = (ISymbolStoreFactory) Activator.CreateInstance (factoryType);
70
76
                }
71
77
 
 
78
                static string GetSymbolSupportType (out string assembly)
 
79
                {
 
80
                        string kind = GetSymbolKind ();
 
81
                        assembly = "Mono.Cecil." + kind;
 
82
                        return string.Format (assembly + "." + kind + "Factory");
 
83
                }
 
84
 
 
85
                static string GetSymbolKind ()
 
86
                {
 
87
                        return OnMono () ? "Mdb" : "Pdb";
 
88
                }
 
89
 
72
90
                static bool OnMono ()
73
91
                {
74
 
                        return typeof (object).Assembly.GetType ("System.MonoType", false) != null;
 
92
                        return Type.GetType ("Mono.Runtime") != null;
75
93
                }
76
94
        }
77
95
}