internal void Init(string configpath) { string xmlString = System.IO.File.ReadAllText(configpath, System.Text.Encoding.UTF8); XmlReader xmlReader = new XmlReader(); CloudConfig config = xmlReader.Deserialize <CloudConfig>(xmlString); Init(config); }
void Init(CloudConfig config) { this.CurrentApp = config.App; appService = new XService(config.Authcenter); //app授权中心 appService.RefreshHttp(new XHttpClient(config.Authcenter.AppID, config.Authcenter.Origin)); //创建连接 if (config.Dependencies != null) { TokenProvider tokenProvider = new TokenProvider(appService); //Token刷新器 foreach (ServiceInfo serviceInfo in config.Dependencies) { XService xService = new XService(serviceInfo) { TokenProvider = tokenProvider }; DicServices[serviceInfo.AppID] = xService; } } }