@@ -10,7 +10,6 @@ public partial class MainWindowViewModel : MainWindowViewModelBase
10
10
private readonly IWindowsApplicationInstallerService waInstallerService ;
11
11
private readonly IAzureStorageAccountInstallerService azureStorageAccountInstallerService ;
12
12
private readonly ToastNotificationManager notificationManager = new ( ) ;
13
- private readonly DirectoryInfo installerTempDirectory = new ( Path . Combine ( Path . GetTempPath ( ) , "atc-installer" ) ) ;
14
13
private DirectoryInfo ? installationDirectory ;
15
14
private string ? projectName ;
16
15
private ComponentProviderViewModel ? selectedComponentProvider ;
@@ -29,7 +28,7 @@ public MainWindowViewModel()
29
28
30
29
this . azureStorageAccountInstallerService = new AzureStorageAccountInstallerService ( ) ;
31
30
32
- this . installationDirectory = new DirectoryInfo ( Path . Combine ( installerTempDirectory . FullName , "InstallationFiles" ) ) ;
31
+ this . installationDirectory = new DirectoryInfo ( Path . Combine ( App . InstallerTempDirectory . FullName , "InstallationFiles" ) ) ;
33
32
34
33
ApplicationOptions = new ApplicationOptionsViewModel ( new ApplicationOptions ( ) ) ;
35
34
@@ -44,7 +43,7 @@ public MainWindowViewModel()
44
43
waInstallerService ,
45
44
networkShellService ,
46
45
new ObservableCollectionEx < ComponentProviderViewModel > ( ) ,
47
- installerTempDirectory ,
46
+ App . InstallerTempDirectory ,
48
47
installationDirectory ,
49
48
ProjectName ,
50
49
new Dictionary < string , object > ( StringComparer . Ordinal ) ,
@@ -59,7 +58,7 @@ public MainWindowViewModel()
59
58
iisInstallerService ,
60
59
networkShellService ,
61
60
ComponentProviders ,
62
- installerTempDirectory ,
61
+ App . InstallerTempDirectory ,
63
62
installationDirectory ,
64
63
ProjectName ,
65
64
new Dictionary < string , object > ( StringComparer . Ordinal ) ,
@@ -89,7 +88,6 @@ public MainWindowViewModel(
89
88
this . waInstallerService = windowsApplicationInstallerService ?? throw new ArgumentNullException ( nameof ( windowsApplicationInstallerService ) ) ;
90
89
this . azureStorageAccountInstallerService = azureStorageAccountInstallerService ?? throw new ArgumentNullException ( nameof ( azureStorageAccountInstallerService ) ) ;
91
90
92
- applicationOptionsValue = RestoreCustomAppSettingsIfNeeded ( applicationOptionsValue ) ;
93
91
LoadRecentOpenFiles ( ) ;
94
92
95
93
ApplicationOptions = new ApplicationOptionsViewModel ( applicationOptionsValue ) ;
@@ -174,27 +172,9 @@ public void StopMonitoringServices()
174
172
cancellationTokenSource ? . Cancel ( ) ;
175
173
}
176
174
177
- private ApplicationOptions RestoreCustomAppSettingsIfNeeded (
178
- ApplicationOptions applicationOptions )
179
- {
180
- var currentFile = new FileInfo ( Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "appsettings.custom.json" ) ) ;
181
- var backupFile = new FileInfo ( Path . Combine ( installerTempDirectory . FullName , "appsettings.custom.json" ) ) ;
182
- if ( ! currentFile . Exists ||
183
- ! backupFile . Exists ||
184
- currentFile . LastWriteTime == backupFile . LastWriteTime )
185
- {
186
- return applicationOptions ;
187
- }
188
-
189
- File . Copy ( backupFile . FullName , currentFile . FullName , overwrite : true ) ;
190
-
191
- var wrapperModel = FileHelper < ApplicationOptionsWrapper > . ReadJsonFileToModel ( fileInfo : backupFile ) ! ;
192
- return wrapperModel . Application ;
193
- }
194
-
195
175
private void LoadRecentOpenFiles ( )
196
176
{
197
- var recentOpenFilesFile = Path . Combine ( installerTempDirectory . FullName , "RecentOpenFiles.json" ) ;
177
+ var recentOpenFilesFile = Path . Combine ( App . InstallerTempDirectory . FullName , "RecentOpenFiles.json" ) ;
198
178
if ( ! File . Exists ( recentOpenFilesFile ) )
199
179
{
200
180
return ;
@@ -256,10 +236,10 @@ private void AddLoadedFileToRecentOpenFiles(
256
236
recentOpenFilesOption . RecentOpenFiles . Add ( item ) ;
257
237
}
258
238
259
- var recentOpenFilesFilePath = Path . Combine ( installerTempDirectory . FullName , "RecentOpenFiles.json" ) ;
260
- if ( ! Directory . Exists ( installerTempDirectory . FullName ) )
239
+ var recentOpenFilesFilePath = Path . Combine ( App . InstallerTempDirectory . FullName , "RecentOpenFiles.json" ) ;
240
+ if ( ! Directory . Exists ( App . InstallerTempDirectory . FullName ) )
261
241
{
262
- Directory . CreateDirectory ( installerTempDirectory . FullName ) ;
242
+ Directory . CreateDirectory ( App . InstallerTempDirectory . FullName ) ;
263
243
}
264
244
265
245
var json = JsonSerializer . Serialize (
@@ -343,7 +323,7 @@ private void AddComponentProviderWindowsApplication(
343
323
waInstallerService ,
344
324
networkShellService ,
345
325
ComponentProviders ,
346
- installerTempDirectory ,
326
+ App . InstallerTempDirectory ,
347
327
installationDirectory ,
348
328
ProjectName ! ,
349
329
DefaultApplicationSettings ,
@@ -364,7 +344,7 @@ private void AddComponentProviderElasticSearchServer(
364
344
networkShellService ,
365
345
waInstallerService ,
366
346
ComponentProviders ,
367
- installerTempDirectory ,
347
+ App . InstallerTempDirectory ,
368
348
installationDirectory ,
369
349
ProjectName ! ,
370
350
DefaultApplicationSettings ,
@@ -384,7 +364,7 @@ private void AddComponentProviderInternetInformationServer(
384
364
iisInstallerService ,
385
365
networkShellService ,
386
366
ComponentProviders ,
387
- installerTempDirectory ,
367
+ App . InstallerTempDirectory ,
388
368
installationDirectory ,
389
369
ProjectName ! ,
390
370
DefaultApplicationSettings ,
@@ -405,7 +385,7 @@ private void AddComponentProviderPostgreSql(
405
385
networkShellService ,
406
386
waInstallerService ,
407
387
ComponentProviders ,
408
- installerTempDirectory ,
388
+ App . InstallerTempDirectory ,
409
389
installationDirectory ,
410
390
ProjectName ! ,
411
391
DefaultApplicationSettings ,
0 commit comments