@@ -30,7 +30,7 @@ public ChecksPanel(StackPanel panel)
3030 {
3131 mPanel = panel ;
3232
33- LoadChecksList ( ) ;
33+ BuildChecksList ( ) ;
3434 GenerateControls ( ) ;
3535 LoadSettings ( ) ;
3636 }
@@ -95,19 +95,9 @@ private string GetSuppressionsString()
9595 return result ;
9696 }
9797
98- private void LoadChecksList ( )
98+ private void BuildChecksList ( )
9999 {
100- System . Diagnostics . Process p = new System . Diagnostics . Process ( ) ;
101- p . StartInfo . UseShellExecute = false ;
102- p . StartInfo . RedirectStandardOutput = true ;
103- p . StartInfo . FileName = Properties . Settings . Default . CPPcheckPath ;
104- p . StartInfo . Arguments = "--errorlist --xml-version=2" ;
105- p . Start ( ) ;
106- string output = p . StandardOutput . ReadToEnd ( ) ;
107- p . WaitForExit ( ) ;
108-
109- System . Xml . XmlDocument checksList = new System . Xml . XmlDocument ( ) ;
110- checksList . LoadXml ( output ) ;
100+ var checksList = LoadChecksList ( ) ;
111101
112102 foreach ( XmlNode node in checksList . SelectNodes ( "//errors/error" ) )
113103 {
@@ -123,6 +113,30 @@ private void LoadChecksList()
123113 }
124114 }
125115
116+ private XmlDocument LoadChecksList ( )
117+ {
118+ using ( var process = new System . Diagnostics . Process ( ) )
119+ {
120+ var startInfo = process . StartInfo ;
121+ startInfo . UseShellExecute = false ;
122+ startInfo . CreateNoWindow = true ;
123+ startInfo . RedirectStandardOutput = true ;
124+ startInfo . FileName = Properties . Settings . Default . CPPcheckPath ;
125+ startInfo . Arguments = "--errorlist --xml-version=2" ;
126+ process . Start ( ) ;
127+ String output ;
128+ using ( var outputStream = process . StandardOutput )
129+ {
130+ output = outputStream . ReadToEnd ( ) ;
131+ }
132+ process . WaitForExit ( ) ;
133+
134+ var checksList = new XmlDocument ( ) ;
135+ checksList . LoadXml ( output ) ;
136+ return checksList ;
137+ }
138+ }
139+
126140 private void GenerateControls ( )
127141 {
128142 foreach ( var severity in mChecks )
0 commit comments