2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / tools / mono-rpm-helpers / mono-find-requires / mono-find-requires.cs
1 //
2 // mono-find-requires.cs - Prints out referenced assembles
3 //
4 // Author: Duncan Mak (duncan@ximian.com)
5 // 
6 // 2004 Copyright Novell Inc.
7 //
8
9 using System;
10 using System.Reflection;
11
12 namespace Mono {
13 class FindRequires {
14
15         static void Main (string [] args)
16         {
17                 if (args.Length == 0) {
18                         string s = Console.ReadLine ();
19
20                         while (s != null) {
21                                 PrintRequires (s);
22                                 s = Console.ReadLine ();
23                         }
24
25                 } else {
26                         foreach (string s in args)
27                                 PrintRequires (s);
28                 }
29         }
30
31         static void PrintRequires (string s)
32         { 
33                 try {
34                         Assembly a = Assembly.LoadFrom (s);
35                 
36                         foreach (AssemblyName an in a.GetReferencedAssemblies ())
37                                 Console.WriteLine ("mono({0}) = {1}", an.Name, an.Version);
38
39                 } catch {}
40         }
41 }
42 }