@@ -17,21 +17,21 @@ public static class AddThing
1717 /// <param name="resourceNames"></param>
1818 /// <param name="onAddedFiles"></param>
1919 /// <returns></returns>
20- public static CommandResult Exec ( Template template , AddConfig config , Dictionary < string , string > fileStructure , Action < IEnumerable < string > > ? onAddedFiles = null , StringReplacements ? replacements = null )
20+ public static CommandResult Exec ( Template template , AddConfig config , Dictionary < string , string > fileStructure , Action < IEnumerable < string > > ? onAddedFiles = null , Dictionary < string , string > ? replacements = null )
2121 {
2222 return CommandBase . Exec ( template , ( ) =>
2323 {
2424 try
2525 {
26- replacements ??= new StringReplacements ( config ) ;
26+ replacements ??= [ ] ;
2727
2828 var files = template . WriteFilesToDisk (
2929 fileStructure
3030 ) ;
3131
3232 Template . ReplacePlaceHoldersInsideFiles (
3333 files ,
34- replacements . FileContentPatterns ) ;
34+ replacements ) ;
3535
3636 onAddedFiles ? . Invoke ( files ) ;
3737 }
@@ -61,56 +61,5 @@ public class AddConfig
6161 /// Actual name identifiere of the *thing* to be added
6262 /// </summary>
6363 public required string ThingName { get ; set ; }
64-
65- /// <summary>
66- /// *Thing*s placeholder
67- /// </summary>
68- public required IEnumerable < string > ThingPlaceholders { get ; set ; }
69- }
70-
71- public class StringReplacements
72- {
73- public Dictionary < string , string > FileNamePatterns { get ; }
74- public Dictionary < string , string > FileContentPatterns { get ; }
75-
76- public StringReplacements ( AddConfig config )
77- {
78- FileNamePatterns = CreateDictionary ( config ) ;
79- FileContentPatterns = CreateDictionary ( config ) ;
80- }
81-
82- public Dictionary < string , string > CreateDictionary ( AddConfig config )
83- {
84- var result = config . ThingPlaceholders
85- . ToDictionary ( s => s , s => config . ThingName ) ;
86-
87- result . TryAdd ( Template . AppPlaceholder , config . SolutionName ) ;
88- return result ;
89- }
90-
91-
92- public StringReplacements AddFileNamePatterns ( Dictionary < string , string > patterns )
93- {
94- foreach ( var pattern in patterns )
95- {
96- if ( ! FileNamePatterns . ContainsKey ( pattern . Key ) )
97- {
98- FileNamePatterns . Add ( pattern . Key , pattern . Value ) ;
99- }
100- }
101- return this ;
102- }
103-
104- public StringReplacements AddContentPatterns ( Dictionary < string , string > patterns )
105- {
106- foreach ( var pattern in patterns )
107- {
108- if ( ! FileContentPatterns . ContainsKey ( pattern . Key ) )
109- {
110- FileContentPatterns . Add ( pattern . Key , pattern . Value ) ;
111- }
112- }
113- return this ;
114- }
11564 }
11665}
0 commit comments