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


C# Session.GetTargetPath方法代码示例

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


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

示例1: ChangeConfigJs

        public static ActionResult ChangeConfigJs(Session session)
        {
            session.Log("Begin CustomAction ChangeConfigJs");

            var configPath = session.GetTargetPath("INSTALL_ADMIN_FOLDER") + "scripts\\config.js";
            try
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("app.config = {");
                sb.AppendLine("    restEndpoint: '/api',");
                sb.AppendLine("    rootUrl: '/admin/',");
                sb.AppendLine("    pushState: false");
                sb.AppendLine("};");

                File.WriteAllText(configPath, sb.ToString());
            }
            catch (Exception e)
            {
                session.Log("Error: {0}; {1};", e.Message, e.StackTrace);
            }
            return ActionResult.Success;
        }
开发者ID:bestpetrovich,项目名称:devicehive-.net,代码行数:22,代码来源:CustomAction.cs

示例2: GetFeatureScriptDataBase

        /// <summary>
        ///     Returns data from the MSI tables: `FeatureComponents`, `Feature`, `Component`, `File`.
        ///     We filter to just get the files that end in (*.SQL).
        /// </summary>
        /// <param name="session">Windows Installer Session.</param>
        /// <param name="listFeatureNames">List list with names to be installed.</param>
        /// <returns>Returns scripts database files to be installed.</returns>
        private static List<FeatureInstallTO> GetFeatureScriptDataBase(Session session, List<string> listFeatureNames)
        {
            try
            {
                List<FeatureInstallTO> listFeatures;

                string sLevel = session["INSTALLLEVEL"];
                listFeatures = new List<FeatureInstallTO>();
                FeatureInstallTO f;
                int i;
                string sFileName;
                string sQuery = "SELECT `Feature`.`Feature`, `Feature`.`Title`, `Feature`.`Display`, " +
                                " `Component`.`Directory_`, `File`.`FileName` " +
                                " FROM `FeatureComponents`, `Feature`, `Component`, `File` " +
                                " WHERE `FeatureComponents`.`Feature_` = `Feature`.`Feature` " +
                                " AND `FeatureComponents`.`Component_` = `Component`.`Component` " +
                                " AND `File`.`Component_` = `Component`.`Component` " +
                                " AND `Feature`.`RuntimeLevel` > 0 AND `Feature`.`Level` > 0 " +
                                // " AND `Feature`.`Level` <= " + sLevel +
                                " ORDER BY `Feature`.`Display`";
                using (View v = session.Database.OpenView(sQuery))
                {
                    if (v != null)
                    {
                        v.Execute();
                        for (Record r = v.Fetch(); r != null; r = v.Fetch())
                        {
                            if (listFeatureNames.Contains(r.GetString("Feature")) &&
                                r.GetString("FileName").ToUpper().EndsWith(".SQL"))
                            {
                                i = r.GetString("FileName").IndexOf("|", StringComparison.Ordinal);
                                if (i > 0)
                                {
                                    sFileName = r.GetString("FileName").Substring(i + 1);
                                }
                                else
                                {
                                    sFileName = r.GetString("FileName");
                                }

                                f = new FeatureInstallTO
                                {
                                    Feature = r.GetString("Feature"),
                                    Title = r.GetString("Title"),
                                    DisplayOrder = r.GetInteger("Display"),
                                    FileName = sFileName,
                                    DirectoryPath = session.GetTargetPath(r.GetString("Directory_"))
                                };
                                listFeatures.Add(f);
                            }
                            r.Dispose();
                        }
                    }
                }

                return listFeatures;
            }
            catch (Exception ex)
            {
                InstallUtilities.WriteLogInstall(session, "Exception, ReadFeactureScriptDataBase", ex, true);
                throw;
            }
        }
开发者ID:IcodeNet,项目名称:WixDatabaseInstaller,代码行数:70,代码来源:DataBaseCustomAction.cs

示例3: FileConfigurationSetup

        public static ActionResult FileConfigurationSetup(Session session)
        {
            session.Log("Begin FileConfigurationSetup Custom Action");
            try
            {

                //HOSTS FILE
                Dictionary<string, string> dnsList = new Dictionary<string, string>();

                session.Log("Loading user preferences:");

                //RETRIEVE AND LOG ALL THE SETUP USER SETTINGS...
                string companyID = session["XILIXCOMPANYID"];
                session.Log("CompanyID = " + companyID);

                string hostName = session["XILIXHOSTNAME"];
                string ipAddress = session["XILIXIPADDRESS"];
                if (string.IsNullOrEmpty(ipAddress))
                {
                    string serverPrefix = session["XILIXSERVERNAME"];
                    session.Log("Access Security Key = " + serverPrefix);
                    string serverConnectionType = session["XILIXCONNTYPE"];
                    session.Log("Connection Type = " + serverConnectionType);

                    hostName = session[serverPrefix];
                    ipAddress = session[serverPrefix + "." + serverConnectionType];
                }

                session.Log("Server = " + hostName + "(" + ipAddress + ")");
                dnsList.Add(ipAddress, hostName);

                string portNumber = session["XILIXPORTNO"];
                session.Log("Access Portal Number = " + portNumber);

                string defaultProfile = session["XILIXDEFPROFILE"];
                string defaultSettingsFile = session["PROFILE." + defaultProfile];
                session.Log("Default Trading Profile = " + defaultProfile + " (" + defaultSettingsFile + ")");

                string language = session["XILIXDEFLANG"];
                session.Log("Default Language = " + language);
                string plugin = session["XILIXDEFMDPLUGIN"];
                session.Log("Source of Market Data = " + plugin);
                string theme = session["XILIXDEFTHEME"];
                string themeName = session["THEME." + theme];
                session.Log("Colour Scheme = " + theme + " (" + themeName + ")");
                string market = session["XILIXPREMKT"];
                session.Log("Prefered Market = " + market);

                string reutersPlugin = session["REUTERSSOLACE_PLUGIN"];

                string installationFolderID = session["WIXUI_INSTALLDIR"];
                string installationFolder = session.GetTargetPath(installationFolderID);

                session.Log("Updating Files...");

                //UPDATE GLOBALSETTINGS
                string globalSettingsFile = System.IO.Path.Combine(installationFolder, @"bin\Config\GlobalSettings.config");
                string appServerFile = System.IO.Path.Combine(installationFolder, @"cfg\appserver\xilix-app.properties");
                string appSettingsFile = System.IO.Path.Combine(installationFolder, @"bin\MetaBit.Xilix.exe.config");
                string reutersFile = System.IO.Path.Combine(installationFolder, @"bin\Config\MarketData\ReutersSolace.xml");
                string defaultSettingsSourceFile = System.IO.Path.Combine(installationFolder, defaultSettingsFile);
                string defaultSettingsPath = System.IO.Path.GetDirectoryName(defaultSettingsSourceFile);
                if (!defaultSettingsPath.EndsWith(@"\")) defaultSettingsPath += @"\";
                string defaultSettingsDestinationFile = defaultSettingsPath + @"DefaultSettings.config";

                UpdateGlobalSettings(session, globalSettingsFile, plugin);
                if (plugin == reutersPlugin)
                {
                    string reutersHostName = session["REUTERSSOLACE_HOSTNAME"];
                    string reutersIP = session["REUTERSSOLACE_IP"];
                    string reutersVPN = session["REUTERSSOLACE_VPNNAME"];
                    dnsList.Add(reutersIP, reutersHostName);
                    UpdateReutersSolace(session, reutersFile, reutersHostName, reutersIP, reutersVPN);
                }
                UpdateAppServer(session, appServerFile, companyID, hostName, portNumber);
                UpdateDefaultSettings(session, defaultSettingsSourceFile, defaultSettingsDestinationFile, language, market, themeName);
                UpdateHostsFile(session, dnsList);
            }
            catch (Exception ex)
            {
                session.Log("CustomAction ERROR: " + ex.Message);
            }
            session.Log("End FileConfigurationSetup Custom Action");
            return ActionResult.Success;
        }
开发者ID:paul-green,项目名称:ClickOnce,代码行数:85,代码来源:CustomAction.cs


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