File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed
SharpCaster.Console/Services Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,15 @@ private async Task CheckAndJoinExistingApplicationAsync()
176
176
177
177
try
178
178
{
179
- var hasReceiverNamespace = _state . Client . ChromecastStatus . Application . Namespaces ? . Any ( ns => ns . Name == "urn:x-cast:com.google.cast.receiver" ) == true ;
179
+ var application = _state . Client . ChromecastStatus . Application ;
180
+ if ( application == null )
181
+ {
182
+ AnsiConsole . MarkupLine ( "[dim]No existing application found. Launching Default Media Receiver...[/]" ) ;
183
+ await _state . Client . LaunchApplicationAsync ( "B3419EF5" , false ) ;
184
+ AnsiConsole . MarkupLine ( "[green]✅ Default Media Receiver launched successfully![/]" ) ;
185
+ return ;
186
+ }
187
+ var hasReceiverNamespace = application ? . Namespaces ? . Any ( ns => ns . Name == "urn:x-cast:com.google.cast.receiver" ) == true ;
180
188
// Refresh receiver status to get the most current application information
181
189
if ( hasReceiverNamespace )
182
190
{
Original file line number Diff line number Diff line change @@ -213,4 +213,7 @@ csharp_style_prefer_not_pattern = true:suggestion
213
213
csharp_style_prefer_extended_property_pattern = true :suggestion
214
214
csharp_style_var_when_type_is_apparent = false :silent
215
215
csharp_style_var_for_built_in_types = false :silent
216
- csharp_style_var_elsewhere = false :silent
216
+ csharp_style_var_elsewhere = false :silent
217
+ csharp_prefer_system_threading_lock = true :warning
218
+ csharp_style_prefer_implicitly_typed_lambda_expression = true :suggestion
219
+ csharp_style_prefer_unbound_generic_type_in_nameof = true :suggestion
Original file line number Diff line number Diff line change 1
- using System . Collections . Generic ;
2
- using System . Collections . ObjectModel ;
1
+ using System . Collections . ObjectModel ;
3
2
using System . Linq ;
4
3
using System . Text . Json . Serialization ;
5
4
@@ -12,7 +11,7 @@ namespace Sharpcaster.Models.ChromecastStatus
12
11
public class ChromecastStatus
13
12
{
14
13
[ JsonPropertyName ( "applications" ) ]
15
- public Collection < ChromecastApplication > Applications { get ; set ; }
14
+ public Collection < ChromecastApplication > ? Applications { get ; set ; }
16
15
17
16
[ JsonPropertyName ( "isActiveInput" ) ]
18
17
public bool IsActiveInput { get ; set ; }
@@ -21,9 +20,9 @@ public class ChromecastStatus
21
20
public bool IsStandBy { get ; set ; }
22
21
23
22
[ JsonPropertyName ( "volume" ) ]
24
- public Volume Volume { get ; set ; }
23
+ public Volume ? Volume { get ; set ; }
25
24
26
25
[ JsonIgnore ]
27
- public ChromecastApplication Application => Applications ? . FirstOrDefault ( ) ;
26
+ public ChromecastApplication ? Application => Applications ? . FirstOrDefault ( ) ;
28
27
}
29
28
}
You can’t perform that action at this time.
0 commit comments