Run() public method

Runs the command line tool.
public Run ( string args ) : int
args string /// Command line arguments ///
return int
Esempio n. 1
0
	static int RunSetup (string[] args)
	{
		Console.WriteLine ("MonoDevelop Add-in Setup Utility");
		bool verbose = false;
		foreach (string a in args)
			if (a == "-v")
				verbose = true;
	
		string configDir, addinsDir, databaseDir;
		Runtime.GetAddinRegistryLocation (out configDir, out addinsDir, out databaseDir);
		SetupTool setupTool = new SetupTool (new AddinRegistry (configDir, addinsDir, databaseDir));
		setupTool.VerboseOutput = verbose;
		return setupTool.Run (args);
	}
Esempio n. 2
0
		public static int Main(string[] args)
		{
			if (args.Length == 0 || args [0] == "--help" || args [0] == "help") {
				Console.WriteLine ("Mono.Addins Setup Utility");
				Console.WriteLine ("Usage: mautil [options] <command> [arguments]");
				Console.WriteLine ();
				Console.WriteLine ("Options:");
				Console.WriteLine ("  --registry (-reg) Specify add-in registry path");
				Console.WriteLine ("  --path (-p)       Specify startup path of the application");
				Console.WriteLine ("  --package (-pkg)  Specify the package name of the application");
				Console.WriteLine ("  -v                Verbose output");
			}
			
			int ppos = 0;
			
			int verbose = 1;
			string path = null;
			string startupPath = null;
			string package = null;
			bool toolParam = true;
			
			while (toolParam && ppos < args.Length)
			{
				if (args [ppos] == "-reg" || args [ppos] == "--registry") {
					if (ppos + 1 >= args.Length) {
						Console.WriteLine ("Registry path not provided.");
						return 1;
					}
					path = args [ppos + 1];
					ppos += 2;
				}
				else if (args [ppos] == "-p" || args [ppos] == "--path") {
					if (ppos + 1 >= args.Length) {
						Console.WriteLine ("Startup path not provided.");
						return 1;
					}
					startupPath = args [ppos + 1];
					ppos += 2;
				}
				else if (args [ppos] == "-pkg" || args [ppos] == "--package") {
					if (ppos + 1 >= args.Length) {
						Console.WriteLine ("Package name not provided.");
						return 1;
					}
					package = args [ppos + 1];
					ppos += 2;
				}
				else if (args [ppos] == "-v") {
					verbose++;
					ppos++;
				} else
					toolParam = false;
			}
			
			AddinRegistry reg;
			
			if (package != null) {
				if (startupPath != null || path != null) {
					Console.WriteLine ("The --registry and --path options can't be used when --package is specified.");
					return 1;
				}
				Application app = SetupService.GetExtensibleApplication (package);
				if (app == null) {
					Console.WriteLine ("The package could not be found or does not provide add-in registry information.");
					return 1;
				}
				reg = app.Registry;
			}
			else {
				if (startupPath == null)
					startupPath = Environment.CurrentDirectory;
				reg = path != null ? new AddinRegistry (path, startupPath) : AddinRegistry.GetGlobalRegistry ();
			}
			
			try {
				SetupTool setupTool = new SetupTool (reg);
				setupTool.VerboseOutputLevel = verbose;
				return setupTool.Run (args, ppos);
			} catch (Exception ex) {
				Console.WriteLine (ex);
				return -1;
			}
			finally {
				reg.Dispose ();
			}
		}
Esempio n. 3
0
	static int RunSetup (string[] args)
	{
		Console.WriteLine ("MonoDevelop Add-in Setup Utility");
		bool verbose = false;
		foreach (string a in args)
			if (a == "-v")
				verbose = true;
	
		SetupTool setupTool = new SetupTool (AddinManager.Registry);
		setupTool.VerboseOutput = verbose;
		return setupTool.Run (args);
	}
Esempio n. 4
0
	static int RunSetup (string[] args)
	{
		Console.WriteLine ("MonoDevelop Add-in Setup Utility");
		bool verbose = false;
		foreach (string a in args)
			if (a == "-v")
				verbose = true;
	
		string startupDir, configDir, addinsDir, databaseDir;
		string asmFile = new Uri (System.Reflection.Assembly.GetEntryAssembly ().CodeBase).LocalPath;
		startupDir = System.IO.Path.GetDirectoryName (asmFile);
		Runtime.GetAddinRegistryLocation (out configDir, out addinsDir, out databaseDir);
		SetupTool setupTool = new SetupTool (new AddinRegistry (configDir, startupDir, addinsDir, databaseDir));
		setupTool.VerboseOutput = verbose;
		return setupTool.Run (args);
	}