"""
Global parameters:
  CSharp Type     Name
  ===========     ====
  string          ParameterDocumentPath
  string          ParameterDuplicateDocumentPath
  bool            ParameterReapplyListTemplates
  IDictionary     ParameterVariables
  IDictionary     ParameterConditions
  IList           ParameterXRefFormats
  string          ParameterType
"""

from System.IO import Path, File, StreamReader


# locals
import sys
sys.path.insert(0, Path.GetDirectoryName(globals()['__file__']))
from router import Router
import utils

import clr
clr.AddReference('System.Xml')
from System.Xml import XmlReader
from System.Xml.XPath import XPathDocument

env = {
    'docPath': globals()['ParameterDocumentPath'],
    'dupDocPath': globals()['ParameterDuplicateDocumentPath'],
    'reapplyListTemplates': globals()['ParameterReapplyListTemplates'],
    'variables': globals()['ParameterVariables'],
    'conditions': globals()['ParameterConditions'],
    'xrefFormats': globals()['ParameterXRefFormats'],
    'type': globals()['ParameterType']
}

env['source'] = globals()['ParameterDocumentPath']
env['method'] = 'duplicate'

Router(utils.DictAsObject(env))
