using System; using System.IO; using UnityEngine; using UnityEditor; using GameEditor.Util; using System.Collections; public class ClientConfigManager { private static ClientConfigManager _instance; public static ClientConfigManager Instance { get { if (_instance == null) { if (_instance == null) { _instance = new ClientConfigManager(); } } return _instance; } } private string svnPath = "https://desktop-rh64908/svn/ClientConfig"; private string localPath = Application.dataPath + "/../ClientConfig"; // 更新svn public void SVN_Update() { if (!Directory.Exists(localPath)) { Directory.CreateDirectory(localPath); ProcessUtil.ProcessCommand(Application.dataPath, "svn checkout " + svnPath + " "+ localPath); } ProcessUtil.ProcessCommand(localPath, "svn update"); } // 获取所有的version文件列表 public string[] GetVersionList() { SVN_Update(); string versionPath = localPath + "/Version"; string[] list = Directory.GetDirectories(versionPath); Debug.LogError(list.Length); return list; } // 获取热更新用的配置文件 public Hashtable GetHotFixConfig() { SVN_Update(); string hotfixConfig = localPath + "/HotFixWindow.txt"; Hashtable config = null; if (File.Exists(hotfixConfig)) { string s = File.ReadAllText(hotfixConfig); config = MiniJSON.jsonDecode(s) as Hashtable; } return config; } // 获取打包工具配置文件 public Hashtable GetAutoPackConfig() { SVN_Update(); string hotfixConfig = localPath + "/AutoPack.txt"; Hashtable config = null; if (File.Exists(hotfixConfig)) { string s = File.ReadAllText(hotfixConfig); config = MiniJSON.jsonDecode(s) as Hashtable; } return config; } // 获取校验服同步工程配置文件 public Hashtable GetFightServerConfig() { SVN_Update(); string hotfixConfig = localPath + "/FightServer.txt"; Hashtable config = null; if (File.Exists(hotfixConfig)) { string s = File.ReadAllText(hotfixConfig); config = MiniJSON.jsonDecode(s) as Hashtable; } return config; } // 获取svn工程根目录路径 public string GetClientConfigPath() { return localPath; } }