Beispiel #1
0
        public void Init(string filePath)
        {
            if (string.IsNullOrEmpty(filePath))
            {
                throw new ArgumentNullException("filePath");
            }
            try
            {
                XmlDocument doc   = XmlFileParserService.LoadXml(filePath);
                XmlNodeList nodes = XmlFileParserService.Analyze(doc, "AlbianCache");
                if (1 != nodes.Count) //root node
                {
                    throw new Exception("Analyze the Objects node is error in the cached.config");
                }

                _service = ParserCached(nodes[0]);
            }
            catch (Exception exc)
            {
                throw exc;
            }
        }
Beispiel #2
0
        public void Init(string path)
        {
            XmlDocument doc = XmlFileParserService.LoadXml(path);

            if (null == doc)
            {
                if (null != Logger)
                {
                    Logger.Error("Init the Service.config is fail.");
                }
                throw new ServiceException("Init the Service.config is fail.");
            }
            XmlNodeList nodes = doc.SelectNodes("Services/Service");

            if (null == nodes || 0 == nodes.Count)
            {
                if (null != Logger)
                {
                    Logger.Error("There is not 'service' items in the service.config");
                }
                throw new ServiceException("There is not 'service' items in the service.config");
            }
            _services = ServicesParser(nodes);
        }