public void Parse (string [] args)
{
for (int idx = 0; idx < args.Length; idx++) {
bool quit = false;
switch (args [idx]) {
case "--debug":
debug = true;
break;
case "--uninstalled":
Uninstalled = true;
break;
case "--new-note":
// Get optional name for new note...
if (idx + 1 < args.Length
&& args [idx + 1] != null
&& args [idx + 1] != String.Empty
&& args [idx + 1][0] != '-') {
new_note_name = args [++idx];
}
new_note = true;
break;
case "--open-note":
// Get required name for note to open...
if (idx + 1 >= args.Length ||
(args [idx + 1] != null
&& args [idx + 1] != String.Empty
&& args [idx + 1][0] == '-')) {
PrintUsage ();
quit = true;
}
++idx;
// If the argument looks like a Uri, treat it like a Uri.
if (args [idx].StartsWith ("note://tomboy/"))
open_note_uri = args [idx];
else if (File.Exists (args [idx])) {
// This is potentially a note file
open_external_note_path = args [idx];
} else
open_note_name = args [idx];
break;
case "--start-here":
// Open the Start Here note
open_start_here = true;
break;
case "--highlight-search":
// Get required search string to highlight
if (idx + 1 >= args.Length ||
(args [idx + 1] != null
&& args [idx + 1] != String.Empty
&& args [idx + 1][0] == '-')) {
PrintUsage ();
quit = true;
}
++idx;
highlight_search = args [idx];
break;
case "--panel-applet":
panel_applet = true;
break;
case "--note-path":
if (idx + 1 >= args.Length ||
(args [idx + 1] != null
&& args [idx + 1] != String.Empty
&& args [idx + 1][0] == '-')) {
PrintUsage ();
quit = true;
}
note_path = args [++idx];
if (!Directory.Exists (note_path)) {
Console.WriteLine (
"Tomboy: Invalid note path: " +
"\"{0}\" does not exist.",
note_path);
quit = true;
}
break;
case "--search":
// Get optional search text...
if (idx + 1 < args.Length
&& args [idx + 1] != null
&& args [idx + 1] != String.Empty
&& args [idx + 1][0] != '-') {
search_text = args [++idx];
}
open_search = true;
break;
case "--version":
PrintAbout ();
PrintVersion();
quit = true;
break;
case "--help":
case "--usage":
PrintAbout ();
PrintUsage ();
quit = true;
break;
default:
if (args[idx].StartsWith ("--addin:")) addin_args = true;
//All nonrecognized args are added to the add-in argslist in
//case they're params for the add-in. (The order is preserved.)
addin_argslist.Add (args[idx]);
break;
}
if (quit == true)
System.Environment.Exit (1);
}
}