/// <summary> /// 获取当前客户端的版本号。 /// </summary> public static int GetCurrentVersion() { //string path = AppDomain.CurrentDomain.BaseDirectory + "UpdateConfiguration.xml"; string path = UpdateConfiguration.ConfigurationPath; #region 没有升级版本的xml配置文件时,生成一个配置文件 if (!File.Exists(path)) { XmlDocument xmlDoc = new XmlDocument(); XmlElement objXml = xmlDoc.CreateElement("object"); objXml.SetAttribute("type", "OAUS.Core.UpdateConfiguration,OAUS.Core"); xmlDoc.AppendChild(objXml); XmlElement property = xmlDoc.CreateElement("property"); property.SetAttribute("name", "ConfigurationPath"); property.SetAttribute("value", path); objXml.AppendChild(property); property = xmlDoc.CreateElement("property"); property.SetAttribute("name", "FileList"); XmlElement list = xmlDoc.CreateElement("list"); list.SetAttribute("element-type", "OAUS.Core.FileUnit,OAUS.Core"); property.AppendChild(list); objXml.AppendChild(property); property = xmlDoc.CreateElement("property"); property.SetAttribute("name", "ClientVersion"); property.SetAttribute("value", "1"); objXml.AppendChild(property); xmlDoc.Save(path); } #endregion UpdateConfiguration config = (UpdateConfiguration)UpdateConfiguration.Load(path); return(config.ClientVersion); }