-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRuntimeController.cs
742 lines (620 loc) · 20.9 KB
/
RuntimeController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
/*
* Copyright (c) 2023 ETH Zürich, Educational Development and Technology (LET)
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
using System.IO;
using System.Linq;
using System.Threading;
using SafeExamBrowser.Communication.Contracts.Data;
using SafeExamBrowser.Communication.Contracts.Events;
using SafeExamBrowser.Communication.Contracts.Hosts;
using SafeExamBrowser.Communication.Contracts.Proxies;
using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.Core.Contracts.OperationModel;
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Runtime.Operations.Events;
using SafeExamBrowser.Server.Contracts.Data;
using SafeExamBrowser.Settings.Security;
using SafeExamBrowser.Settings.Service;
using SafeExamBrowser.UserInterface.Contracts;
using SafeExamBrowser.UserInterface.Contracts.MessageBox;
using SafeExamBrowser.UserInterface.Contracts.Windows;
namespace SafeExamBrowser.Runtime
{
internal class RuntimeController
{
private readonly AppConfig appConfig;
private readonly ILogger logger;
private readonly IMessageBox messageBox;
private readonly IOperationSequence bootstrapSequence;
private readonly IRepeatableOperationSequence sessionSequence;
private readonly IRuntimeHost runtimeHost;
private readonly IRuntimeWindow runtimeWindow;
private readonly IServiceProxy service;
private readonly SessionContext sessionContext;
private readonly ISplashScreen splashScreen;
private readonly Action shutdown;
private readonly IText text;
private readonly IUserInterfaceFactory uiFactory;
private SessionConfiguration Session
{
get { return sessionContext.Current; }
}
private bool SessionIsRunning
{
get { return Session != null; }
}
internal RuntimeController(
AppConfig appConfig,
ILogger logger,
IMessageBox messageBox,
IOperationSequence bootstrapSequence,
IRepeatableOperationSequence sessionSequence,
IRuntimeHost runtimeHost,
IRuntimeWindow runtimeWindow,
IServiceProxy service,
SessionContext sessionContext,
Action shutdown,
ISplashScreen splashScreen,
IText text,
IUserInterfaceFactory uiFactory)
{
this.appConfig = appConfig;
this.bootstrapSequence = bootstrapSequence;
this.logger = logger;
this.messageBox = messageBox;
this.runtimeHost = runtimeHost;
this.runtimeWindow = runtimeWindow;
this.sessionSequence = sessionSequence;
this.service = service;
this.sessionContext = sessionContext;
this.shutdown = shutdown;
this.splashScreen = splashScreen;
this.text = text;
this.uiFactory = uiFactory;
}
internal bool TryStart()
{
logger.Info("Initiating startup procedure...");
bootstrapSequence.ProgressChanged += BootstrapSequence_ProgressChanged;
bootstrapSequence.StatusChanged += BootstrapSequence_StatusChanged;
sessionSequence.ActionRequired += SessionSequence_ActionRequired;
sessionSequence.ProgressChanged += SessionSequence_ProgressChanged;
sessionSequence.StatusChanged += SessionSequence_StatusChanged;
// We need to show the runtime window here already, this way implicitly setting it as the runtime application's main window.
// Otherwise, the splash screen is considered as the main window and thus the operating system and/or WPF does not correctly
// activate the runtime window once bootstrapping has finished, which in turn leads to undesired UI behavior.
runtimeWindow.Show();
runtimeWindow.BringToForeground();
runtimeWindow.SetIndeterminate();
splashScreen.Show();
splashScreen.BringToForeground();
var initialized = bootstrapSequence.TryPerform() == OperationResult.Success;
if (initialized)
{
RegisterEvents();
logger.Info("Application successfully initialized.");
logger.Log(string.Empty);
logger.Subscribe(runtimeWindow);
splashScreen.Hide();
StartSession();
}
else
{
logger.Info("Application startup aborted!");
logger.Log(string.Empty);
messageBox.Show(AppendLogFilePaths(TextKey.MessageBox_StartupError), text.Get(TextKey.MessageBox_StartupErrorTitle), icon: MessageBoxIcon.Error, parent: splashScreen);
}
return initialized && SessionIsRunning;
}
internal void Terminate()
{
DeregisterEvents();
if (SessionIsRunning)
{
StopSession();
}
logger.Unsubscribe(runtimeWindow);
runtimeWindow.Close();
splashScreen.Show();
splashScreen.BringToForeground();
logger.Log(string.Empty);
logger.Info("Initiating shutdown procedure...");
var success = bootstrapSequence.TryRevert() == OperationResult.Success;
if (success)
{
logger.Info("Application successfully finalized.");
logger.Log(string.Empty);
}
else
{
logger.Info("Shutdown procedure failed!");
logger.Log(string.Empty);
messageBox.Show(AppendLogFilePaths(TextKey.MessageBox_ShutdownError), text.Get(TextKey.MessageBox_ShutdownErrorTitle), icon: MessageBoxIcon.Error, parent: splashScreen);
}
splashScreen.Close();
}
private void StartSession()
{
runtimeWindow.Show();
runtimeWindow.BringToForeground();
runtimeWindow.ShowProgressBar = true;
logger.Info(AppendDivider("Session Start Procedure"));
if (SessionIsRunning)
{
DeregisterSessionEvents();
}
var result = SessionIsRunning ? sessionSequence.TryRepeat() : sessionSequence.TryPerform();
if (result == OperationResult.Success)
{
logger.Info(AppendDivider("Session Running"));
HandleSessionStartSuccess();
}
else if (result == OperationResult.Failed)
{
logger.Info(AppendDivider("Session Start Failed"));
HandleSessionStartFailure();
}
else if (result == OperationResult.Aborted)
{
logger.Info(AppendDivider("Session Start Aborted"));
HandleSessionStartAbortion();
}
}
private void HandleSessionStartSuccess()
{
RegisterSessionEvents();
runtimeWindow.ShowProgressBar = false;
runtimeWindow.ShowLog = Session.Settings.Security.AllowApplicationLogAccess;
runtimeWindow.TopMost = Session.Settings.Security.KioskMode != KioskMode.None;
runtimeWindow.UpdateStatus(TextKey.RuntimeWindow_ApplicationRunning);
if (Session.Settings.Security.KioskMode == KioskMode.DisableExplorerShell)
{
runtimeWindow.Hide();
}
}
private void HandleSessionStartFailure()
{
if (SessionIsRunning)
{
StopSession();
messageBox.Show(AppendLogFilePaths(TextKey.MessageBox_SessionStartError), text.Get(TextKey.MessageBox_SessionStartErrorTitle), icon: MessageBoxIcon.Error, parent: runtimeWindow);
logger.Info("Terminating application...");
shutdown.Invoke();
}
else
{
messageBox.Show(AppendLogFilePaths(TextKey.MessageBox_SessionStartError), text.Get(TextKey.MessageBox_SessionStartErrorTitle), icon: MessageBoxIcon.Error, parent: runtimeWindow);
}
}
private void HandleSessionStartAbortion()
{
if (SessionIsRunning)
{
RegisterSessionEvents();
runtimeWindow.ShowProgressBar = false;
runtimeWindow.UpdateStatus(TextKey.RuntimeWindow_ApplicationRunning);
runtimeWindow.TopMost = Session.Settings.Security.KioskMode != KioskMode.None;
if (Session.Settings.Security.KioskMode == KioskMode.DisableExplorerShell)
{
runtimeWindow.Hide();
}
sessionContext.ClientProxy.InformReconfigurationAborted();
}
}
private void StopSession()
{
runtimeWindow.Show();
runtimeWindow.BringToForeground();
runtimeWindow.ShowProgressBar = true;
logger.Info(AppendDivider("Session Stop Procedure"));
DeregisterSessionEvents();
var success = sessionSequence.TryRevert() == OperationResult.Success;
if (success)
{
logger.Info(AppendDivider("Session Terminated"));
}
else
{
logger.Info(AppendDivider("Session Stop Failed"));
}
}
private void RegisterEvents()
{
runtimeHost.ClientConfigurationNeeded += RuntimeHost_ClientConfigurationNeeded;
runtimeHost.ReconfigurationRequested += RuntimeHost_ReconfigurationRequested;
runtimeHost.ShutdownRequested += RuntimeHost_ShutdownRequested;
}
private void DeregisterEvents()
{
runtimeHost.ClientConfigurationNeeded -= RuntimeHost_ClientConfigurationNeeded;
runtimeHost.ReconfigurationRequested -= RuntimeHost_ReconfigurationRequested;
runtimeHost.ShutdownRequested -= RuntimeHost_ShutdownRequested;
}
private void RegisterSessionEvents()
{
service.ConnectionLost += ServiceProxy_ConnectionLost;
sessionContext.ClientProcess.Terminated += ClientProcess_Terminated;
sessionContext.ClientProxy.ConnectionLost += ClientProxy_ConnectionLost;
}
private void DeregisterSessionEvents()
{
service.ConnectionLost -= ServiceProxy_ConnectionLost;
if (sessionContext.ClientProcess != null)
{
sessionContext.ClientProcess.Terminated -= ClientProcess_Terminated;
}
if (sessionContext.ClientProxy != null)
{
sessionContext.ClientProxy.ConnectionLost -= ClientProxy_ConnectionLost;
}
}
private void BootstrapSequence_ProgressChanged(ProgressChangedEventArgs args)
{
MapProgress(splashScreen, args);
}
private void BootstrapSequence_StatusChanged(TextKey status)
{
splashScreen.UpdateStatus(status, true);
}
private void ClientProcess_Terminated(int exitCode)
{
logger.Error($"Client application has unexpectedly terminated with exit code {exitCode}!");
if (SessionIsRunning)
{
StopSession();
}
messageBox.Show(TextKey.MessageBox_ApplicationError, TextKey.MessageBox_ApplicationErrorTitle, icon: MessageBoxIcon.Error, parent: runtimeWindow);
shutdown.Invoke();
}
private void ClientProxy_ConnectionLost()
{
logger.Error("Lost connection to the client application!");
if (SessionIsRunning)
{
StopSession();
}
messageBox.Show(TextKey.MessageBox_ApplicationError, TextKey.MessageBox_ApplicationErrorTitle, icon: MessageBoxIcon.Error, parent: runtimeWindow);
shutdown.Invoke();
}
private void RuntimeHost_ClientConfigurationNeeded(ClientConfigurationEventArgs args)
{
args.ClientConfiguration = new ClientConfiguration
{
AppConfig = sessionContext.Next.AppConfig,
SessionId = sessionContext.Next.SessionId,
Settings = sessionContext.Next.Settings
};
}
private void RuntimeHost_ReconfigurationRequested(ReconfigurationEventArgs args)
{
logger.Info($"Accepted request for reconfiguration with '{args.ConfigurationPath}'.");
sessionContext.ReconfigurationFilePath = args.ConfigurationPath;
sessionContext.ReconfigurationUrl = args.ResourceUrl;
StartSession();
}
private void RuntimeHost_ShutdownRequested()
{
logger.Info("Received shutdown request from the client application.");
shutdown.Invoke();
}
private void ServiceProxy_ConnectionLost()
{
if (SessionIsRunning && Session.Settings.Service.Policy == ServicePolicy.Mandatory)
{
logger.Error("Lost connection to the service component!");
StopSession();
messageBox.Show(TextKey.MessageBox_ApplicationError, TextKey.MessageBox_ApplicationErrorTitle, icon: MessageBoxIcon.Error, parent: runtimeWindow);
shutdown.Invoke();
}
else
{
logger.Warn("Lost connection to the service component!");
}
}
private void SessionSequence_ActionRequired(ActionRequiredEventArgs args)
{
switch (args)
{
case ConfigurationCompletedEventArgs a:
AskIfConfigurationSufficient(a);
break;
case ExamSelectionEventArgs a:
AskForExamSelection(a);
break;
case MessageEventArgs m:
ShowMessageBox(m);
break;
case PasswordRequiredEventArgs p:
AskForPassword(p);
break;
case ServerFailureEventArgs a:
AskForServerFailureAction(a);
break;
}
}
private void AskForExamSelection(ExamSelectionEventArgs args)
{
var isStartup = !SessionIsRunning;
var isRunningOnDefaultDesktop = SessionIsRunning && Session.Settings.Security.KioskMode == KioskMode.DisableExplorerShell;
if (isStartup || isRunningOnDefaultDesktop)
{
TryAskForExamSelectionViaDialog(args);
}
else
{
TryAskForExamSelectionViaClient(args);
}
}
private void AskForServerFailureAction(ServerFailureEventArgs args)
{
var isStartup = !SessionIsRunning;
var isRunningOnDefaultDesktop = SessionIsRunning && Session.Settings.Security.KioskMode == KioskMode.DisableExplorerShell;
if (isStartup || isRunningOnDefaultDesktop)
{
TryAskForServerFailureActionViaDialog(args);
}
else
{
TryAskForServerFailureActionViaClient(args);
}
}
private void AskIfConfigurationSufficient(ConfigurationCompletedEventArgs args)
{
var message = TextKey.MessageBox_ClientConfigurationQuestion;
var title = TextKey.MessageBox_ClientConfigurationQuestionTitle;
var result = messageBox.Show(message, title, MessageBoxAction.YesNo, MessageBoxIcon.Question, runtimeWindow);
args.AbortStartup = result == MessageBoxResult.Yes;
}
private void AskForPassword(PasswordRequiredEventArgs args)
{
var isStartup = !SessionIsRunning;
var isRunningOnDefaultDesktop = SessionIsRunning && Session.Settings.Security.KioskMode == KioskMode.DisableExplorerShell;
if (isStartup || isRunningOnDefaultDesktop)
{
TryGetPasswordViaDialog(args);
}
else
{
TryGetPasswordViaClient(args);
}
}
private void ShowMessageBox(MessageEventArgs args)
{
var isStartup = !SessionIsRunning;
var isRunningOnDefaultDesktop = SessionIsRunning && Session.Settings.Security.KioskMode == KioskMode.DisableExplorerShell;
var message = text.Get(args.Message);
var title = text.Get(args.Title);
foreach (var placeholder in args.MessagePlaceholders)
{
message = message.Replace(placeholder.Key, placeholder.Value);
}
foreach (var placeholder in args.TitlePlaceholders)
{
title = title.Replace(placeholder.Key, placeholder.Value);
}
if (isStartup || isRunningOnDefaultDesktop)
{
args.Result = messageBox.Show(message, title, args.Action, args.Icon, runtimeWindow);
}
else
{
args.Result = ShowMessageBoxViaClient(message, title, args.Action, args.Icon);
}
}
private MessageBoxResult ShowMessageBoxViaClient(string message, string title, MessageBoxAction action, MessageBoxIcon icon)
{
var requestId = Guid.NewGuid();
var result = MessageBoxResult.None;
var response = default(MessageBoxReplyEventArgs);
var responseEvent = new AutoResetEvent(false);
var responseEventHandler = new CommunicationEventHandler<MessageBoxReplyEventArgs>((args) =>
{
if (args.RequestId == requestId)
{
response = args;
responseEvent.Set();
}
});
runtimeHost.MessageBoxReplyReceived += responseEventHandler;
var communication = sessionContext.ClientProxy.ShowMessage(message, title, (int) action, (int) icon, requestId);
if (communication.Success)
{
responseEvent.WaitOne();
result = (MessageBoxResult) response.Result;
}
runtimeHost.MessageBoxReplyReceived -= responseEventHandler;
return result;
}
private void TryAskForExamSelectionViaDialog(ExamSelectionEventArgs args)
{
var dialog = uiFactory.CreateExamSelectionDialog(args.Exams);
var result = dialog.Show(runtimeWindow);
args.SelectedExam = result.SelectedExam;
args.Success = result.Success;
}
private void TryAskForExamSelectionViaClient(ExamSelectionEventArgs args)
{
var exams = args.Exams.Select(e => (e.Id, e.LmsName, e.Name, e.Url));
var requestId = Guid.NewGuid();
var response = default(ExamSelectionReplyEventArgs);
var responseEvent = new AutoResetEvent(false);
var responseEventHandler = new CommunicationEventHandler<ExamSelectionReplyEventArgs>((a) =>
{
if (a.RequestId == requestId)
{
response = a;
responseEvent.Set();
}
});
runtimeHost.ExamSelectionReceived += responseEventHandler;
var communication = sessionContext.ClientProxy.RequestExamSelection(exams, requestId);
if (communication.Success)
{
responseEvent.WaitOne();
args.SelectedExam = args.Exams.First(e => e.Id == response.SelectedExamId);
args.Success = response.Success;
}
else
{
args.SelectedExam = default(Exam);
args.Success = false;
}
runtimeHost.ExamSelectionReceived -= responseEventHandler;
}
private void TryAskForServerFailureActionViaDialog(ServerFailureEventArgs args)
{
var dialog = uiFactory.CreateServerFailureDialog(args.Message, args.ShowFallback);
var result = dialog.Show(runtimeWindow);
args.Abort = result.Abort;
args.Fallback = result.Fallback;
args.Retry = result.Retry;
}
private void TryAskForServerFailureActionViaClient(ServerFailureEventArgs args)
{
var requestId = Guid.NewGuid();
var response = default(ServerFailureActionReplyEventArgs);
var responseEvent = new AutoResetEvent(false);
var responseEventHandler = new CommunicationEventHandler<ServerFailureActionReplyEventArgs>((a) =>
{
if (a.RequestId == requestId)
{
response = a;
responseEvent.Set();
}
});
runtimeHost.ServerFailureActionReceived += responseEventHandler;
var communication = sessionContext.ClientProxy.RequestServerFailureAction(args.Message, args.ShowFallback, requestId);
if (communication.Success)
{
responseEvent.WaitOne();
args.Abort = response.Abort;
args.Fallback = response.Fallback;
args.Retry = response.Retry;
}
else
{
args.Abort = true;
args.Fallback = false;
args.Retry = false;
}
runtimeHost.ServerFailureActionReceived -= responseEventHandler;
}
private void TryGetPasswordViaDialog(PasswordRequiredEventArgs args)
{
var message = default(TextKey);
var title = default(TextKey);
switch (args.Purpose)
{
case PasswordRequestPurpose.LocalAdministrator:
message = TextKey.PasswordDialog_LocalAdminPasswordRequired;
title = TextKey.PasswordDialog_LocalAdminPasswordRequiredTitle;
break;
case PasswordRequestPurpose.LocalSettings:
message = TextKey.PasswordDialog_LocalSettingsPasswordRequired;
title = TextKey.PasswordDialog_LocalSettingsPasswordRequiredTitle;
break;
case PasswordRequestPurpose.Settings:
message = TextKey.PasswordDialog_SettingsPasswordRequired;
title = TextKey.PasswordDialog_SettingsPasswordRequiredTitle;
break;
}
var dialog = uiFactory.CreatePasswordDialog(text.Get(message), text.Get(title));
var result = dialog.Show(runtimeWindow);
args.Password = result.Password;
args.Success = result.Success;
}
private void TryGetPasswordViaClient(PasswordRequiredEventArgs args)
{
var requestId = Guid.NewGuid();
var response = default(PasswordReplyEventArgs);
var responseEvent = new AutoResetEvent(false);
var responseEventHandler = new CommunicationEventHandler<PasswordReplyEventArgs>((a) =>
{
if (a.RequestId == requestId)
{
response = a;
responseEvent.Set();
}
});
runtimeHost.PasswordReceived += responseEventHandler;
var communication = sessionContext.ClientProxy.RequestPassword(args.Purpose, requestId);
if (communication.Success)
{
responseEvent.WaitOne();
args.Password = response.Password;
args.Success = response.Success;
}
else
{
args.Password = default(string);
args.Success = false;
}
runtimeHost.PasswordReceived -= responseEventHandler;
}
private void SessionSequence_ProgressChanged(ProgressChangedEventArgs args)
{
MapProgress(runtimeWindow, args);
}
private void SessionSequence_StatusChanged(TextKey status)
{
runtimeWindow?.UpdateStatus(status, true);
}
private void MapProgress(IProgressIndicator progressIndicator, ProgressChangedEventArgs args)
{
if (args.CurrentValue.HasValue)
{
progressIndicator?.SetValue(args.CurrentValue.Value);
}
if (args.IsIndeterminate == true)
{
progressIndicator?.SetIndeterminate();
}
if (args.MaxValue.HasValue)
{
progressIndicator?.SetMaxValue(args.MaxValue.Value);
}
if (args.Progress == true)
{
progressIndicator?.Progress();
}
if (args.Regress == true)
{
progressIndicator?.Regress();
}
}
private string AppendDivider(string message)
{
var dashesLeft = new String('-', 48 - message.Length / 2 - message.Length % 2);
var dashesRight = new String('-', 48 - message.Length / 2);
return $"### {dashesLeft} {message} {dashesRight} ###";
}
private string AppendLogFilePaths(TextKey key)
{
var message = text.Get(key);
if (File.Exists(appConfig.BrowserLogFilePath))
{
message += $"{Environment.NewLine}{Environment.NewLine}{appConfig.BrowserLogFilePath}";
}
if (File.Exists(appConfig.ClientLogFilePath))
{
message += $"{Environment.NewLine}{Environment.NewLine}{appConfig.ClientLogFilePath}";
}
if (File.Exists(appConfig.RuntimeLogFilePath))
{
message += $"{Environment.NewLine}{Environment.NewLine}{appConfig.RuntimeLogFilePath}";
}
if (File.Exists(appConfig.ServiceLogFilePath))
{
message += $"{Environment.NewLine}{Environment.NewLine}{appConfig.ServiceLogFilePath}";
}
return message;
}
}
}