当前位置: 首页>>代码示例>>C#>>正文


C# Session.Property方法代码示例

本文整理汇总了C#中Microsoft.Deployment.WindowsInstaller.Session.Property方法的典型用法代码示例。如果您正苦于以下问题:C# Session.Property方法的具体用法?C# Session.Property怎么用?C# Session.Property使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Deployment.WindowsInstaller.Session的用法示例。


在下文中一共展示了Session.Property方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadDialogs

        void ReadDialogs(Session session)
        {
            InstallDialogs.Clear()
                          .AddRange(ManagedProject.ReadDialogs(session.Property("WixSharp_InstallDialogs")));

            ModifyDialogs.Clear()
                          .AddRange(ManagedProject.ReadDialogs(session.Property("WixSharp_ModifyDialogs")));

        }
开发者ID:denis-peshkov,项目名称:WixSharp,代码行数:9,代码来源:ManagedUI.cs

示例2: CreateSonarPropertyValueMapForSqlServer

        private static Dictionary<string, string> CreateSonarPropertyValueMapForSqlServer(Session session)
        {
            Dictionary<string, string> resultMap = new Dictionary<string, string>();

            string authenticationType = session.Property("SQLAUTHTYPE");
            string dbEngine = session.Property("DBENGINE");

            // Only for MSSQL with Windows Authentication, we needn't set the user name and password.
            // For any other RDBMS and MSSQL with SQL authentication, we set both these properties.
            if (!(DbEngine.MsSql.Equals(dbEngine, StringComparison.InvariantCultureIgnoreCase)
                && AuthenticationType.Windows.Equals(authenticationType, StringComparison.InvariantCultureIgnoreCase)))
            {
                resultMap.Add("username", session.Property("DATABASEUSERNAME"));
                resultMap.Add("password", session.Property("DATABASEPASSWORD"));
            }

            if (DbEngine.MsSql.Equals(dbEngine, StringComparison.InvariantCultureIgnoreCase))
            {
                resultMap.Add("mssqlserver", MsSqlDatabaseStringBuilder(session));
            }
            else if (DbEngine.MySql.Equals(dbEngine, StringComparison.InvariantCultureIgnoreCase))
            {
                resultMap.Add("mysqlserver", MySqlDatabaseStringBuilder(session));
            }
            else if (DbEngine.Oracle.Equals(dbEngine, StringComparison.InvariantCultureIgnoreCase))
            {
                resultMap.Add("oracleserver", OracleDatabaseStringBuilder(session));
            }
            else if (DbEngine.PostGre.Equals(dbEngine, StringComparison.InvariantCultureIgnoreCase))
            {
                resultMap.Add("postgreserver", PostGreDatabaseStringBuilder(session));
            }

            resultMap.Add("webport", session.Property("PORT"));

            return resultMap;
        }
开发者ID:SonarQubeCommunity,项目名称:sonarqube-windows-installer,代码行数:37,代码来源:SonarConfigurationFileEditor.cs

示例3: UpdateSonarPropertiesFileForSql

        public static void UpdateSonarPropertiesFileForSql(Session session)
        {
            try
            {
                Dictionary<string, string> propertyValueMap = CreateSonarPropertyValueMapForSqlServer(session);

                string path = Path.Combine(session.Property("INSTALLDIR"), BootstrapperConstants.SonarQubeProductName, @"conf\sonar.properties");

                using (StreamWriter sw = System.IO.File.AppendText(path))
                {
                    sw.Write(sw.NewLine);

                    foreach (var property in propertyValueMap)
                    {
                        sw.WriteLine(string.Format(SonarPropertiesMap[property.Key], property.Value));
                    }
                }
            }
            catch (Exception e)
            {
                session.Log("[UpdateSonarPropertiesFileForSql] {0}", e.Message);
            }
        }
开发者ID:SonarQubeCommunity,项目名称:sonarqube-windows-installer,代码行数:23,代码来源:SonarConfigurationFileEditor.cs

示例4: PostGreDatabaseStringBuilder

        private static string PostGreDatabaseStringBuilder(Session session)
        {
            // Used format: sonar.jdbc.url=jdbc:postgresql://localhost:5432/sonar
            string databaseServer = session.Property("INSTANCE");
            string databaseName = session.Property("DATABASENAME");
            string dbPort = session.Property("DBPORT");

            return string.Format(@"{0}:{1}/{2}", databaseServer, dbPort, databaseName);
        }
开发者ID:SonarQubeCommunity,项目名称:sonarqube-windows-installer,代码行数:9,代码来源:SonarConfigurationFileEditor.cs

示例5: OracleDatabaseStringBuilder

        private static string OracleDatabaseStringBuilder(Session session)
        {
            // Used format: sonar.jdbc.url=jdbc:oracle:thin:@localhost:1521/XE
            string databaseServer = session.Property("INSTANCE");
            string databaseName = session.Property("DATABASENAME");
            string dbPort = session.Property("DBPORT");

            return string.Format(@"{0}:{1}/{2}", databaseServer, dbPort, databaseName);
        }
开发者ID:SonarQubeCommunity,项目名称:sonarqube-windows-installer,代码行数:9,代码来源:SonarConfigurationFileEditor.cs

示例6: MySqlDatabaseStringBuilder

        private static string MySqlDatabaseStringBuilder(Session session)
        {
            // Used format: sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
            string databaseServer = session.Property("INSTANCE");
            string databaseName = session.Property("DATABASENAME");
            string dbPort = session.Property("DBPORT");

            return string.Format(@"{0}:{1}/{2}?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance",
                                 databaseServer,
                                 dbPort,
                                 databaseName);
        }
开发者ID:SonarQubeCommunity,项目名称:sonarqube-windows-installer,代码行数:12,代码来源:SonarConfigurationFileEditor.cs

示例7: MsSqlDatabaseStringBuilder

        private static string MsSqlDatabaseStringBuilder(Session session)
        {
            StringBuilder result = new StringBuilder();

            string instancePropertyValue = session.Property("INSTANCE");
            string serverName = string.Empty;
            string instanceName = string.Empty;
            string databaseName = session.Property("DATABASENAME");
            string authType = session.Property("SQLAUTHTYPE");

            // For named instance
            if (instancePropertyValue.Contains(@"\"))
            {
                serverName = instancePropertyValue.Substring(0, instancePropertyValue.IndexOf('\\'));
                instanceName = instancePropertyValue.Substring(instancePropertyValue.IndexOf('\\') + 1);

                if (serverName.Contains(@","))
                {
                    //Format: MachineName,Port\InstanceName
                    string serverPort = serverName.Substring(instancePropertyValue.IndexOf(',') + 1);
                    serverName = serverName.Substring(0, instancePropertyValue.IndexOf(','));
                    result.Append(string.Format("{0}:{1};Instance={2}", serverName, serverPort, instanceName));
                }
                else
                {
                    //Format: MachineName\InstanceName
                    result.Append(string.Format("{0};Instance={1}", serverName, instanceName));
                }
            }
            else
            {
                serverName = instancePropertyValue;

                if (serverName.Contains(@","))
                {
                    //Format: MachineName,Port
                    string serverPort = serverName.Substring(instancePropertyValue.IndexOf(',') + 1);
                    serverName = serverName.Substring(0, instancePropertyValue.IndexOf(','));
                    result.Append(string.Format("{0}:{1}", serverName, serverPort));
                }
                else
                {
                    //Format: MachineName
                    result.Append(serverName);
                }
            }

            result.Append(string.Format(";databaseName={0}", databaseName));

            if (AuthenticationType.Windows.Equals(authType, StringComparison.InvariantCultureIgnoreCase))
            {
                result.Append(";IntegratedSecurity=True");
            }

            return result.ToString();
        }
开发者ID:SonarQubeCommunity,项目名称:sonarqube-windows-installer,代码行数:56,代码来源:SonarConfigurationFileEditor.cs


注:本文中的Microsoft.Deployment.WindowsInstaller.Session.Property方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。