Exemplo n.º 1
0
 public void ThrowIfNotCompatibleWith(CompatibilitySet set, string site, ClientVersion version)
 {
     if (IsCompatibleWith(set, site, version))
     {
         return;
     }
     throw new InvalidOperationException($"Version mismatch. Set {set} \"{site}\" with version {version} is incompatible.");
 }
Exemplo n.º 2
0
        private ClientVersion RequiredVersionBySet(CompatibilitySet set)
        {
            switch (set)
            {
            case CompatibilitySet.Network:
                return(requiredNetworkVersion);

            case CompatibilitySet.Package:
                return(requiredPackageVersion);

            default:
                throw new InvalidOperationException("Unknown enum value: " + set.ToString());
            }
        }
Exemplo n.º 3
0
        public bool IsCompatibleWith(CompatibilitySet set, string site, ClientVersion version)
        {
            ClientVersion reqVer = RequiredVersionBySet(set);

            if (reqVer.IsCompatibleWith(version))
            {
                return(true);
            }

            if (logger.IsEnabled(notificationsLevel))
            {
                lock (notificationsLock)
                {
                    if (notifiedSites.Add(site))
                    {
                        var log = new FormattedLogValues("Incompatibility with {0} \"{1}\". Site version: {2}, required version: {3}", set, site, version, reqVer);
                        logger.Log(notificationsLevel, 0, log, null, (t, e) => t.ToString());
                    }
                }
            }
            return(false);
        }