示例#1
0
        // 加载客户端配置文件
        private void LoadConfigXML(ref string fileName, bool needReload)
        {
            string r_Path;

            // if (fileName.Contains("Config.xml"))
            if (AppManager.Inst.IsLocalVersion)
            {
                r_Path = AppManager.Inst.readOnlyPath + "Data/" + fileName;
            }
            else
            {
                if (fileName.Contains("Config.xml"))
                {
                    r_Path = AppManager.Inst.readOnlyPath + "Data/" + fileName;
                }
                else
                {
                    r_Path = m_ClientConfigInfoMap["ResoursePlatformIP"] + "data/" + m_ClientConfigInfoMap["Version"] + "/ServerInfo/" + fileName;
                }
            }

            string rw_Path = AppManager.Inst.readAndWritePath + "Data/" + fileName;

            if (needReload)
            {
                XMLHelper.RemoveFile_RW(rw_Path);
            }
            // 1:检查可读写目录下是否有配置文件
            bool isHaveXMLFile = XMLHelper.CheckFileAndDirExists_RW(rw_Path);

            if (!isHaveXMLFile)
            {
                // 2: 如果没有则从Streaming目录下复制一个过去
                XMLHelper.LoadXML(r_Path, ref m_xmlDoc);
                XMLHelper.CreateXML(rw_Path, m_xmlDoc);
            }

            // 3: 读取xml,并获取配置项
            XMLHelper.LoadXML(rw_Path, ref m_xmlDoc);
        }