~ubuntu-branches/ubuntu/saucy/monodevelop/saucy-proposed

« back to all changes in this revision

Viewing changes to src/tools/mdcrashlog/CrashLogOptions.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2012-02-05 10:49:36 UTC
  • mto: (10.3.1)
  • mto: This revision was merged to the branch mainline in revision 25.
  • Revision ID: package-import@ubuntu.com-20120205104936-4ujoylapu24cquuo
Tags: upstream-2.8.6.3+dfsg
ImportĀ upstreamĀ versionĀ 2.8.6.3+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
{
31
31
        public static class CrashLogOptions
32
32
        {
33
 
                public static string Email {
34
 
                        get; private set;
35
 
                }
36
 
                
37
 
                public static bool LogOnly {
38
 
                        get; private set;
39
 
                }
40
 
                
41
33
                public static string LogPath {
42
34
                        get; private set;
43
35
                }
46
38
                        get; private set;
47
39
                }
48
40
                
 
41
                public static string SessionUuid {
 
42
                        get; private set;
 
43
                }
 
44
                
49
45
                public static bool TryParse (string[] args, out string error)
50
46
                {
51
47
                        error = null;
52
 
                        int pid = -1;
 
48
                        Pid = -1;
53
49
                        
54
50
                        for (int i = 0; i < args.Length; i ++) {
55
 
                                if (args [i] == "-p") {
56
 
                                        if (!int.TryParse (args [++ i], out pid)) {
57
 
                                                pid = -1;
58
 
                                        }
59
 
                                        Pid = pid;
 
51
                                if (args [i] == "-pid") {
 
52
                                        Pid = int.Parse (args [++ i]);
60
53
                                }
61
 
                                
62
 
                                if (args [i] == "-l") {
 
54
                                if (args [i] == "-log") {
63
55
                                        LogPath = args [++ i];
64
56
                                }
65
 
                                
66
 
                                if (args [i] == "-email") {
67
 
                                        Email = args [++ i];
 
57
                                if (args[i] == "-session") {
 
58
                                        SessionUuid = args [++ i];
68
59
                                }
69
 
                                
70
 
                                if (args [i] == "-logonly")
71
 
                                        LogOnly = true;
72
60
                        }
73
61
                        
74
62
                        if (Pid == -1) {
75
63
                                error = "The pid of the MonoDevelop process being monitored must be supplied";
76
64
                        } else if (string.IsNullOrEmpty (LogPath)) {
77
65
                                error = "The path to write log files to must be supplied";
78
 
                        } else if (string.IsNullOrEmpty (Email)) {
79
 
                                error = "The users email must be supplied";
 
66
                        } else if (string.IsNullOrEmpty (SessionUuid)) {
 
67
                                error = "The session uuid must be supplied";
80
68
                        }
81
69
                        
82
70