Beispiel #1
0
        /// <summary>
        /// Returns 1 if the current dll is newer than other, returns -1 of 'other' is newer, and 0 if the file version numbers are identical.
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        private int Compare(Dll other)
        {
            FileVersionInfo t = this.Version;
            FileVersionInfo o = other.Version;

            if (t.FileMajorPart > o.FileMajorPart)
            {
                return(1);
            }
            else if (t.FileMajorPart < o.FileMajorPart)
            {
                return(-1);
            }
            if (t.FileMinorPart > o.FileMinorPart)
            {
                return(1);
            }
            else if (t.FileMinorPart < o.FileMinorPart)
            {
                return(-1);
            }
            if (t.FileBuildPart > o.FileBuildPart)
            {
                return(1);
            }
            else if (t.FileBuildPart < o.FileBuildPart)
            {
                return(-1);
            }
            if (t.FilePrivatePart > o.FilePrivatePart)
            {
                return(1);
            }
            else if (t.FilePrivatePart < o.FilePrivatePart)
            {
                return(-1);
            }
            return(0);
        }
Beispiel #2
0
 /// <summary>
 /// Returns 1 if the current dll is newer than other, returns -1 of 'other' is newer, and 0 if the file version numbers are identical.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 private int Compare(Dll other)
 {
     FileVersionInfo t = this.Version;
     FileVersionInfo o = other.Version;
     if (t.FileMajorPart > o.FileMajorPart) return 1;
     else if (t.FileMajorPart < o.FileMajorPart) return -1;
     if (t.FileMinorPart > o.FileMinorPart) return 1;
     else if (t.FileMinorPart < o.FileMinorPart) return -1;
     if (t.FileBuildPart > o.FileBuildPart) return 1;
     else if (t.FileBuildPart < o.FileBuildPart) return -1;
     if (t.FilePrivatePart > o.FilePrivatePart) return 1;
     else if (t.FilePrivatePart < o.FilePrivatePart) return -1;
     return 0;
 }
Beispiel #3
0
 public bool IsSameVersion(Dll other)
 {
     return Compare(other) == 0;
 }
Beispiel #4
0
 /// <summary>
 /// Returns true if the assemblies share the same file version and product version numbers.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool IsSameBuild(Dll other)
 {
     return this.InformationalVersion == other.InformationalVersion && this.Version.FileVersion == other.Version.FileVersion;
 }
Beispiel #5
0
 public bool IsNewer(Dll other)
 {
     return Compare(other) == 1;
 }
Beispiel #6
0
 /// <summary>
 /// Returns true if the assemblies share the same file version and product version numbers.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool IsSameBuild(Dll other)
 {
     return(this.InformationalVersion == other.InformationalVersion && this.Version.FileVersion == other.Version.FileVersion);
 }
Beispiel #7
0
 public bool IsSameVersion(Dll other)
 {
     return(Compare(other) == 0);
 }
Beispiel #8
0
 public bool IsNewer(Dll other)
 {
     return(Compare(other) == 1);
 }