_Core/Utilities/Upgrade.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace ComLib
{
    /// <summary>
    /// This class provides methods that can be used
    /// to check for and begin an upgrade process.
    /// </summary>
    public class Upgrade
    {
        private Version _currentVersion;
        private bool _catchErrors;
        private IErrors _errors = new Errors();


        /// <summary>
        /// Initialize w/ the current version.
        /// </summary>
        /// <param name="currentVersion">Current version.</param>
        /// <param name="catchErrors">Whether or not to catch errors and store them into the error collection.</param>
        public Upgrade(string currentVersion, bool catchErrors)
        {
            if (string.IsNullOrEmpty(currentVersion))
                throw new ArgumentNullException("currentVersion");

            _catchErrors = catchErrors;
            _currentVersion = ToVersion(currentVersion);
            CurrentVersion = currentVersion;
        }


        /// <summary>
        /// The current version.
        /// </summary>
        public string CurrentVersion { get; set; }


        /// <summary>
        /// Excutes the upgrade callback if conditions match.
        /// </summary>
        /// <param name="comparison">Comparison operation ("=", "!=", etc).</param>
        /// <param name="version">New version string.</param>
        /// <param name="callback">Callback to execute.</param>
        public void ExecuteIf(string comparison, string version, Action<object> callback)
        {
            ExecuteIf(comparison, version, null, null, null, callback);
        }


        /// <summary>
        /// Excutes the upgrade callback if conditions match.
        /// </summary>
        /// <param name="comparison">Comparison operation ("=", "!=", etc).</param>
        /// <param name="name">A name for the upgrade.</param>
        /// <param name="version">New version string.</param>
        /// <param name="callback">Callback to execute.</param>
后面还有 73 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。