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


C# Record.SetString方法代码示例

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


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

示例1: CreateComboBoxRecordItem

 private static void CreateComboBoxRecordItem(View view, int numRows, string propertyName, string text, string value)
 {
     Record record = new Record(4);
     record.SetString(1, propertyName);
     record.SetInteger(2, numRows);
     record.SetString(3, value);
     record.SetString(4, text);
     view.Modify(ViewModifyMode.InsertTemporary, record);
 }
开发者ID:bestpetrovich,项目名称:devicehive-.net,代码行数:9,代码来源:CustomAction.Utils.cs

示例2: Log

        /// <summary>
        /// Logs a message to the MSI log using the MSI error table.
        /// </summary>
        /// <param name="id">Error message id</param>
        /// <param name="args">Arguments to the error message (will be inserted into the formatted error message).</param>
        public void Log(int id, params string[] args)
        {
            // field 0 is free, field 1 is the id, fields 2..n are arguments
            using (Record rec = new Record(1 + args.Length))
            {
                rec.SetInteger(1, id);
                for (int i = 0; i < args.Length; i++)
                {
                    rec.SetString(2 + i, args[i]);
                }

                this.session.Message(InstallMessage.User, rec);
            }
        }
开发者ID:bullshock29,项目名称:Wix3.6Toolset,代码行数:19,代码来源:LuxLogger.cs

示例3: DisplayMSIError

 static void DisplayMSIError(Session session, string msg)
 {
     var r = new Record();
     r.SetString(0, msg);
     session.Message(InstallMessage.Error, r);
 }
开发者ID:uw-it-cte,项目名称:fog-client,代码行数:6,代码来源:CustomAction.cs

示例4: PrereqCheck

 public static ActionResult PrereqCheck(Session session)
 {
     var SecMsg = "You do not have the appropriate permissions to perform this operation. Make sure you are running the application from the local disk and you have local system administrator privileges.";
     var NetMsg = "Microsoft .NET {0} is {1}.";
     Action<string> ShowMsg = (string Text) =>
     {
         using(var Rec = new Record(0))
         {
             Rec.SetString(0, Text);
             session.Message(InstallMessage.Error, Rec);
         }
     };
     Action<Session, string, string> FxLog = (Session SesCtx, string Ver, string StrVer) =>
     {
         if (YesNo.Get(session[Ver]) == YesNo.Yes)
             AddLog(SesCtx, string.Format(NetMsg, StrVer, "available"));
         else
             AddLog(SesCtx, string.Format(NetMsg, StrVer, "not available"));
     };
     if (!Adapter.CheckSecurity() || !Adapter.IsAdministrator())
     {
         ShowMsg(SecMsg);
         return ActionResult.Failure;
     }            
     string Msg;
     var Ctx = Tool.GetSetupVars(session);
     var ros = Adapter.CheckOS(Ctx, out Msg);
     AddLog(session, Msg);
     var riis = Adapter.CheckIIS(Ctx, out Msg);
     AddLog(session, Msg);
     var raspnet = Adapter.CheckASPNET(Ctx, out Msg);
     AddLog(session, Msg);
     session[Prop.REQ_OS] = ros == CheckStatuses.Success ? YesNo.Yes : YesNo.No;
     session[Prop.REQ_IIS] = riis == CheckStatuses.Success ? YesNo.Yes : YesNo.No; ;
     session[Prop.REQ_ASPNET] = raspnet == CheckStatuses.Success ? YesNo.Yes : YesNo.No; ;
     FxLog(session, Prop.REQ_NETFRAMEWORK20, "2.0");
     FxLog(session, Prop.REQ_NETFRAMEWORK35, "3.5");
     FxLog(session, Prop.REQ_NETFRAMEWORK40FULL, "4.0");
     return ActionResult.Success;
 }
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:40,代码来源:CustomAction.cs

示例5: InstallWebFeatures

        public static ActionResult InstallWebFeatures(Session session)
        {
            PopUpDebugger();

            var Ctx = session;
            Ctx.AttachToSetupLog();
            Log.WriteStart("InstallWebFeatures");
            var Result = ActionResult.Success;
            var Scheduled = Ctx.GetMode(InstallRunMode.Scheduled);
            var Components = new List<string>();
            var InstallIis = false;
            var InstallAspNet = false;
            var InstallNetFx3 = false;
            if (Scheduled)
            {
                InstallIis = Ctx.CustomActionData["PI_PREREQ_IIS_INSTALL"] != YesNo.No;
                InstallAspNet = Ctx.CustomActionData["PI_PREREQ_ASPNET_INSTALL"] != YesNo.No;
                InstallNetFx3 = Ctx.CustomActionData["PI_PREREQ_NETFX_INSTALL"] != YesNo.No;
            }
            else
            {
                InstallIis = Ctx["PI_PREREQ_IIS_INSTALL"] != YesNo.No;
                InstallAspNet = Ctx["PI_PREREQ_ASPNET_INSTALL"] != YesNo.No;
                InstallNetFx3 = Ctx["PI_PREREQ_NETFX_INSTALL"] != YesNo.No;
            }
            if (InstallIis)
                Components.AddRange(Tool.GetWebRoleComponents());
            if (InstallAspNet)
                Components.AddRange(Tool.GetWebDevComponents());
            if (InstallNetFx3)
                Components.AddRange(Tool.GetNetFxComponents());
            if (Scheduled)
            {
                Action<int, int> ProgressReset = (int Total, int Mode) =>
                {
                    using (var Tmp = new Record(4))
                    {
                        Tmp.SetInteger(1, 0);
                        Tmp.SetInteger(2, Total);
                        Tmp.SetInteger(3, 0);
                        Tmp.SetInteger(4, Mode);
                        Ctx.Message(InstallMessage.Progress, Tmp);
                    }
                };
                Action<int> ProgressIncrement = (int Value) =>
                {
                    using (var Tmp = new Record(2))
                    {
                        Tmp.SetInteger(1, 2);
                        Tmp.SetInteger(2, Value);
                        Ctx.Message(InstallMessage.Progress, Tmp);
                    }
                };
                Action<string> ProgressText = (string Text) =>
                {
                    using (var Tmp = new Record(2))
                    {
                        Tmp.SetString(1, "CA_InstallWebFeaturesDeferred");
                        Tmp.SetString(2, Text);
                        Ctx.Message(InstallMessage.ActionStart, Tmp);
                    }
                };
                var Frmt = "Installing web component the {0} a {1} of {2}";
                Log.WriteStart("InstallWebFeatures: components");
                ProgressReset(Components.Count + 1, 0);
                ProgressText("Installing necessary web components ...");
                var Msg = new StringBuilder();
                try
                {
                    InstallToolDelegate InstallTool = Tool.GetInstallTool();
                    if (InstallTool == null)
                        throw new ApplicationException("Install tool for copmonents is not found.");                    
                    for (int i = 0; i < Components.Count; i ++)
                    {
                        var Component = Components[i];
                        ProgressText(string.Format(Frmt, Component, i + 1, Components.Count));
                        ProgressIncrement(1);
                        Msg.AppendLine(InstallTool(Component));
                    }
                    if (InstallAspNet)
                        Tool.PrepareAspNet();                    
                    Log.WriteInfo("InstallWebFeatures: done.");
                }
                catch (Exception ex)
                {
                    Log.WriteError(string.Format("InstallWebFeatures: fail - {0}.", ex.ToString()));
                    Result = ActionResult.Failure;
                }
                finally
                {
                    ProgressReset(Components.Count * 3 + 1, 0);
                    if (Msg.Length > 0)
                        Log.WriteInfo(string.Format("InstallWebFeatures Tool Log: {0}.", Msg.ToString()));
                    Log.WriteEnd("InstallWebFeatures: components"); 
                }                               
            }
            else
            {
                Log.WriteStart("InstallWebFeatures: prepare");
                using (var ProgressRecord = new Record(2))
//.........这里部分代码省略.........
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:101,代码来源:CustomAction.cs

示例6: PreFillSettings


//.........这里部分代码省略.........
                                        var Password = IsEnctyptionEnabled(string.Format(@"{0}\Web.config", CtxVars.InstallationFolder)) ? Utils.Decrypt(CtxVars.CryptoKey, Hash) : Hash;
                                        Ctx["SERVERADMIN_PASSWORD"] = Password;
                                        Ctx["SERVERADMIN_PASSWORD_CONFIRM"] = Password;
                                    }
                                }
                            }
                            catch
                            {
                                // Nothing to do.
                            }

                            var HaveAccount = SecurityUtils.UserExists(CtxVars.UserDomain, CtxVars.UserAccount);
                            bool HavePool = Tool.AppPoolExists(CtxVars.ApplicationPool);

                            Ctx["COMPFOUND_ESERVER"] = (HaveAccount && HavePool) ? YesNo.Yes : YesNo.No;
                        }
                        CtxVars.ComponentId = WiXSetup.GetComponentID(CfgPath, Global.WebPortal.ComponentCode);
                        if (!string.IsNullOrWhiteSpace(CtxVars.ComponentId))
                        {
                            AppConfig.LoadComponentSettings(CtxVars);
                            VersionGuard(Ctx, CtxVars);

                            SetProperty(Ctx, "COMPFOUND_PORTAL_ID", CtxVars.ComponentId);
                            SetProperty(Ctx, "COMPFOUND_PORTAL_MAIN_CFG", CfgPath);

                            SetProperty(Ctx, "PI_PORTAL_IP", CtxVars.WebSiteIP);
                            SetProperty(Ctx, "PI_PORTAL_PORT", CtxVars.WebSitePort);
                            SetProperty(Ctx, "PI_PORTAL_HOST", CtxVars.WebSiteDomain);
                            SetProperty(Ctx, "PI_PORTAL_LOGIN", CtxVars.UserAccount);
                            SetProperty(Ctx, "PI_PORTAL_DOMAIN", CtxVars.UserDomain);
                            if (!SetProperty(Ctx, "PI_ESERVER_URL", CtxVars.EnterpriseServerURL))
                                if (!SetProperty(Ctx, "PI_ESERVER_URL", EServerUrl))
                                    SetProperty(Ctx, "PI_ESERVER_URL", Global.WebPortal.DefaultEntServURL);

                            SetProperty(Ctx, "PI_PORTAL_INSTALL_DIR", CtxVars.InstallFolder);
                            SetProperty(Ctx, "WSP_INSTALL_DIR", NormalizeDir(new DirectoryInfo(CtxVars.InstallFolder).Parent.FullName));

                            var HaveAccount = SecurityUtils.UserExists(CtxVars.UserDomain, CtxVars.UserAccount);
                            bool HavePool = Tool.AppPoolExists(CtxVars.ApplicationPool);

                            Ctx["COMPFOUND_PORTAL"] = (HaveAccount && HavePool) ? YesNo.Yes : YesNo.No;
                        }
                        CtxVars.ComponentId = WiXSetup.GetComponentID(CfgPath, Global.Scheduler.ComponentCode);
                        var HaveComponentId = !string.IsNullOrWhiteSpace(CtxVars.ComponentId);
                        var HaveSchedulerService = ServiceController.GetServices().Any(x => x.DisplayName.Equals(Global.Parameters.SchedulerServiceName, StringComparison.CurrentCultureIgnoreCase));
                        var EServerConnStr = Ctx["PI_ESERVER_CONN_STR"];
                        var HaveConn = !string.IsNullOrWhiteSpace(EServerConnStr);
                        if (HaveComponentId || HaveSchedulerService || HaveConn)
                        {
                            Ctx["COMPFOUND_SCHEDULER"] = YesNo.No;
                            try
                            {
                                SqlConnectionStringBuilder ConnInfo = null;
                                if (HaveComponentId)
                                {
                                    AppConfig.LoadComponentSettings(CtxVars);
                                    VersionGuard(Ctx, CtxVars);
                                    SetProperty(Ctx, "COMPFOUND_SCHEDULER_ID", CtxVars.ComponentId);
                                    SetProperty(Ctx, "COMPFOUND_SCHEDULER_MAIN_CFG", CfgPath);
                                    SetProperty(Ctx, "PI_SCHEDULER_CRYPTO_KEY", CtxVars.CryptoKey);
                                    ConnInfo = new SqlConnectionStringBuilder(CtxVars.ConnectionString);                                    
                                }
                                else if (HaveConn)
                                {                                    
                                    SetProperty(Ctx, "PI_SCHEDULER_CRYPTO_KEY", Ctx["PI_ESERVER_CRYPTO_KEY"]);
                                    ConnInfo = new SqlConnectionStringBuilder(EServerConnStr);
                                }
                                if(ConnInfo != null)
                                {
                                    SetProperty(Ctx, "PI_SCHEDULER_DB_SERVER", ConnInfo.DataSource);
                                    SetProperty(Ctx, "PI_SCHEDULER_DB_DATABASE", ConnInfo.InitialCatalog);
                                    SetProperty(Ctx, "PI_SCHEDULER_DB_LOGIN", ConnInfo.UserID);
                                    SetProperty(Ctx, "PI_SCHEDULER_DB_PASSWORD", ConnInfo.Password);
                                }
                                Ctx["COMPFOUND_SCHEDULER"] = HaveSchedulerService? YesNo.Yes : YesNo.No;
                            }
                            catch (Exception ex)
                            {
                                Log.WriteError("Detection of existing Scheduler Service failed.", ex);
                            }                                
                        }
                    }
                    catch (InvalidOperationException ioex)
                    {
                        Log.WriteError(ioex.ToString());
                        var Text = new Record(1);
                        Text.SetString(0, ioex.Message);
                        Ctx.Message(InstallMessage.Error, Text);
                        return ActionResult.Failure;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.WriteError(ex.ToString());
                return ActionResult.Failure;
            }
            Log.WriteEnd("PreFillSettings");
            return ActionResult.Success;
        }
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:101,代码来源:CustomAction.cs

示例7: ScanNetworkForSqlServers

        public static ActionResult ScanNetworkForSqlServers(Session session)
        {
            sessionObj = session;
            if (xmlSettings == null)
                xmlSettings = new XMLSettingsManager();

            if ((session["HASSCANNEDFORSQL"].CompareTo("0") == 0) && (session["ISSERVERINSTALL"] != "0")) {
                if (xmlSettings.SettingsFileExists()) {
                    return ActionResult.SkipRemainingActions;
                } else {
                    DataTable dt = SqlDataSourceEnumerator.Instance.GetDataSources();
                    View sqlComboBox = session.Database.OpenView("SELECT * FROM `ComboBox`");
                    sqlComboBox.Execute();
                    int numRows = 0;
                    while (sqlComboBox.Fetch() != null) {
                        numRows++;
                    }
                    if (numRows == 1) {
                        CustomActions.LogToSession(string.Format("found {0} sql servers", dt.Rows.Count));
                        int itemNumber = 2;
                        foreach (DataRow row in dt.Rows) {
                            Record rec = new Record(3);
                            rec.SetString(1, "OMLProp_SqlServers");
                            rec.SetInteger(2, itemNumber);
                            string description = string.Format("{0} - {1}", row["ServerName"], row["InstanceName"]);
                            rec.SetString(3, description);

                            CustomActions.LogToSession(string.Format("Adding a new record, its number will be {0} and its value will be {1}", itemNumber, string.Format("{0} ({1})", row["ServerName"], row["InstanceName"])));
                            sqlComboBox.Modify(ViewModifyMode.InsertTemporary, rec);
                            itemNumber++;
                        }
                    }
                }
                session["HASSCANNEDFORSQL"] = "1";
            }
            return ActionResult.Success;
        }
开发者ID:peeboo,项目名称:open-media-library,代码行数:37,代码来源:CustomAction.cs

示例8: ValidateInstall

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

			// check the required properties have been set
			string definition_to_use = session["INSTALLVALIDATORDEF"];
			string path_to_validate = session["INSTALLVALIDATORPATH"];

			if ((definition_to_use == null) || (definition_to_use.Length == 0))
			{
				session.Log("InstallValidator: ERROR : INSTALLVALIDATORDEF not set");
				return ActionResult.Failure;
			}
			if ((path_to_validate == null) || (path_to_validate.Length == 0))
			{
				session.Log("InstallValidator: ERROR : INSTALLVALIDATORPATH not set");
				return ActionResult.Failure;
			}

			// log the properties for debugging if necessary
			session.Log("LOG: INSTALLVALIDATORDEF : " + definition_to_use);
			session.Log("LOG: INSTALLVALIDATORPATH : " + path_to_validate);

			// validate the installation path
			ValidateInstallPath(definition_to_use, path_to_validate);

			// show warning messages
			if (g_validator.WarningMessages.Count != 0)
			{
				Record message_record = new Record(1);
				MessageResult view_warnings_result;

				// ask the user if they want to see the warnings that were raised
				message_record.SetString(0, String.Format("{0} warnings were raised when validating your installation.\n\nDo you want to view them (Recommended)?",
					g_validator.WarningMessages.Count));
				view_warnings_result = session.Message(InstallMessage.Warning | (InstallMessage)(MessageIcon.Warning) | (InstallMessage)MessageButtons.YesNo, message_record);
				if(MessageResult.Yes == view_warnings_result)
				{
					// display each warning in a seperate dialog
					foreach (var message in g_validator.WarningMessages)
					{
						session.Log("InstallValidator: {0}", message);
						message_record.SetString(0, message);
						session.Message(InstallMessage.Warning | (InstallMessage)(MessageIcon.Warning) | (InstallMessage)MessageButtons.OK, message_record);
					}

					// see if the user still wants to continue the installation
					message_record.SetString(0, "Do you want to continue the installation?");
					view_warnings_result = session.Message(InstallMessage.Warning | (InstallMessage)(MessageIcon.Warning) | (InstallMessage)MessageButtons.YesNo, message_record);

					// if the user wants to cancel the installation return user exit
					if (view_warnings_result == MessageResult.No)
						return ActionResult.UserExit;
				}
			}

			// show error messages
			if (g_validator.ErrorMessages.Count != 0)
			{
				Record record = new Record(g_validator.ErrorMessages.Count);
				
				// there should only ever be one error message since it returns immediately after finding one
				// but just in case, log and display all in the list
				int index = 0;
				foreach (var message in g_validator.ErrorMessages)
				{
					session.Log("InstallValidator: {0}", message);
					record.SetString(index, message);
					index++;
				}

				// present an error message to the user
				session.Message(InstallMessage.Error | (InstallMessage)(MessageIcon.Error) | (InstallMessage)MessageButtons.OK, record);
				return ActionResult.Failure;
			}

			return ActionResult.Success;
		}
开发者ID:CodeAsm,项目名称:open-sauce,代码行数:78,代码来源:InstallValidator.cs

示例9: SendMessage

 public static void SendMessage(this Session session, string message)
 {
     var record = new Record();
     record.SetString(0, message);
     session.Message(InstallMessage.Warning, record);
 }
开发者ID:dspiegs,项目名称:DSpiegsUtil,代码行数:6,代码来源:CustomActionHelper.cs

示例10: PatchFile

		public static ActionResult PatchFile(Session session)
		{
			session.Log("Begin FilePatcher");

			string patch_arguments = session["CustomActionData"];

			// check the custom action arguments have been set
			if ((patch_arguments == null) || (patch_arguments.Length == 0))
			{
				session.Log("FilePatcher: ERROR : CustomActionData not set");
				return ActionResult.Failure;
			}

			// split the patch arguments string, the count should be a multiple of 3
			string[] split_arguments = patch_arguments.Split(new char[] {';'}, StringSplitOptions.RemoveEmptyEntries);
			if((split_arguments.Length == 0) || ((split_arguments.Length % 3) > 0))
			{
				session.Log("Invalid number of arguments passed to the FilePatcher");
				return ActionResult.Failure;
			}

			// populate the patch list
			List<PatchInstance> files_to_patch = new List<PatchInstance>();
			for(int i = 0; i < split_arguments.Length; i+=3)
			{
				PatchInstance patch = new PatchInstance();

				patch.FileID = split_arguments[i];
				patch.FilePath = split_arguments[i + 1];
				patch.OutputPath = split_arguments[i + 2];

				files_to_patch.Add(patch);
			}

			// patch each file in order
			foreach(var patch_instance in files_to_patch)
			{
				// log the properties for debugging if necessary
				session.Log("LOG: FILEPATCHERID : " + patch_instance.FileID);
				session.Log("LOG: FILEPATCHERSRCFILE : " + patch_instance.FilePath);
				session.Log("LOG: FILEPATCHEROUTPATH : " + patch_instance.OutputPath);

				// patch the file
				ApplyPatch(patch_instance.FileID, patch_instance.FilePath, patch_instance.OutputPath);

				// show error messages
				if (g_file_patcher.ErrorMessages.Count != 0)
				{
					Record record = new Record(g_file_patcher.ErrorMessages.Count);

					// there should only ever be one error message since it returns immediately after
					// but just in case, log and display all in the list
					int index = 0;
					foreach (var message in g_file_patcher.ErrorMessages)
					{
						session.Log("FilePatcher: {0}", message);
						record.SetString(index, message);
						index++;
					}

					// present an error message to the user
					session.Message(InstallMessage.Error | (InstallMessage)(MessageIcon.Error) | (InstallMessage)MessageButtons.OK, record);
					return ActionResult.Failure;
				}
			}

			return ActionResult.Success;
		}
开发者ID:CodeAsm,项目名称:open-sauce,代码行数:68,代码来源:FilePatcher.cs

示例11: SendProgressMessageToBA

    public static void SendProgressMessageToBA(Session session, string message, int progress)
    {
        Record messageRecord = new Record(4);
        messageRecord.SetInteger(1, (int)MessageId.Progress);
        messageRecord.SetString(2, message);
        messageRecord.SetInteger(3, progress);

        session.Message(InstallMessage.Warning, messageRecord);
    }
开发者ID:SonarQubeCommunity,项目名称:sonarqube-windows-installer,代码行数:9,代码来源:Program.cs

示例12: SendMessageBoxMessageToBA

    public static void SendMessageBoxMessageToBA(Session session, string message)
    {
        Record messageRecord = new Record(3);
        messageRecord.SetInteger(1, (int)MessageId.MessageBox);
        messageRecord.SetString(2, message);

        session.Message(InstallMessage.Warning, messageRecord);
    }
开发者ID:SonarQubeCommunity,项目名称:sonarqube-windows-installer,代码行数:8,代码来源:Program.cs


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