Welcome to mirror list, hosted at ThFree Co, Russian Federation.

mono-find-provides.cs « mono-find-provides « mono-rpm-helpers « tools « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 64c29701d60ece1c45c4f83b3532aac7cd479165 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// mono-find-provides.cs - Prints out an assembly's name and version
//
// Author: Duncan Mak (duncan@ximian.com)
// 
// 2004 Copyright Novell Inc.
//

using System;
using System.Reflection;

namespace Mono {
class FindProvides {

        static void Main (string [] args)
        {
                if (args.Length == 0) {
                        string s = Console.ReadLine ();

                        while (s != null) {
                                PrintProvides (s);
                                s = Console.ReadLine ();
                        }

                } else {
                        foreach (string s in args)
                                PrintProvides (s);
                }
        }

        static void PrintProvides (string s)
        {
                try {
                        Assembly a = Assembly.LoadFrom (s);
                        AssemblyName an = a.GetName ();

                        // hack to work around the issue with a 2.0 corlib
			if (s.Trim ().EndsWith ("2.0/mscorlib.dll"))
                                Console.WriteLine  ("mono({0}) = {1}", "mscorlib", "2.0.3600.0");
                        else
                                Console.WriteLine ("mono({0}) = {1}", an.Name, an.Version);

                } catch {}
        }
}
}