@@ -159,42 +159,64 @@ static void SaveConfig(PACTConfig conf)
159159 //////////////////////////////////////
160160 static void AddException ( List < string > arguments )
161161 {
162- int priority ;
163- List < int > cores = new List < int > ( ) ;
164- string exeName ;
165-
166- if ( arguments . Count >= minArgumentCount_AddException && int . TryParse ( arguments [ 2 ] , out priority ) )
162+ if ( arguments . Count >= minArgumentCount_AddException )
167163 {
168- foreach ( var str in arguments . Skip ( 3 ) )
164+ int priority ;
165+ List < int > cores = new List < int > ( ) ;
166+
167+ arguments = arguments . Skip ( 1 ) . ToList ( ) ;
168+ string exeName = arguments [ 0 ] ;
169+
170+ if ( exeName [ 0 ] == '\" ' )
169171 {
170- int number ;
171- if ( int . TryParse ( str , out number ) && number <= highestCoreNumber && number >= 0 )
172- {
173- cores . Add ( number ) ;
174- }
175- else
172+ arguments = arguments . Skip ( 1 ) . ToList ( ) ;
173+ string current = arguments [ 0 ] ;
174+
175+ while ( ! current . Contains ( '\" ' ) )
176176 {
177- throw new ArgumentException ( ) ;
177+ exeName = $ "{ exeName } { current } ";
178+ arguments = arguments . Skip ( 1 ) . ToList ( ) ;
179+ current = arguments [ 0 ] ;
178180 }
181+
182+ exeName = $ "{ exeName } { current } ";
179183 }
180184
181- exeName = arguments [ 1 ] ;
182- cores . Sort ( ) ;
185+ arguments = arguments . Skip ( 1 ) . ToList ( ) ;
183186
184- if ( exeName . Substring ( exeName . Length - 4 , 4 ) == ".exe" )
187+ if ( int . TryParse ( arguments [ 0 ] , out priority ) )
185188 {
186- exeName = exeName . Substring ( 0 , exeName . Length - 4 ) ;
187- }
189+ foreach ( var str in arguments . Skip ( 1 ) )
190+ {
191+ int number ;
192+ if ( int . TryParse ( str , out number ) && number <= highestCoreNumber && number >= 0 )
193+ {
194+ cores . Add ( number ) ;
195+ }
196+ else
197+ {
198+ throw new ArgumentException ( ) ;
199+ }
200+ }
188201
189- if ( conf . ProcessConfigs . ContainsKey ( exeName ) )
190- {
191- conf . ProcessConfigs [ exeName ] = new ProcessConfig ( cores , priority ) ;
192- Console . WriteLine ( $ "Process [{ exeName } ] has been updated!") ;
193- }
194- else
195- {
196- conf . ProcessConfigs . Add ( exeName , new ProcessConfig ( cores , priority ) ) ;
197- Console . WriteLine ( $ "Process [{ exeName } ] has been added!") ;
202+ exeName = exeName . Replace ( "\" " , "" ) ;
203+ cores . Sort ( ) ;
204+
205+ if ( exeName . Length > 4 && exeName . Substring ( exeName . Length - 4 , 4 ) == ".exe" )
206+ {
207+ exeName = exeName . Substring ( 0 , exeName . Length - 4 ) ;
208+ }
209+
210+ if ( conf . ProcessConfigs . ContainsKey ( exeName ) )
211+ {
212+ conf . ProcessConfigs [ exeName ] = new ProcessConfig ( cores , priority ) ;
213+ Console . WriteLine ( $ "Process [{ exeName } ] has been updated!") ;
214+ }
215+ else
216+ {
217+ conf . ProcessConfigs . Add ( exeName , new ProcessConfig ( cores , priority ) ) ;
218+ Console . WriteLine ( $ "Process [{ exeName } ] has been added!") ;
219+ }
198220 }
199221 }
200222 else
0 commit comments