@@ -10,25 +10,45 @@ namespace ImageMagick.Configuration;
1010/// </summary>
1111public sealed class ConfigurationFiles : IConfigurationFiles
1212{
13- private ConfigurationFiles ( )
13+ private ConfigurationFiles (
14+ IConfigurationFile colors ,
15+ IConfigurationFile configure ,
16+ IConfigurationFile delegates ,
17+ IConfigurationFile english ,
18+ IConfigurationFile locale ,
19+ IConfigurationFile log ,
20+ IConfigurationFile policy ,
21+ IConfigurationFile thresholds ,
22+ IConfigurationFile type ,
23+ IConfigurationFile typeGhostscript )
1424 {
15- Colors = new ConfigurationFile ( " colors.xml" ) ;
16- Configure = new ConfigurationFile ( " configure.xml" ) ;
17- Delegates = new ConfigurationFile ( " delegates.xml" ) ;
18- English = new ConfigurationFile ( " english.xml" ) ;
19- Locale = new ConfigurationFile ( " locale.xml" ) ;
20- Log = new ConfigurationFile ( " log.xml" ) ;
21- Policy = new ConfigurationFile ( " policy.xml" ) ;
22- Thresholds = new ConfigurationFile ( " thresholds.xml" ) ;
23- Type = new ConfigurationFile ( " type.xml" ) ;
24- TypeGhostscript = new ConfigurationFile ( "type-ghostscript.xml" ) ;
25+ Colors = colors ;
26+ Configure = configure ;
27+ Delegates = delegates ;
28+ English = english ;
29+ Locale = locale ;
30+ Log = log ;
31+ Policy = policy ;
32+ Thresholds = thresholds ;
33+ Type = type ;
34+ TypeGhostscript = typeGhostscript ;
2535 }
2636
2737 /// <summary>
2838 /// Gets the default configuration.
2939 /// </summary>
3040 public static IConfigurationFiles Default
31- => new ConfigurationFiles ( ) ;
41+ => new ConfigurationFiles (
42+ colors : new ConfigurationFile ( "colors.xml" ) ,
43+ configure : new ConfigurationFile ( "configure.xml" ) ,
44+ delegates : new ConfigurationFile ( "delegates.xml" ) ,
45+ english : new ConfigurationFile ( "english.xml" ) ,
46+ locale : new ConfigurationFile ( "locale.xml" ) ,
47+ log : new ConfigurationFile ( "log.xml" ) ,
48+ policy : new ConfigurationFile ( "policy.xml" ) ,
49+ thresholds : new ConfigurationFile ( "thresholds.xml" ) ,
50+ type : new ConfigurationFile ( "type.xml" ) ,
51+ typeGhostscript : new ConfigurationFile ( "type-ghostscript.xml" ) ) ;
3252
3353 /// <summary>
3454 /// Gets all the configuration files.
@@ -105,4 +125,26 @@ IConfigurationFiles IConfigurationFiles.Default
105125 /// Gets the type-ghostscript configuration.
106126 /// </summary>
107127 public IConfigurationFile TypeGhostscript { get ; }
128+
129+ /// <summary>
130+ /// Creates a new configuration with Inkscape enabled.
131+ /// </summary>
132+ /// <returns>A new configuration with Inkscape enabled.</returns>
133+ public IConfigurationFiles WithInkscapeEnabled ( )
134+ {
135+ var delegates = new ConfigurationFile ( Delegates ) ;
136+ delegates . Data = delegates . Data . Replace ( @"<!--<delegate decode=""svg:decode"" stealth=""True"" command="""inkscape" "%s" - -export-filename="%s" - -export-dpi="%s" - -export-background="%s" - -export-background-opacity="%s" > "%s" 2>&1""/>-->" , @"<delegate decode=""svg:decode"" stealth=""True"" command="""inkscape" "%s" --export-filename="%s" --export-dpi="%s" --export-background="%s" --export-background-opacity="%s" > "%s" 2>&1""/>" ) ;
137+
138+ return new ConfigurationFiles (
139+ colors : new ConfigurationFile ( Colors ) ,
140+ configure : new ConfigurationFile ( Configure ) ,
141+ delegates : new ConfigurationFile ( delegates ) ,
142+ english : new ConfigurationFile ( English ) ,
143+ locale : new ConfigurationFile ( Locale ) ,
144+ log : new ConfigurationFile ( Log ) ,
145+ policy : new ConfigurationFile ( Policy ) ,
146+ thresholds : new ConfigurationFile ( Thresholds ) ,
147+ type : new ConfigurationFile ( Type ) ,
148+ typeGhostscript : new ConfigurationFile ( TypeGhostscript ) ) ;
149+ }
108150}
0 commit comments