NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Validate.Gui.FormValidator Class Reference
Inheritance diagram for Ntp.Analyzer.Validate.Gui.FormValidator:
Collaboration diagram for Ntp.Analyzer.Validate.Gui.FormValidator:

Public Member Functions

 FormValidator ()
 

Protected Member Functions

override void Dispose (bool disposing)
 Clean up any resources being used. More...
 

Private Member Functions

void button1_Click (object sender, EventArgs e)
 
void checkBoxDefaultValues_CheckedChanged (object sender, EventArgs e)
 
void checkBoxTabulator_CheckedChanged (object sender, EventArgs e)
 
void checkBoxValidate_CheckedChanged (object sender, EventArgs e)
 
void InitializeComponent ()
 Required method for Designer support - do not modify the contents of this method with the code editor. More...
 
Configuration LoadConfig (string configFile)
 
void ValidateConfiguration ()
 

Private Attributes

System.Windows.Forms.Button buttonSelect
 
System.Windows.Forms.CheckBox checkBoxDefaultValues
 
System.Windows.Forms.CheckBox checkBoxTabulator
 
System.Windows.Forms.CheckBox checkBoxValidate
 
System.ComponentModel.IContainer components = null
 Required designer variable. More...
 
string file
 
System.Windows.Forms.GroupBox groupBoxFile
 
System.Windows.Forms.GroupBox groupBoxOptions
 
System.Windows.Forms.Label labelFile
 
System.Windows.Forms.OpenFileDialog openFileDialog
 
System.Windows.Forms.Panel panelButtom
 
System.Windows.Forms.Panel panelTop
 
System.Windows.Forms.TextBox textBoxFile
 
System.Windows.Forms.TextBox textBoxOutput
 

Detailed Description

Definition at line 32 of file Validator.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Validate.Gui.FormValidator.FormValidator ( )
inline

Definition at line 34 of file Validator.cs.

35  {
37  file = null;
38  }
void InitializeComponent()
Required method for Designer support - do not modify the contents of this method with the code editor...

Member Function Documentation

void Ntp.Analyzer.Validate.Gui.FormValidator.button1_Click ( object  sender,
EventArgs  e 
)
inlineprivate

Definition at line 42 of file Validator.cs.

43  {
44  if (openFileDialog.ShowDialog() != DialogResult.OK)
45  return;
46 
47  file = openFileDialog.FileName;
48  textBoxFile.Text = file;
49  textBoxOutput.Clear();
51  }
System.Windows.Forms.TextBox textBoxOutput
System.Windows.Forms.OpenFileDialog openFileDialog
System.Windows.Forms.TextBox textBoxFile
void Ntp.Analyzer.Validate.Gui.FormValidator.checkBoxDefaultValues_CheckedChanged ( object  sender,
EventArgs  e 
)
inlineprivate

Definition at line 53 of file Validator.cs.

void Ntp.Analyzer.Validate.Gui.FormValidator.checkBoxTabulator_CheckedChanged ( object  sender,
EventArgs  e 
)
inlineprivate

Definition at line 58 of file Validator.cs.

void Ntp.Analyzer.Validate.Gui.FormValidator.checkBoxValidate_CheckedChanged ( object  sender,
EventArgs  e 
)
inlineprivate

Definition at line 63 of file Validator.cs.

override void Ntp.Analyzer.Validate.Gui.FormValidator.Dispose ( bool  disposing)
inlineprotected

Clean up any resources being used.

Parameters
disposingtrue if managed resources should be disposed; otherwise, false.

Definition at line 14 of file Validator.Designer.cs.

15  {
16  if (disposing && (components != null))
17  {
18  components.Dispose();
19  }
20  base.Dispose(disposing);
21  }
System.ComponentModel.IContainer components
Required designer variable.
void Ntp.Analyzer.Validate.Gui.FormValidator.InitializeComponent ( )
inlineprivate

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 29 of file Validator.Designer.cs.

30  {
31  this.panelTop = new System.Windows.Forms.Panel();
32  this.groupBoxOptions = new System.Windows.Forms.GroupBox();
33  this.checkBoxValidate = new System.Windows.Forms.CheckBox();
34  this.checkBoxDefaultValues = new System.Windows.Forms.CheckBox();
35  this.checkBoxTabulator = new System.Windows.Forms.CheckBox();
36  this.groupBoxFile = new System.Windows.Forms.GroupBox();
37  this.buttonSelect = new System.Windows.Forms.Button();
38  this.labelFile = new System.Windows.Forms.Label();
39  this.textBoxFile = new System.Windows.Forms.TextBox();
40  this.panelButtom = new System.Windows.Forms.Panel();
41  this.textBoxOutput = new System.Windows.Forms.TextBox();
42  this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
43  this.panelTop.SuspendLayout();
44  this.groupBoxOptions.SuspendLayout();
45  this.groupBoxFile.SuspendLayout();
46  this.panelButtom.SuspendLayout();
47  this.SuspendLayout();
48  //
49  // panelTop
50  //
51  this.panelTop.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
52  | System.Windows.Forms.AnchorStyles.Right)));
53  this.panelTop.AutoSize = true;
54  this.panelTop.Controls.Add(this.groupBoxOptions);
55  this.panelTop.Controls.Add(this.groupBoxFile);
56  this.panelTop.Location = new System.Drawing.Point(0, 0);
57  this.panelTop.Name = "panelTop";
58  this.panelTop.Size = new System.Drawing.Size(654, 111);
59  this.panelTop.TabIndex = 0;
60  //
61  // groupBoxOptions
62  //
63  this.groupBoxOptions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
64  | System.Windows.Forms.AnchorStyles.Right)));
65  this.groupBoxOptions.Controls.Add(this.checkBoxValidate);
66  this.groupBoxOptions.Controls.Add(this.checkBoxDefaultValues);
67  this.groupBoxOptions.Controls.Add(this.checkBoxTabulator);
68  this.groupBoxOptions.Location = new System.Drawing.Point(493, 13);
69  this.groupBoxOptions.Name = "groupBoxOptions";
70  this.groupBoxOptions.Size = new System.Drawing.Size(149, 85);
71  this.groupBoxOptions.TabIndex = 1;
72  this.groupBoxOptions.TabStop = false;
73  this.groupBoxOptions.Text = "Options";
74  //
75  // checkBoxValidate
76  //
77  this.checkBoxValidate.AutoSize = true;
78  this.checkBoxValidate.Location = new System.Drawing.Point(18, 19);
79  this.checkBoxValidate.Name = "checkBoxValidate";
80  this.checkBoxValidate.Size = new System.Drawing.Size(86, 17);
81  this.checkBoxValidate.TabIndex = 7;
82  this.checkBoxValidate.Text = "Validate only";
83  this.checkBoxValidate.UseVisualStyleBackColor = true;
84  this.checkBoxValidate.CheckedChanged += new System.EventHandler(this.checkBoxValidate_CheckedChanged);
85  //
86  // checkBoxDefaultValues
87  //
88  this.checkBoxDefaultValues.AutoSize = true;
89  this.checkBoxDefaultValues.Location = new System.Drawing.Point(18, 62);
90  this.checkBoxDefaultValues.Name = "checkBoxDefaultValues";
91  this.checkBoxDefaultValues.Size = new System.Drawing.Size(124, 17);
92  this.checkBoxDefaultValues.TabIndex = 6;
93  this.checkBoxDefaultValues.Text = "Show Default values";
94  this.checkBoxDefaultValues.UseVisualStyleBackColor = true;
95  this.checkBoxDefaultValues.CheckedChanged += new System.EventHandler(this.checkBoxDefaultValues_CheckedChanged);
96  //
97  // checkBoxTabulator
98  //
99  this.checkBoxTabulator.AutoSize = true;
100  this.checkBoxTabulator.Location = new System.Drawing.Point(18, 41);
101  this.checkBoxTabulator.Name = "checkBoxTabulator";
102  this.checkBoxTabulator.Size = new System.Drawing.Size(89, 17);
103  this.checkBoxTabulator.TabIndex = 5;
104  this.checkBoxTabulator.Text = "Use tabulator";
105  this.checkBoxTabulator.UseVisualStyleBackColor = true;
106  this.checkBoxTabulator.CheckedChanged += new System.EventHandler(this.checkBoxTabulator_CheckedChanged);
107  //
108  // groupBoxFile
109  //
110  this.groupBoxFile.Controls.Add(this.buttonSelect);
111  this.groupBoxFile.Controls.Add(this.labelFile);
112  this.groupBoxFile.Controls.Add(this.textBoxFile);
113  this.groupBoxFile.Location = new System.Drawing.Point(13, 13);
114  this.groupBoxFile.Name = "groupBoxFile";
115  this.groupBoxFile.Size = new System.Drawing.Size(474, 85);
116  this.groupBoxFile.TabIndex = 0;
117  this.groupBoxFile.TabStop = false;
118  this.groupBoxFile.Text = "Configuration";
119  //
120  // buttonSelect
121  //
122  this.buttonSelect.Location = new System.Drawing.Point(390, 21);
123  this.buttonSelect.Name = "buttonSelect";
124  this.buttonSelect.Size = new System.Drawing.Size(46, 20);
125  this.buttonSelect.TabIndex = 3;
126  this.buttonSelect.Text = "Select";
127  this.buttonSelect.UseVisualStyleBackColor = true;
128  this.buttonSelect.Click += new System.EventHandler(this.button1_Click);
129  //
130  // labelFile
131  //
132  this.labelFile.AutoSize = true;
133  this.labelFile.Location = new System.Drawing.Point(6, 23);
134  this.labelFile.Name = "labelFile";
135  this.labelFile.Size = new System.Drawing.Size(23, 13);
136  this.labelFile.TabIndex = 2;
137  this.labelFile.Text = "File";
138  //
139  // textBoxFile
140  //
141  this.textBoxFile.Location = new System.Drawing.Point(49, 23);
142  this.textBoxFile.Name = "textBoxFile";
143  this.textBoxFile.Size = new System.Drawing.Size(335, 20);
144  this.textBoxFile.TabIndex = 1;
145  //
146  // panelButtom
147  //
148  this.panelButtom.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
149  | System.Windows.Forms.AnchorStyles.Left)
150  | System.Windows.Forms.AnchorStyles.Right)));
151  this.panelButtom.Controls.Add(this.textBoxOutput);
152  this.panelButtom.Location = new System.Drawing.Point(0, 117);
153  this.panelButtom.Name = "panelButtom";
154  this.panelButtom.Size = new System.Drawing.Size(653, 382);
155  this.panelButtom.TabIndex = 1;
156  //
157  // textBoxOutput
158  //
159  this.textBoxOutput.Dock = System.Windows.Forms.DockStyle.Fill;
160  this.textBoxOutput.Location = new System.Drawing.Point(0, 0);
161  this.textBoxOutput.Multiline = true;
162  this.textBoxOutput.Name = "textBoxOutput";
163  this.textBoxOutput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
164  this.textBoxOutput.Size = new System.Drawing.Size(653, 382);
165  this.textBoxOutput.TabIndex = 0;
166  //
167  // FormValidator
168  //
169  this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
170  this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
171  this.ClientSize = new System.Drawing.Size(654, 499);
172  this.Controls.Add(this.panelButtom);
173  this.Controls.Add(this.panelTop);
174  this.Name = "FormValidator";
175  this.Text = "NTP Analyzer Validator";
176  this.panelTop.ResumeLayout(false);
177  this.groupBoxOptions.ResumeLayout(false);
178  this.groupBoxOptions.PerformLayout();
179  this.groupBoxFile.ResumeLayout(false);
180  this.groupBoxFile.PerformLayout();
181  this.panelButtom.ResumeLayout(false);
182  this.panelButtom.PerformLayout();
183  this.ResumeLayout(false);
184  this.PerformLayout();
185 
186  }
System.Windows.Forms.CheckBox checkBoxTabulator
System.Windows.Forms.GroupBox groupBoxFile
void button1_Click(object sender, EventArgs e)
Definition: Validator.cs:42
System.Windows.Forms.TextBox textBoxOutput
System.Windows.Forms.OpenFileDialog openFileDialog
System.Windows.Forms.GroupBox groupBoxOptions
System.Windows.Forms.CheckBox checkBoxValidate
System.Windows.Forms.TextBox textBoxFile
void checkBoxDefaultValues_CheckedChanged(object sender, EventArgs e)
Definition: Validator.cs:53
System.Windows.Forms.CheckBox checkBoxDefaultValues
void checkBoxValidate_CheckedChanged(object sender, EventArgs e)
Definition: Validator.cs:63
void checkBoxTabulator_CheckedChanged(object sender, EventArgs e)
Definition: Validator.cs:58
System.Windows.Forms.Button buttonSelect
Configuration Ntp.Analyzer.Validate.Gui.FormValidator.LoadConfig ( string  configFile)
inlineprivate

Definition at line 68 of file Validator.cs.

69  {
70  if (!File.Exists(configFile))
71  {
72  textBoxOutput.Text = $"Cannot find configuration file {configFile}";
73  return null;
74  }
75 
76  var reader = new ConfigBuilder(configFile);
77  var config = reader.Execute();
78  if (config != null)
79  return config;
80 
81  textBoxOutput.Lines = reader.Errors.ToArray();
82  return null;
83  }
System.Windows.Forms.TextBox textBoxOutput
void Ntp.Analyzer.Validate.Gui.FormValidator.ValidateConfiguration ( )
inlineprivate

Definition at line 85 of file Validator.cs.

References e.

86  {
87  if (string.IsNullOrEmpty(file))
88  return;
89 
90  textBoxOutput.Clear();
91 
92  Configuration config;
93  try
94  {
95  config = LoadConfig(file);
96  }
97  catch (Exception e)
98  {
99  textBoxOutput.Text = @"Unexpected error while loading configuration file: " + e.Message;
100  return;
101  }
102 
103  if (config == null)
104  return;
105 
106  if (checkBoxValidate.Checked)
107  {
108  textBoxOutput.Text = @"Configuration is valid.";
109  return;
110  }
111 
112  try
113  {
114  var decompiler = new Decompiler
115  {
116  Configuration = config,
117  IndentChar = checkBoxTabulator.Checked ? '\t' : ' ',
118  IndentSize = checkBoxTabulator.Checked ? 1 : 8,
119  ShowDefaultValues = checkBoxDefaultValues.Checked
120  };
121 
122  textBoxOutput.Text = decompiler.Execute();
123  }
124  catch (Exception e)
125  {
126  textBoxOutput.Text = @"Unexpected error while decompiling configuration: " + e.Message;
127  }
128  }
System.Windows.Forms.CheckBox checkBoxTabulator
System.Windows.Forms.TextBox textBoxOutput
var e
Definition: bootstrap.min.js:6
System.Windows.Forms.CheckBox checkBoxValidate
Configuration LoadConfig(string configFile)
Definition: Validator.cs:68
System.Windows.Forms.CheckBox checkBoxDefaultValues

Member Data Documentation

System.Windows.Forms.Button Ntp.Analyzer.Validate.Gui.FormValidator.buttonSelect
private

Definition at line 192 of file Validator.Designer.cs.

System.Windows.Forms.CheckBox Ntp.Analyzer.Validate.Gui.FormValidator.checkBoxDefaultValues
private

Definition at line 200 of file Validator.Designer.cs.

System.Windows.Forms.CheckBox Ntp.Analyzer.Validate.Gui.FormValidator.checkBoxTabulator
private

Definition at line 201 of file Validator.Designer.cs.

System.Windows.Forms.CheckBox Ntp.Analyzer.Validate.Gui.FormValidator.checkBoxValidate
private

Definition at line 199 of file Validator.Designer.cs.

System.ComponentModel.IContainer Ntp.Analyzer.Validate.Gui.FormValidator.components = null
private

Required designer variable.

Definition at line 8 of file Validator.Designer.cs.

string Ntp.Analyzer.Validate.Gui.FormValidator.file
private

Definition at line 40 of file Validator.cs.

System.Windows.Forms.GroupBox Ntp.Analyzer.Validate.Gui.FormValidator.groupBoxFile
private

Definition at line 191 of file Validator.Designer.cs.

System.Windows.Forms.GroupBox Ntp.Analyzer.Validate.Gui.FormValidator.groupBoxOptions
private

Definition at line 198 of file Validator.Designer.cs.

System.Windows.Forms.Label Ntp.Analyzer.Validate.Gui.FormValidator.labelFile
private

Definition at line 193 of file Validator.Designer.cs.

System.Windows.Forms.OpenFileDialog Ntp.Analyzer.Validate.Gui.FormValidator.openFileDialog
private

Definition at line 197 of file Validator.Designer.cs.

System.Windows.Forms.Panel Ntp.Analyzer.Validate.Gui.FormValidator.panelButtom
private

Definition at line 195 of file Validator.Designer.cs.

System.Windows.Forms.Panel Ntp.Analyzer.Validate.Gui.FormValidator.panelTop
private

Definition at line 190 of file Validator.Designer.cs.

System.Windows.Forms.TextBox Ntp.Analyzer.Validate.Gui.FormValidator.textBoxFile
private

Definition at line 194 of file Validator.Designer.cs.

System.Windows.Forms.TextBox Ntp.Analyzer.Validate.Gui.FormValidator.textBoxOutput
private

Definition at line 196 of file Validator.Designer.cs.


The documentation for this class was generated from the following files: