예제 #1
0
        ///<inheritdoc cref="IVersionCheck"/>
        ///<exception cref="GameFrameworkException">Check 函数还未执行过或还未执行完成 </exception>
        /// <returns></returns>
        public IEnumerable <AssetBundleInfo> GetGroupVersion(string tag)
        {
            if (!_isInitCheck)
            {
                throw new GameFrameworkException("没有执行Check 函数或还未执行完成~");
            }

            var serverABs = ServerVersionInfo.GetGroupAssetBundleInfos(tag);
            var localABs  = LocalVersionInfo.GetGroupAssetBundleInfos(tag);

            return(_chckAssetBundleList(serverABs, localABs));
        }
예제 #2
0
        public bool IsUpdateGroup(string tag)
        {
            if (!_isInitCheck)
            {
                throw new GameFrameworkException("没有执行Check 函数或还未执行完成~");
            }

            var serverABs = ServerVersionInfo.GetGroupAssetBundleInfos(tag);
            var localABs  = LocalVersionInfo.GetGroupAssetBundleInfos(tag);

            return(_existUpdateAssetBundle(serverABs, localABs));
        }
예제 #3
0
        internal ServerVersionInfo GetSetVersion(string connectionString, string providerName, ILogger logger)
        {
            var factory    = DbProviderFactories.GetFactory(providerName);
            var connection = factory.CreateConnection();

            if (connection == null)
            {
                throw new InvalidOperationException($"Could not create a connection for provider \"{providerName}\".");
            }

            // Edition: "Express Edition", "Windows Azure SQL Database..."
            // EngineEdition: 1/Desktop 2/Standard 3/Enterprise 4/Express 5/Azure
            // ProductLevel: RTM, SPx, CTP...

            const string sql = @"select
    SERVERPROPERTY('Edition') Edition,
    SERVERPROPERTY('EditionID') EditionId,
    SERVERPROPERTY('InstanceName') InstanceName,
    SERVERPROPERTY('ProductVersion') ProductVersion,
    SERVERPROPERTY('BuildClrVersion') BuildClrVersion,
    SERVERPROPERTY('EngineEdition') EngineEdition,
    SERVERPROPERTY('IsClustered') IsClustered,
    SERVERPROPERTY('MachineName') MachineName,
    SERVERPROPERTY('ResourceLastUpdateDateTime') ResourceLastUpdateDateTime,
    SERVERPROPERTY('ProductLevel') ProductLevel;";

            connection.ConnectionString = connectionString;
            ServerVersionInfo version;

            using (connection)
            {
                try
                {
                    connection.Open();
                    var command = connection.CreateCommand();
                    command.CommandText = sql;
                    using (var reader = command.ExecuteReader())
                    {
                        reader.Read();
                        version = new ServerVersionInfo(reader.GetString(0), reader.GetString(2), reader.GetString(3), (EngineEdition)reader.GetInt32(5), reader.GetString(7), reader.GetString(9));
                    }
                    connection.Close();
                }
                catch (Exception e)
                {
                    logger.Error <UmbracoDatabaseFactory>(e, "Failed to detected SqlServer version.");
                    version = new ServerVersionInfo(); // all unknown
                }
            }

            return(ServerVersion = version);
        }
예제 #4
0
        private static string GetEwsVersionNumber(MailboxAssociationEwsBinding ewsBinding)
        {
            ServerVersionInfo serverVersionInfoValue = ewsBinding.ServerVersionInfoValue;

            return(new Version(serverVersionInfoValue.MajorVersion, serverVersionInfoValue.MinorVersion, serverVersionInfoValue.MajorBuildNumber, serverVersionInfoValue.MinorBuildNumber).ToString());
        }
        internal ServerVersionInfo GetSetVersion(string connectionString, string providerName, ILogger logger)
        {
            //var factory = DbProviderFactories.GetFactory(providerName);
            var factory    = SqlClientFactory.Instance;
            var connection = factory.CreateConnection();

            if (connection == null)
            {
                throw new InvalidOperationException($"Could not create a connection for provider \"{providerName}\".");
            }

            // Edition: "Express Edition", "Windows Azure SQL Database..."
            // EngineEdition: 1/Desktop 2/Standard 3/Enterprise 4/Express 5/Azure
            // ProductLevel: RTM, SPx, CTP...

            const string sql = @"select
    SERVERPROPERTY('Edition') Edition,
    SERVERPROPERTY('EditionID') EditionId,
    SERVERPROPERTY('InstanceName') InstanceName,
    SERVERPROPERTY('ProductVersion') ProductVersion,
    SERVERPROPERTY('BuildClrVersion') BuildClrVersion,
    SERVERPROPERTY('EngineEdition') EngineEdition,
    SERVERPROPERTY('IsClustered') IsClustered,
    SERVERPROPERTY('MachineName') MachineName,
    SERVERPROPERTY('ResourceLastUpdateDateTime') ResourceLastUpdateDateTime,
    SERVERPROPERTY('ProductLevel') ProductLevel;";

            string GetString(IDataReader reader, int ordinal, string defaultValue)
            => reader.IsDBNull(ordinal) ? defaultValue : reader.GetString(ordinal);

            int GetInt32(IDataReader reader, int ordinal, int defaultValue)
            => reader.IsDBNull(ordinal) ? defaultValue : reader.GetInt32(ordinal);

            connection.ConnectionString = connectionString;
            ServerVersionInfo version;

            using (connection)
            {
                try
                {
                    connection.Open();
                    var command = connection.CreateCommand();
                    command.CommandText = sql;
                    using (var reader = command.ExecuteReader())
                    {
                        reader.Read();
                        // InstanceName can be NULL for the default instance
                        version = new ServerVersionInfo(
                            GetString(reader, 0, "Unknown"),
                            GetString(reader, 2, "(default)"),
                            GetString(reader, 3, string.Empty),
                            (EngineEdition)GetInt32(reader, 5, 0),
                            GetString(reader, 7, "DEFAULT"),
                            GetString(reader, 9, "Unknown"));
                    }
                    connection.Close();
                }
                catch (Exception e)
                {
                    logger.LogError(e, "Failed to detected SqlServer version.");
                    version = new ServerVersionInfo(); // all unknown
                }
            }

            return(ServerVersion = version);
        }