1515using System . Threading . Tasks ;
1616using System . Windows ;
1717using Utilities ;
18+ using Version = System . Version ;
1819
1920[ assembly: InternalsVisibleTo ( "Tests" ) ]
2021namespace Eddi
@@ -34,6 +35,8 @@ public static void Main ( string[] args = null )
3435 {
3536 // Parse command-line arguments
3637 args ??= Environment . GetCommandLineArgs ( ) . Skip ( 1 ) . ToArray ( ) ;
38+ var fromVoiceAttack = args . Any ( arg =>
39+ arg . Equals ( "--voice-attack-plugin" , StringComparison . OrdinalIgnoreCase ) ) ;
3740 VoiceAttackVersion = ParseVoiceAttackVersion ( args ) ;
3841
3942 Logging . IncrementLogs ( ) ; // Increment to a new log file.
@@ -63,7 +66,7 @@ public static void Main ( string[] args = null )
6366
6467 try
6568 {
66- Initialize ( app , VoiceAttackVersion , configuration ) ;
69+ Initialize ( app , fromVoiceAttack , VoiceAttackVersion , configuration ) ;
6770 }
6871 catch ( Exception e )
6972 {
@@ -103,7 +106,7 @@ private static System.Version ParseVoiceAttackVersion( string[] args )
103106 return null ;
104107 }
105108
106- private static void Initialize ( App app , System . Version vaVersion = null , EDDIConfiguration configuration = null )
109+ private static void Initialize ( App app , bool fromVA = false , Version vaVersion = null , EDDIConfiguration configuration = null )
107110 {
108111 // Prepare to start the application
109112 if ( configuration != null && ! configuration . DisableTelemetry )
@@ -131,12 +134,13 @@ private static void Initialize( App app, System.Version vaVersion = null, EDDICo
131134 }
132135 }
133136
137+ EDDI . Instance . FromVA = fromVA ;
138+
134139 // Wait for preload to complete before MainWindow creation
135140 var preloadTasks = PreloadCriticalServicesAsync ( ) ;
136141 Task . WaitAll ( preloadTasks . ToArray ( ) ) ;
137142
138- EDDI . Instance . FromVA = vaVersion is not null ;
139- if ( EDDI . Instance . FromVA )
143+ if ( fromVA )
140144 {
141145 // Create the MainWindow with visibility controlled by code-behind logic
142146 // (hidden by default in VA mode, shown on demand via VA commands)
@@ -265,10 +269,10 @@ public static void ApplyAnyOverrideCulture(EDDIConfiguration configuration = nul
265269 var overrideCulture = string . IsNullOrEmpty ( configuration . OverrideCulture ) ? null : new CultureInfo ( configuration . OverrideCulture ) ;
266270 ApplyCulture ( overrideCulture ) ;
267271 }
268- catch
272+ catch ( Exception ex )
269273 {
270- ApplyCulture ( null ) ;
271- Debug . WriteLine ( "Culture [{0}] not available" , configuration . OverrideCulture ) ;
274+ Logging . Warn ( $ "Culture [ { configuration . OverrideCulture } ] could not be applied; falling back to system culture." , ex ) ;
275+ ApplyCulture ( null ) ;
272276 }
273277 }
274278
0 commit comments