File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44var api = new EliteDangerousApi ( ) ;
55api . OnJournalEvent ( e =>
66{
7- var eventName = JsonUtils . GetEventName ( e ) ;
8- var paths = JsonUtils . FlattenJson ( e ) . Select ( p => p . WithPath ( $ "EliteAPI. { eventName } . { p . Path } " ) ) . ToList ( ) ;
7+ var paths = JsonUtils . FlattenJson ( e . json ) . Select ( p => p . WithPath ( $ "EliteAPI. { e . eventName } . { p . Path } " ) ) . ToList ( ) ;
8+
99 foreach ( var path in paths )
10- {
1110 Console . WriteLine ( $ "{ path . Path } : { path . Value } ({ path . Type } )") ;
12- }
11+
12+ Console . WriteLine ( $ "((EliteAPI.{ e . eventName } ))") ;
1313} ) ;
1414
1515Thread . Sleep ( - 1 ) ;
Original file line number Diff line number Diff line change @@ -15,5 +15,12 @@ public EliteDangerousApi()
1515 _journalWatcher = LineByLineFileWatcher . Create ( journalDirectory , "Journal.*.log" ) . watcher ;
1616 }
1717
18- public void OnJournalEvent ( Action < string > onEvent ) => _journalWatcher . OnChange ( onEvent ) ;
18+ public void OnJournalEvent ( Action < ( string eventName , string json ) > onEvent )
19+ {
20+ _journalWatcher . OnChange ( json =>
21+ {
22+ var eventName = JsonUtils . GetEventName ( json ) ;
23+ onEvent ( ( eventName , json ) ) ;
24+ } ) ;
25+ }
1926}
You can’t perform that action at this time.
0 commit comments