Exemplo n.º 1
0
        /// <summary>
        /// 更新菜单版本号,该方法适用于全局更新
        /// </summary>
        public static string UpdateVersion()
        {
            string version    = GetVersion();
            string newVersion = (long.Parse(version) + 1).ToString();
            string fileName   = Path.Combine(MenuHelper.GetRootFolder(), "version");

            _lock.Write(() =>
            {
                WriteText(fileName, newVersion);
            });
            return(newVersion);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取菜单版本号
        /// </summary>
        /// <returns></returns>
        public static string GetVersion()
        {
            string fileName = Path.Combine(MenuHelper.GetRootFolder(), "version");

            if (!File.Exists(fileName))
            {
                return("0");
            }
            string version = string.Empty;

            _lock.Read(() =>
            {
                version = File.ReadAllText(fileName);
            });
            return(version);
        }