import { Injectable } from '@angular/core' ; import { Events } from '../services/events.service' ; import { CardsMonitorService } from './collection/cards-monitor.service' ; import { DeckParserService } from './decktracker/deck-parser.service' ; import { DungeonLootParserService } from './decktracker/dungeon-loot-parser.service' ; import { GameEvents } from './game-events.service' ; import { LogListenerService } from './log-listener.service' ; import { OverwolfService } from './overwolf.service' ; @ Injectable ( ) export class LogRegisterService { monitoring : boolean ; fileInitiallyPresent : boolean ; logsLocation : string ; retriesLeft = 20 ; constructor ( private events , private decksService , private cardsMonitor , private ow , private gameEvents , private dungeonLootParser ) { this . events . on ( Events . STORE_READY ) . subscribe ( ( ) => this . init ( ) ) ; } private init ( ) { console . log ( '[log-register] initiating log registerservice' ) ; new LogListenerService ( this . ow ) . configure ( 'Net.log' , ( data ) => this . cardsMonitor . receiveLogLine ( data ) , ( existingLine ) => this . cardsMonitor . receiveLogLine ( existingLine ) ) . subscribe ( ( status ) => { console . log ( '[log-register] status for Net.log' , status ) ; this . events . broadcast ( status , 'Net.log' ) ; } ) . start ( ) ; new LogListenerService ( this . ow ) . configure ( 'Power.log' , ( data ) => this . gameEvents . receiveLogLine ( data ) , ( existingLine ) => this . gameEvents . receiveExistingLogLine ( existingLine ) ) . subscribe ( ( status ) => { console . log ( '[log-register] status for Power.log' , status ) ; } ) . start ( ) ; new LogListenerService ( this . ow ) . configure ( 'FullScreenFX.log' , ( data ) => { this . dungeonLootParser . handleBlur ( data ) ; } ) . subscribe ( ( status ) => { console . log ( '[log-register] status for FullScreenFX.log' , status ) ; } ) . start ( ) ; } }