import { Config } from './Config' ; import { Options as OptionsNS } from './AMCPConnectionOptions' ; import CasparCGVersion = OptionsNS . CasparCGVersion ; import { AMCPUtil as AMCPUtilNS } from './AMCP' ; import CasparCGSocketResponse = AMCPUtilNS . CasparCGSocketResponse ; import { Response as validationNS } from './ResponseValidators' ; import XMLValidator = validationNS . XMLValidator ; import { Response as responseNS } from './ResponseParsers' ; import ConfigParser = responseNS . ConfigParser ; /***/ export namespace ConfigUtil { /***/ export function parseConfigFrom207XML ( XMLString ) { let validator = new XMLValidator ( ) ; let parser = new ConfigParser ( ) ; parser . context = { serverVersion : CasparCGVersion . V207 } ; let fauxResponseData = new CasparCGSocketResponse ( XMLString ) ; let validData = validator . resolve ( fauxResponseData ) ; if ( validData === false ) { return { } ; } validData = parser . parse ( validData ) ; if ( validData === false ) { return { } ; } return validData ; } /***/ export function parseConfigFrom210XML ( XMLString ) { let validator = new XMLValidator ( ) ; let parser = new ConfigParser ( ) ; parser . context = { serverVersion : CasparCGVersion . V210 } ; let fauxResponseData = new CasparCGSocketResponse ( XMLString ) ; let validData = { } ; validData = validator . resolve ( fauxResponseData ) ; if ( validData === false ) { return { } ; } validData = parser . parse ( validData ) ; if ( validData === false ) { return { } ; } return validData ; } }