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


C# Session.AttachToSetupLog方法代码示例

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


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

示例1: OnScpa

        public static ActionResult OnScpa(Session Ctx)
        {
            PopUpDebugger();
            Func<Hashtable, string, string> GetParam = (s, x) => Utils.GetStringSetupParameter(s, x);
            Ctx.AttachToSetupLog();
            Log.WriteStart("OnScpa");

            try
            {
                var Hash = Ctx.CustomActionData.ToNonGenericDictionary() as Hashtable;
                var Scpa = new WebsitePanel.Setup.Actions.ConfigureStandaloneServerAction();
                Scpa.ServerSetup = new SetupVariables { };
                Scpa.EnterpriseServerSetup = new SetupVariables { };
                Scpa.PortalSetup = new SetupVariables { };
                Scpa.EnterpriseServerSetup.ServerAdminPassword = GetParam(Hash, "ServerAdminPassword");
                Scpa.EnterpriseServerSetup.PeerAdminPassword = Scpa.EnterpriseServerSetup.ServerAdminPassword;
                Scpa.PortalSetup.InstallerFolder = GetParam(Hash, "InstallerFolder");
                Scpa.PortalSetup.ComponentId = WiXSetup.GetComponentID(Scpa.PortalSetup);
                AppConfig.LoadConfiguration(new ExeConfigurationFileMap { ExeConfigFilename = WiXSetup.GetFullConfigPath(Scpa.PortalSetup) });
                Scpa.PortalSetup.EnterpriseServerURL = GetParam(Hash, "EnterpriseServerUrl");
                Scpa.PortalSetup.WebSiteIP = GetParam(Hash, "PortalWebSiteIP");
                Scpa.ServerSetup.WebSiteIP = GetParam(Hash, "ServerWebSiteIP");
                Scpa.ServerSetup.WebSitePort = GetParam(Hash, "ServerWebSitePort");
                Scpa.ServerSetup.ServerPassword = GetParam(Hash, "ServerPassword");
                var Make = Scpa as WebsitePanel.Setup.Actions.IInstallAction;
                Make.Run(null);
            }
            catch (Exception ex)
            {
                Log.WriteError(ex.ToString());
            }
            Log.WriteEnd("OnScpa");
            return ActionResult.Success;
        }
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:34,代码来源:CustomAction.cs

示例2: OnEServerPrepare

        public static ActionResult OnEServerPrepare(Session Ctx)
        {
            PopUpDebugger();

            Ctx.AttachToSetupLog();
            Log.WriteStart("OnEServerPrepare");
            GetPrepareScript(Ctx).Run();
            Log.WriteEnd("OnEServerPrepare");
            return ActionResult.Success;
        }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:10,代码来源:CustomAction.cs

示例3: GetDbSkip

 public static ActionResult GetDbSkip(Session Ctx)
 {
     PopUpDebugger();
     Ctx.AttachToSetupLog();
     Log.WriteStart("GetDbSkip");
     var ConnStr = Ctx["DB_CONN"];
     var DbName = Ctx["DB_DATABASE"];
     var Tmp = Adapter.SkipCreateDb(ConnStr, DbName) ? YesNo.Yes : YesNo.No;
     Log.WriteInfo("DB_SKIP_CREATE is " + Tmp);
     Ctx["DB_SKIP_CREATE"] = Tmp;
     Log.WriteEnd("GetDbSkip");
     return ActionResult.Success;
 }
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:13,代码来源:CustomAction.cs

示例4: CheckConnectionSchedulerUI

 public static ActionResult CheckConnectionSchedulerUI(Session Ctx)
 {
     PopUpDebugger();
     Ctx.AttachToSetupLog();
     Log.WriteStart("CheckConnectionSchedulerUI");
     var Result = default(bool);
     var Msg = default(string);
     var DbServer = Ctx["PI_SCHEDULER_DB_SERVER"];
     var DbUser = Ctx["PI_SCHEDULER_DB_LOGIN"];
     var DbPass = Ctx["PI_SCHEDULER_DB_PASSWORD"];
     var DbBase = Ctx["PI_SCHEDULER_DB_DATABASE"];
     if (new string[] { DbServer, DbUser, DbPass, DbBase }.Any(x => string.IsNullOrWhiteSpace(x)))
         Msg = "Please check all fields again.";
     else
         Result = Adapter.CheckSql(new SetupVariables { InstallConnectionString = GetConnectionString(DbServer, DbBase, DbUser, DbPass) }, out Msg) == CheckStatuses.Success;
     Ctx["DB_CONN_CORRECT"] = Result ? YesNo.Yes : YesNo.No;
     Ctx["DB_CONN_MSG"] = string.Format(Result ? "Success. {0}" : "Error. {0}", Msg);
     Log.WriteEnd("CheckConnectionSchedulerUI");
     return ActionResult.Success;
 }
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:20,代码来源:CustomAction.cs

示例5: OnSchedulerPrepare

 public static ActionResult OnSchedulerPrepare(Session Ctx)
 {
     PopUpDebugger();
     Ctx.AttachToSetupLog();
     Log.WriteStart("OnSchedulerPrepare");
     try
     {
         var ServiceName = Global.Parameters.SchedulerServiceName;
         var ServiceFile = string.Empty;
         ManagementClass WmiService = new ManagementClass("Win32_Service");
         foreach (var MObj in WmiService.GetInstances())
         {
             if (MObj.GetPropertyValue("Name").ToString().Equals(ServiceName, StringComparison.CurrentCultureIgnoreCase))
             {
                 ServiceFile = MObj.GetPropertyValue("PathName").ToString();
                 break;
             }
         }
         if (!string.IsNullOrWhiteSpace(ServiceName) && !string.IsNullOrWhiteSpace(ServiceFile))
         {
             var CtxVars = new SetupVariables() { ServiceName = ServiceName, ServiceFile = ServiceFile };
             var Script = new BackupSchedulerScript(CtxVars);
             Script.Actions.Add(new InstallAction(ActionTypes.UnregisterWindowsService)
             {
                 Name = ServiceName,
                 Path = ServiceFile,
                 Description = "Removing Windows service...",
                 Log = string.Format("- Remove {0} Windows service", ServiceName)
             });
             Script.Context.ServiceName = Global.Parameters.SchedulerServiceName;
             Script.Run();
         }
     }
     catch (Exception ex)
     {
         Log.WriteError(ex.ToString());
     }
     Log.WriteEnd("OnSchedulerPrepare");
     return ActionResult.Success;
 }
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:40,代码来源:CustomAction.cs

示例6: ProcessInstall

 private static ActionResult ProcessInstall(Session Ctx, WiXInstallType InstallType)
 {
     IWiXSetup Install = null;
     try
     {
         Ctx.AttachToSetupLog();
         switch (InstallType)
         {
             case WiXInstallType.InstallServer:
                 Install = ServerSetup.Create(Ctx.CustomActionData, SetupActions.Install);
                 break;
             case WiXInstallType.RemoveServer:
                 Install = ServerSetup.Create(Ctx.CustomActionData, SetupActions.Uninstall);
                 break;
             case WiXInstallType.MaintenanceServer:
                 Install = ServerSetup.Create(Ctx.CustomActionData, SetupActions.Setup);
                 break;
             case WiXInstallType.InstallEnterpriseServer:
                 Install = EServerSetup.Create(Ctx.CustomActionData, SetupActions.Install);
                 break;
             case WiXInstallType.RemoveEnterpriseServer:
                 Install = EServerSetup.Create(Ctx.CustomActionData, SetupActions.Uninstall);
                 break;
             case WiXInstallType.MaintenanceEnterpriseServer:
                 Install = EServerSetup.Create(Ctx.CustomActionData, SetupActions.Setup);
                 break;
             case WiXInstallType.InstallPortal:
                 Install = PortalSetup.Create(Ctx.CustomActionData, SetupActions.Install);
                 break;
             case WiXInstallType.RemovePortal:
                 Install = PortalSetup.Create(Ctx.CustomActionData, SetupActions.Uninstall);
                 break;
             case WiXInstallType.MaintenancePortal:
                 Install = PortalSetup.Create(Ctx.CustomActionData, SetupActions.Setup);
                 break;
             case WiXInstallType.InstallScheduler:
                 Install = SchedulerSetup.Create(Ctx.CustomActionData, SetupActions.Install);
                 break;
             case WiXInstallType.RemoveScheduler:
                 Install = SchedulerSetup.Create(Ctx.CustomActionData, SetupActions.Uninstall);
                 break;
             default:
                 throw new NotImplementedException();
         }
         Install.Run();
     }
     catch (WiXSetupException we)
     {
         Ctx.Log("Expected exception: " + we.ToString());
         return ActionResult.Failure;
     }
     catch (Exception ex)
     {
         Ctx.Log(ex.ToString());
         return ActionResult.Failure;
     }
     return ActionResult.Success;
 }
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:58,代码来源:CustomAction.cs

示例7: PortalNormalizeLoginUI

 public static ActionResult PortalNormalizeLoginUI(Session Ctx)
 {
     Ctx.AttachToSetupLog();
     try
     {
         NormalizeLoginUI(Ctx, "PORTAL");
     }
     catch (Exception ex)
     {
         Log.WriteError("Error in login", ex);
     }
     return ActionResult.Success;
 }
开发者ID:jonwbstr,项目名称:Websitepanel,代码行数:13,代码来源:CustomAction.cs

示例8: InstallRollback

        public static ActionResult InstallRollback(Session Ctx)
        {
            PopUpDebugger();
            Ctx.AttachToSetupLog();
            const string Title = "Rolling back component";
            Log.WriteStart(Title);
            Log.WriteInfo("It is normal that here occurs error.");
            try
            {
                SetupVariables SetupVar = new SetupVariables();
                WiXSetup.FillFromSession(Ctx.CustomActionData, SetupVar);
                SetupVar.IISVersion = Tool.GetWebServerVersion();
                SetupVar.ComponentId = GetProperty(Ctx, "ComponentId");

                SetupVar.WebSiteId = SetupVar.ComponentFullName;
                SetupVar.WebApplicationPoolName = string.Format("{0} Pool", SetupVar.ComponentFullName);
                SetupVar.DatabaseUser = SetupVar.Database;

                SetupScript Script = new ExpressScript(SetupVar);
                InstallAction Act = null;

                Act = new InstallAction(ActionTypes.DeleteWebSite);
                Act.SiteId = SetupVar.WebSiteId;
                Act.Description = "Deleting web site...";
                Act.Log = string.Format("- Delete {0} web site", SetupVar.WebSiteId);
                Script.Actions.Add(Act);

                Act = new InstallAction(ActionTypes.DeleteApplicationPool);
                Act.Name = SetupVar.ApplicationPool;
                Act.Description = "Deleting application pool...";
                Act.Log = string.Format("- Delete {0} application pool", SetupVar.ApplicationPool);
                Script.Actions.Add(Act);

                if (SetupVar.UserMembership != null && SetupVar.UserMembership.Length > 0)
                {
                    Act = new InstallAction(ActionTypes.DeleteUserMembership);
                    Act.Name = SetupVar.UserAccount;
                    Act.Domain = SetupVar.UserDomain;
                    Act.Membership = SetupVar.UserMembership;
                    Act.Description = "Removing user account membership...";
                    Act.Log = string.Format("- Remove {0} user account membership", SetupVar.UserAccount);
                    Script.Actions.Add(Act);
                }

                if (SetupVar.NewUserAccount)
                {
                    Act = new InstallAction(ActionTypes.DeleteUserAccount);
                    Act.Name = SetupVar.UserAccount;
                    Act.Domain = SetupVar.UserDomain;
                    Act.Description = "Deleting user account...";
                    Act.Log = string.Format("- Delete {0} user account", SetupVar.UserAccount);
                    Script.Actions.Add(Act);
                }

                if (SetupVar.ComponentCode == Global.EntServer.ComponentCode)
                {
                    Act = new InstallAction(ActionTypes.DeleteDatabaseUser);
                    Act.ConnectionString = SetupVar.InstallConnectionString;
                    Act.UserName = SetupVar.DatabaseUser;
                    Act.Description = "Deleting database user...";
                    Act.Log = string.Format("- Delete {0} database user", SetupVar.DatabaseUser);
                    Script.Actions.Add(Act);

                    Act = new InstallAction(ActionTypes.DeleteDatabaseLogin);
                    Act.ConnectionString = SetupVar.InstallConnectionString;
                    Act.UserName = SetupVar.DatabaseUser;
                    Act.Description = "Deleting database login...";
                    Act.Log = string.Format("- Delete {0} database login", SetupVar.DatabaseUser);
                    Script.Actions.Add(Act);
                }

                if (SetupVar.ComponentCode == Global.WebPortal.ComponentCode)
                {
                    Act = new InstallAction(ActionTypes.DeleteShortcuts);
                    Act.Description = "Deleting shortcuts...";
                    Act.Log = "- Delete shortcuts";
                    Act.Name = "Login to MSPControl.url";
                    Script.Actions.Add(Act);
                }

                Script.Run();
            }
            catch (Exception ex)
            {
                Log.WriteError(ex.ToString());
            }
            Log.WriteEnd(Title);
            return ActionResult.Success;
        }
开发者ID:jonwbstr,项目名称:Websitepanel,代码行数:89,代码来源:CustomAction.cs

示例9: SchedulerInstallRollback

        public static ActionResult SchedulerInstallRollback(Session Ctx)
        {
            PopUpDebugger();
            Ctx.AttachToSetupLog();
            const string LogExt = ".InstallLog";
            const string Title = "Rolling back component";
            Log.WriteStart(Title);
            Log.WriteInfo("It is normal that here occurs error.");
            try
            {
                SetupVariables SetupVar = new SetupVariables();
                WiXSetup.FillFromSession(Ctx.CustomActionData, SetupVar);
                SetupVar.IISVersion = Tool.GetWebServerVersion();
                SetupVar.ComponentId = GetProperty(Ctx, "ComponentId");

                SetupVar.ServiceName = Global.Parameters.SchedulerServiceName;
                SetupVar.ServiceFile = Path.Combine(SetupVar.InstallationFolder, Global.Parameters.SchedulerServiceFileName);

                var Script = new ExpressScript(SetupVar);
                Script.Actions.Add(new InstallAction(ActionTypes.UnregisterWindowsService)
                {
                    Name = SetupVar.ServiceName,
                    Path = SetupVar.ServiceFile,
                    Description = string.Format("Removing Windows service '{0}' ...", SetupVar.ServiceFile),
                    Log = string.Format("- Remove {0} Windows service", SetupVar.ServiceName)
                });
                Script.Actions.Add(new InstallAction(ActionTypes.DeleteDirectoryFiles)
                {
                    Path = SetupVar.InstallFolder,
                    FileFilter = x => x.ToLowerInvariant().EndsWith(LogExt.ToLowerInvariant())
                });

                Script.Run();
            }
            catch (Exception ex)
            {
                Log.WriteError(ex.ToString());
            }
            Log.WriteEnd(Title);
            return ActionResult.Success;
        }
开发者ID:jonwbstr,项目名称:Websitepanel,代码行数:41,代码来源:CustomAction.cs


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