@@ -26,26 +26,63 @@ public PluginUtilities(IPluginGlobals PluginGlobals, IReplaceTagsFunctions Repla
2626 public string [ ] GettingCommandsFromString ( string commands )
2727 {
2828 string [ ] splitCommands = SplitStringByCommaOrSemicolon ( commands ) ;
29+ List < string > commandsList = new List < string > ( ) ;
30+ // Removes arguments from the command when spaces are present
31+ for ( int i = 0 ; i < splitCommands . Length ; i ++ )
32+ {
33+ if ( splitCommands [ i ] . Contains ( ' ' ) )
34+ {
35+ Logger . LogInformation ( $ "Contains space!") ;
36+ if ( splitCommands [ i ] . IndexOf ( ' ' ) == 0 )
37+ {
38+ commandsList . Add ( splitCommands [ i ] ) ;
39+ continue ;
40+ }
41+ Logger . LogInformation ( $ "Is multiple args") ;
42+ string sub = splitCommands [ i ] . Substring ( 0 , splitCommands [ i ] . IndexOf ( ' ' ) ) ;
43+ Logger . LogInformation ( $ "Sub: { sub } ") ;
44+ if ( commandsList . Contains ( sub ) )
45+ {
46+ Logger . LogInformation ( "In IF" ) ;
47+ continue ;
48+ }
49+
50+ if ( ! contains )
51+ commandsList . Add ( sub ) ;
52+ }
53+ else
54+ {
55+ if ( ! commandsList . Contains ( splitCommands [ i ] ) )
56+ commandsList . Add ( splitCommands [ i ] ) ;
57+ }
58+ }
59+
60+
61+ foreach ( var command in commandsList )
62+ {
63+ Logger . LogInformation ( $ "Command: { command } ") ;
64+ }
2965
3066 if ( PluginGlobals . Config . RegisterCommandsAsCSSFramework )
31- return AddCSSTagsToAliases ( splitCommands ) ;
67+ return AddCSSTagsToAliases ( commandsList ) ;
3268
33- return splitCommands ;
69+
70+ return commandsList . ToArray ( ) ;
3471 }
3572
36- public string [ ] AddCSSTagsToAliases ( string [ ] input )
73+ public string [ ] AddCSSTagsToAliases ( List < string > input )
3774 {
38- for ( int i = 0 ; i < input . Length ; i ++ )
75+ for ( int i = 0 ; i < input . Count ; i ++ )
3976 {
4077 if ( ! input [ i ] . StartsWith ( "css_" ) )
4178 input [ i ] = "css_" + input [ i ] ;
4279 }
43- return input ;
80+ return input . ToArray ( ) ;
4481 }
4582
4683 public string [ ] SplitStringByCommaOrSemicolon ( string str )
4784 {
48- return Regex . Split ( str , ",|;| \\ s " )
85+ return Regex . Split ( str , "[,;] " )
4986 . Where ( s => ! string . IsNullOrEmpty ( s ) )
5087 . ToArray ( ) ;
5188 }
0 commit comments