コード例 #1
0
        /// <summary>
        /// 应用程序版本
        /// </summary>
        /// <returns></returns>
        public static Version AppVersion()
        {
            try
            {
                var version = ConfigReader.Read(VERSION_TAG);
                if (string.IsNullOrEmpty(version))
                {
                    return(new Version());
                }
                var regex = new System.Text.RegularExpressions.Regex(@"^(\d+\.)*\d+$");
                if (!regex.IsMatch(version.Trim()))
                {
                    return(new Version());
                }
                return(new Version(version.Trim()));
            }
            catch (Exception e)
            {
                LogTracer.WriteInfo("AppVersionReader", e.ToString());
            }

            return(new Version());
        }