コード例 #1
0
        /// <summary>
        /// load global config file from json file</summary>
        private void LoadConfigFile()
        {
            try
            {
                Program.log.Write("loadConfigFile: path:" + this.optionsFilePath);
                string inputJSON = Os.ReadAllText(this.optionsFilePath);

                if (Os.FileExists(this.optionsFilePath))
                {
                    string xml = Os.GetFileContent(this.optionsFilePath);

                    XmlReaderSettings xws = new XmlReaderSettings
                    {
                        CheckCharacters = false
                    };


                    using (XmlReader xr = XmlReader.Create(new StringReader(xml), xws))
                    {
                        XElement root = XElement.Load(xr);

                        this.LoadParams(root);
                    }
                }
            }
            catch (Exception ex)
            {
                Program.log.Write("loadConfigFile: " + ex.Message);
            }
        }