public static ActionResult CostDownloadAndExtractZip(Session session)
        {
            CustomActionData customActionData = new CustomActionData();

            customActionData.Add("INSTALLLOCATION", session["INSTALLLOCATION"]);
            customActionData.Add("URL", session["URL"]);
            customActionData.Add("UILEVEL", session["UILevel"]);
            session.DoAction("DownloadAndExtractZip", customActionData);
            return(ActionResult.Success);
        }
        public static ActionResult CostUninstallFiles(Session session)
        {
            CustomActionData customActionData = new CustomActionData();

            customActionData.Add("INSTALLLOCATION", session["INSTALLLOCATION"]);
            session.DoAction("UninstallFiles", customActionData);
            return(ActionResult.Success);
        }
Ejemplo n.º 3
0
 private static void SetCustomActionData(Session session, string propertyName, CustomActionData data)
 {
     if (data.ContainsKey(propertyName))
     {
         data[propertyName] = session[propertyName];
     }
     else
     {
         data.Add(propertyName, session[propertyName]);
     }
 }
Ejemplo n.º 4
0
 public static ActionResult Server(Session session)
 {
     try
     {
         var customActionData = new CustomActionData();
         customActionData.Add(INSTALLFOLDER, session[INSTALLFOLDER]);
         session.DoAction("DeferredServerAction", customActionData);
         return(ActionResult.Success);
     }
     catch (Exception ex)
     {
         session.Log("Exception Occured during custom action details:" + ex.Message);
         return(ActionResult.Failure);
     }
 }
Ejemplo n.º 5
0
        private static ActionResult GetScriptsFromMsiDatabase(Session session, int elevated, string XmlDataProperty, string installAction)
        {
            Database db = session.Database;

            if (!db.Tables.Contains("PowerShellScripts"))
            {
                return(ActionResult.Success);
            }

            try
            {
                CustomActionData data;
                using (View view = db.OpenView(string.Format("SELECT `Id`, `Script` FROM `PowerShellScripts` WHERE `Elevated` = {0}", elevated)))
                {
                    view.Execute();

                    data = new CustomActionData();

                    Record row = view.Fetch();

                    while (row != null)
                    {
                        string script = Encoding.Unicode.GetString(Convert.FromBase64String(row["Script"].ToString()));
                        script = session.Format(script);
                        script = Convert.ToBase64String(Encoding.Unicode.GetBytes(script));

                        data.Add(row["Id"].ToString(), script);
                        session.Log("Adding {0} to CustomActionData", row["Id"]);

                        row = view.Fetch();
                    }
                }

                session[XmlDataProperty] = data.ToString();

                // Tell the installer to increase the value of the final total
                // length of the progress bar by the total number of ticks in
                // the custom action.
                MessageResult iResult;
                using (var hProgressRec = new Record(2))
                {
                    hProgressRec[1] = 3;
                    hProgressRec[2] = TotalTicks;
                    iResult         = session.Message(InstallMessage.Progress, hProgressRec);
                }

                if (iResult == MessageResult.Cancel)
                {
                    return(ActionResult.UserExit);
                }

                return(ActionResult.Success);
            }
            catch (Exception ex)
            {
                session.Log(ex.ToString());
                return(ActionResult.Failure);
            }
            finally
            {
                db.Close();
            }
        }
 /// <summary>
 ///     Set the CustomActionData collection element: <paramref name="data" />,
 ///     Using the value of the session property: session[propertyName].
 /// </summary>
 /// <param name="session">Windows Installer Session.</param>
 /// <param name="propertyName">Property Name </param>
 /// <param name="data">Collection properties.</param>
 private static void SetCustomActionData(Session session, string propertyName, CustomActionData data)
 {
     if (data.ContainsKey(propertyName))
         data[propertyName] = session[propertyName];
     else
         data.Add(propertyName, session[propertyName]);
 }
Ejemplo n.º 7
0
 public static ActionResult Server(Session session)
 {
     try
     {
         var customActionData = new CustomActionData();
         customActionData.Add(INSTALLFOLDER, session[INSTALLFOLDER]);
         session.DoAction("DeferredServerAction", customActionData);
         return ActionResult.Success;
     }
     catch (Exception ex)
     {
         session.Log("Exception Occured during custom action details:" + ex.Message);
         return ActionResult.Failure;
     }
 }