<commit_before>﻿using System;
using Sitecore.Configuration;

namespace Cognifide.PowerShell.Core.VersionDecoupling
{
    public class VersionResolver
    {
        public static Version SitecoreVersionCurrent = GetVersionNumber(About.Version);
        public static Version SitecoreVersion72 = new Version(7, 2);
        public static Version SitecoreVersion75 = new Version(7, 5);
        public static Version SitecoreVersion80 = new Version(8, 0);

        public static bool IsVersionHigherOrEqual(Version version)
        {
            return version <= SitecoreVersionCurrent;
        }

        public static Version GetVersionNumber(string version)
        {
            Version result;
            if (Version.TryParse(version, out result))
            {
                return result;
            }

            return Version.TryParse(About.GetVersionNumber(false), out result) ? result : new Version(0, 0);
        }
    }
}<commit_msg>Issue #369 - started this implementation before I saw your fix Mikey - adding my additional resolution based on assembly version since I already had it in my solution.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Web;
using Sitecore.Configuration;

namespace Cognifide.PowerShell.Core.VersionDecoupling
{
    public class VersionResolver
    {
        public static Version SitecoreVersionCurrent = GetVersionNumber();
        public static Version SitecoreVersion72 = new Version(7, 2);
        public static Version SitecoreVersion75 = new Version(7, 5);
        public static Version SitecoreVersion80 = new Version(8, 0);

        public static Version GetVersionNumber()
        {
            Version version;
            if (Version.TryParse(About.Version, out version))
            {
                return version;
            }
            if (Version.TryParse(About.GetVersionNumber(false), out version))
            {
                return version;
            }
            var kernel = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.GetName()
                    .Name.Equals("Sitecore.Kernel", StringComparison.OrdinalIgnoreCase));

            if (kernel != null)
            {
                FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(kernel.Location);
                if (!Version.TryParse(fvi.FileVersion, out version))
                {
                    version = new Version(7, 0);
                }
            }
            else
            {
                version = new Version(7, 0);
            }
            return version;
        }

        public static bool IsVersionHigherOrEqual(Version version)
        {
            return version <= SitecoreVersionCurrent;
        }
    }
}
{'fraction_non_alphanumeric': 0.07452966714905933, 'fraction_numerical': 0.011939218523878437, 'mean_word_length': 2.0963045912653975, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6035153', 'n_tokens_mistral': 689, 'n_tokens_neox': 653, 'n_words': 186}