@@ -136,23 +136,47 @@ protected override void ParseVersion(object versionProvider)
136136 }
137137 }
138138 }
139+ private void chengeLines ( List < String > newLines , int index , string ip )
140+ {
141+ if ( ( newLines [ index - 1 ] [ 0 ] == ' ' && ! newLines [ index - 1 ] . Contains ( "description" ) ) || ( newLines [ index + 1 ] [ 0 ] == ' ' && ! newLines [ index + 1 ] . Contains ( "description" ) ) )
142+ {
143+ newLines [ index ] = " network-object host " + ip ;
144+ int inserIndex = index ;
145+ while ( newLines [ inserIndex ] [ 0 ] == ' ' )
146+ {
147+ inserIndex -= 1 ;
148+ }
149+ newLines . Insert ( inserIndex , "object network " + ip ) ;
150+ newLines . Insert ( inserIndex + 1 , " host " + ip ) ;
151+ }
152+ }
139153
140154 private void ParseCommands ( string filename )
141155 {
142156 string [ ] lines = File . ReadAllLines ( filename , Encoding . GetEncoding ( "us-ascii" , new EncoderReplacementFallback ( "" ) , new DecoderReplacementFallback ( "" ) ) ) ;
143157 ParsedLines = lines . Count ( ) ;
144158
159+ var newLines = lines . ToList ( ) ;
160+
161+ for ( var i = 0 ; i < newLines . Count ; i ++ )
162+ {
163+ if ( newLines [ i ] . Contains ( "255.255.255.255" ) && newLines [ i ] . Contains ( "network-object" ) )
164+ chengeLines ( newLines , i , newLines [ i ] . Split ( ' ' ) [ 2 ] ) ;
165+ }
166+ lines = newLines . ToArray ( ) ;
167+
145168 var parents = new Stack < Indentation > ( ) ;
146169 var flatList = new List < CiscoCommand > ( ) ;
147-
148170 parents . Push ( new Indentation ( null , 0 ) ) ;
149171
150172 int prevIndentationLevel = 0 ;
151173 int lineId = 0 ;
152-
174+
153175 foreach ( string line in lines )
154176 {
155177 lineId ++ ;
178+
179+
156180
157181 // Check for an empty line or line with just spaces.
158182 if ( line . Trim ( ) . Length == 0 )
@@ -195,6 +219,11 @@ private void ParseCommands(string filename)
195219
196220 prevIndentationLevel = command . IndentationLevel ;
197221 flatList . Add ( FindCommand ( command ) ) ;
222+
223+ if ( line . Contains ( "g-ext-dns-leg" ) )
224+ {
225+ var gd = 3 ;
226+ }
198227 }
199228
200229 _ciscoCommands = flatList . BuildTree ( ) ;
@@ -204,6 +233,10 @@ private void ParseCommands(string filename)
204233 {
205234 ParseWithChildren ( command , prevCommand ) ;
206235 prevCommand = command ;
236+ if ( command . Text . Contains ( "g-ext-dns-leg" ) )
237+ {
238+ var gd = 3 ;
239+ }
207240 }
208241
209242 // Remove duplicates
0 commit comments