comparison ServerMonitor/Controls/HttpCheckControl.cs @ 1:9e92780ebc0f

Additional validation for SSH check
author Brad Greco <brad@bgreco.net>
date Tue, 01 Jan 2019 21:14:47 -0500
parents 3e1a2131f897
children 7127d5b5ac75
comparison
equal deleted inserted replaced
0:3e1a2131f897 1:9e92780ebc0f
35 public override void UpdateCheck(Check check1) 35 public override void UpdateCheck(Check check1)
36 { 36 {
37 HttpCheck check = (HttpCheck)check1; 37 HttpCheck check = (HttpCheck)check1;
38 check.Url = UrlTextBox.Text.Trim(); 38 check.Url = UrlTextBox.Text.Trim();
39 check.CheckResponseCode = ResponseCodeCheckBox.Checked; 39 check.CheckResponseCode = ResponseCodeCheckBox.Checked;
40 check.ResponseCode = int.Parse(ResponseCodeTextBox.Text); 40 try
41 {
42 check.ResponseCode = int.Parse(ResponseCodeTextBox.Text);
43 }
44 catch
45 {
46 throw new UpdateCheckException("Response code must be an integer.");
47 }
41 check.CheckResponseLength = ResponseLengthCheckbox.Checked; 48 check.CheckResponseLength = ResponseLengthCheckbox.Checked;
42 check.ResponseLengthMin = ResponseLengthMinTextBox.Text; 49 check.ResponseLengthMin = ResponseLengthMinTextBox.Text;
43 check.ResponseLengthMax = ResponseLengthMaxTextBox.Text; 50 check.ResponseLengthMax = ResponseLengthMaxTextBox.Text;
44 check.CheckResponseBody = ResponseBodyCheckBox.Checked; 51 check.CheckResponseBody = ResponseBodyCheckBox.Checked;
45 check.ResponseBodyMatchType = (MatchType)ResponseBodyComboBox.SelectedIndex; 52 check.ResponseBodyMatchType = (MatchType)ResponseBodyComboBox.SelectedIndex;