@@ -82,48 +82,85 @@ private static string ExportPackage(IEngine engine, IEnumerable<App> apps, Expor
82
82
// Add the app as CompanionFiles
83
83
AddAppToArchive ( zip , app , options ) ;
84
84
85
- engine . GenerateInformation ( $ "Adding Scripts") ;
85
+ if ( options . ExcludeScripts )
86
+ {
87
+ engine . GenerateInformation ( "Skipping Automation Scripts" ) ;
88
+ }
89
+ else
90
+ {
91
+ engine . GenerateInformation ( $ "Adding Scripts") ;
86
92
87
- // Add the scripts used in the App
88
- var scripts = AddScriptsToArchive ( zip , app ) ;
93
+ // Add the scripts used in the App
94
+ var scripts = AddScriptsToArchive ( zip , app ) ;
89
95
90
- engine . GenerateInformation ( $ "Adding Script dependencies") ;
96
+ engine . GenerateInformation ( $ "Adding Script dependencies") ;
91
97
92
- // Add script dependencies
93
- var appReferences = AddDependenciesToArchive ( zip , app , scripts ) ;
94
- foreach ( var pair in appReferences )
95
- {
96
- if ( ! scriptReferences . ContainsKey ( pair . Key ) )
98
+ // Add script dependencies
99
+ var appReferences = AddDependenciesToArchive ( zip , app , scripts ) ;
100
+ foreach ( var pair in appReferences )
97
101
{
98
- scriptReferences . Add ( pair . Key , pair . Value ) ;
99
- }
100
- else
101
- {
102
- scriptReferences [ pair . Key ] . AddRange ( pair . Value ) ;
102
+ if ( ! scriptReferences . ContainsKey ( pair . Key ) )
103
+ {
104
+ scriptReferences . Add ( pair . Key , pair . Value ) ;
105
+ }
106
+ else
107
+ {
108
+ scriptReferences [ pair . Key ] . AddRange ( pair . Value ) ;
109
+ }
103
110
}
104
111
}
105
112
106
- // Add Dom definitions
107
- domModuleIds . AddRangeUnique ( app . LatestVersion . GetUsedDomModules ( ) ) ;
113
+ if ( ! options . ExcludeDom )
114
+ {
115
+ // Add Dom definitions
116
+ domModuleIds . AddRangeUnique ( app . LatestVersion . GetUsedDomModules ( ) ) ;
117
+ }
108
118
109
- // Add Images to companion files
110
- images . AddRangeUnique ( app . LatestVersion . GetUsedImages ( ) ) ;
119
+ if ( ! options . ExcludeImages )
120
+ {
121
+ // Add Images to companion files
122
+ images . AddRangeUnique ( app . LatestVersion . GetUsedImages ( ) ) ;
123
+ }
111
124
112
- // Add Theme
113
- themes . AddRangeUnique ( app . LatestVersion . GetUsedThemes ( ) ) ;
125
+ if ( ! options . ExcludeThemes )
126
+ {
127
+ // Add Theme
128
+ themes . AddRangeUnique ( app . LatestVersion . GetUsedThemes ( ) ) ;
129
+ }
114
130
}
115
131
116
132
// Add DOM modules
117
- engine . GenerateInformation ( $ "Adding DOM modules") ;
118
- AddDomToArchive ( engine , zip , domModuleIds , options ) ;
133
+ if ( options . ExcludeDom )
134
+ {
135
+ engine . GenerateInformation ( $ "Skipping DOM modules") ;
136
+ }
137
+ else
138
+ {
139
+ engine . GenerateInformation ( $ "Adding DOM modules") ;
140
+ AddDomToArchive ( engine , zip , domModuleIds , options ) ;
141
+ }
119
142
120
- // Add Images
121
- engine . GenerateInformation ( $ "Adding Images") ;
122
- AddImagesToArchive ( zip , images ) ;
143
+ if ( options . ExcludeImages )
144
+ {
145
+ engine . GenerateInformation ( $ "Skipping Images") ;
146
+ }
147
+ else
148
+ {
149
+ // Add Images
150
+ engine . GenerateInformation ( $ "Adding Images") ;
151
+ AddImagesToArchive ( zip , images ) ;
152
+ }
123
153
124
- // Add Themes
125
- engine . GenerateInformation ( $ "Adding Themes") ;
126
- AddThemesToArchive ( zip , themes ) ;
154
+ if ( options . ExcludeThemes )
155
+ {
156
+ engine . GenerateInformation ( $ "Skipping Themes") ;
157
+ }
158
+ else
159
+ {
160
+ // Add Themes
161
+ engine . GenerateInformation ( $ "Adding Themes") ;
162
+ AddThemesToArchive ( zip , themes ) ;
163
+ }
127
164
128
165
engine . GenerateInformation ( $ "Adding Installer code") ;
129
166
@@ -275,7 +312,7 @@ private static void AddThemesToArchive(ZipArchive zip, List<DMADashboardTheme> t
275
312
usedThemesArray . Clear ( ) ;
276
313
277
314
// Add the ones needed for the package to the cloned
278
- foreach ( var theme in themes )
315
+ foreach ( var theme in themes )
279
316
{
280
317
var usedTheme = allThemes . First ( t => t [ "Name" ] . Value < string > ( ) == theme . Name ) ;
281
318
usedThemesArray . Add ( usedTheme ) ;
@@ -293,17 +330,29 @@ public class ExportOptions
293
330
294
331
public bool ExportPackage { get ; } = true ;
295
332
333
+ public bool OverwritePreviousVersions { get ; set ; }
334
+
335
+ public bool ExcludeScripts { get ; set ; }
336
+
337
+ public bool ExcludeDom { get ; set ; }
338
+
296
339
public bool ExportDomInstances { get ; set ; }
297
340
298
- public bool OverwritePreviousVersions { get ; set ; }
341
+ public bool ExcludeImages { get ; set ; }
342
+
343
+ public bool ExcludeThemes { get ; set ; }
299
344
300
345
public static ExportOptions FromDialog ( ExportDialog dialog )
301
346
{
302
347
return new ExportOptions
303
348
{
304
349
IncludeVersions = dialog . ExportVersions . IsChecked ,
305
- ExportDomInstances = dialog . ExportDomInstances . IsChecked ,
306
350
OverwritePreviousVersions = dialog . OverwritePreviousVersions . IsChecked ,
351
+ ExcludeScripts = dialog . ExcludeScripts . IsChecked ,
352
+ ExcludeDom = dialog . ExcludeDom . IsChecked ,
353
+ ExportDomInstances = dialog . ExportDomInstances . IsChecked ,
354
+ ExcludeImages = dialog . ExcludeImages . IsChecked ,
355
+ ExcludeThemes = dialog . ExcludeThemes . IsChecked ,
307
356
} ;
308
357
}
309
358
}
0 commit comments