~ubuntu-branches/ubuntu/karmic/mono-addins/karmic

« back to all changes in this revision

Viewing changes to mautil/Main.cs

  • Committer: Bazaar Package Importer
  • Author(s): Mirco Bauer
  • Date: 2007-07-14 12:07:48 UTC
  • Revision ID: james.westby@ubuntu.com-20070714120748-2elczfsjlrdsrpms
Tags: upstream-0.2
ImportĀ upstreamĀ versionĀ 0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// project created on 16/07/2006 at 13:33
 
2
using System;
 
3
using Mono.Addins;
 
4
using Mono.Addins.Setup;
 
5
 
 
6
namespace mautil
 
7
{
 
8
        class MainClass
 
9
        {
 
10
                public static int Main(string[] args)
 
11
                {
 
12
                        if (args.Length == 0 || args [0] == "--help" || args [0] == "help") {
 
13
                                Console.WriteLine ("Mono.Addins Setup Utility");
 
14
                                Console.WriteLine ("Usage: mautil [options] <command> [arguments]");
 
15
                                Console.WriteLine ();
 
16
                                Console.WriteLine ("Options:");
 
17
                                Console.WriteLine ("  --registry (-reg) Specify add-in registry path");
 
18
                                Console.WriteLine ("  -v                Verbose output");
 
19
                        }
 
20
                        
 
21
                        int ppos = 0;
 
22
                        
 
23
                        bool verbose = false;
 
24
                        foreach (string a in args)
 
25
                                if (a == "-v")
 
26
                                        verbose = true;
 
27
                        
 
28
                        string path = null;
 
29
                        bool toolParam = true;
 
30
                        
 
31
                        while (toolParam && ppos < args.Length)
 
32
                        {
 
33
                                if (args [ppos] == "-reg" || args [ppos] == "--registry") {
 
34
                                        if (ppos + 1 >= args.Length) {
 
35
                                                Console.WriteLine ("Registry path not provided.");
 
36
                                                return 1;
 
37
                                        }
 
38
                                        path = args [ppos + 1];
 
39
                                        ppos += 2;
 
40
                                }
 
41
                                else if (args [ppos] == "-v")
 
42
                                        verbose = true;
 
43
                                else
 
44
                                        toolParam = false;
 
45
                        }
 
46
                        
 
47
                        AddinRegistry reg = path != null ? new AddinRegistry (path) : AddinRegistry.GetGlobalRegistry ();
 
48
                        try {
 
49
                                SetupTool setupTool = new SetupTool (reg);
 
50
                                setupTool.VerboseOutput = verbose;
 
51
                                return setupTool.Run (args, ppos);
 
52
                        } catch (Exception ex) {
 
53
                                Console.WriteLine (ex);
 
54
                                return -1;
 
55
                        }
 
56
                        finally {
 
57
                                reg.Dispose ();
 
58
                        }
 
59
                }
 
60
        }
 
61
}
 
 
b'\\ No newline at end of file'