Ejemplo n.º 1
0
        public Status GetStatus()
        {
            // Version情報がない場合はデータ取得に失敗しているので、Unavailable
            if (string.IsNullOrEmpty(CurrentVersion) || string.IsNullOrEmpty(LatestVersion))
            {
                return(Status.Unavailable);
            }

            System.Version current = new System.Version(CurrentVersion);
            System.Version latest  = new System.Version(LatestVersion);

            // 現在のバージョンとLatestVersionを比較して同一もしくはLatestVersionが古ければ(通常はないが)UpToDate
            // 引数として渡されたバージョンよりも自身の方が新しければ1、同じであれば0、自身の方が古ければ-1
            if (current.CompareTo(latest) != -1)
            {
                return(Status.UpToDate);
            }

            // 有効なUrlでなかったらUnavailableをかえす。
            if (!Utility.IsUrl(DownloadUrl))
            {
                return(Status.Unavailable);
            }

            return(Status.UpdateAvailable);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Compares two version strings
        /// </summary>
        /// <returns>True if the other version is greater than the source version, otherwise false.</returns>
        public static bool IsNewerVersion(string sourceVersionString, string otherVersionString)
        {
            var sourceVersion = new System.Version(sourceVersionString);
            var otherVersion  = new System.Version(otherVersionString);

            return(otherVersion.CompareTo(sourceVersion) > 0);
        }
Ejemplo n.º 3
0
        public int CompareTo(Version other)
        {
            var v1 = new System.Version(build);
            var v2 = new System.Version(other.build);

            return(v1.CompareTo(v2));
        }
Ejemplo n.º 4
0
        public static string GetCoreDependency(string assemblyPath)
        {
            var res = new System.Version(0, 0, 0, 0);

            foreach (var f in System.IO.Directory.GetFiles(assemblyPath, "*.dll"))
            {
                var refs = GetReferences(f);
                if (refs.ContainsKey("DotNetNuke"))
                {
                    if (res.CompareTo(refs["DotNetNuke"]) < 0)
                    {
                        res = refs["DotNetNuke"];
                    }
                }
            }
            return(res.ToNormalizedVersion());
        }