예제 #1
0
        public static ActionResult Uninstall(Session session)
        {
            ActiveState.RollbarHelper.ConfigureRollbarSingleton(session.CustomActionData["MSI_VERSION"]);
            string installDir = session.CustomActionData["REMEMBER"];

            session.Log("Begin uninstallation");

            ActionResult result;

            if (installDir != "")
            {
                result = Remove.Dir(session, installDir);
                if (result.Equals(ActionResult.Failure))
                {
                    session.Log("Could not remove installation directory");

                    Record record = new Record();
                    record.FormatString = string.Format("Could not remove installation directory entry at: {0}, please ensure no files in the directory are currently being used and try again", installDir);

                    session.Message(InstallMessage.Error | (InstallMessage)MessageBoxButtons.OK, record);
                    return(ActionResult.Failure);
                }

                result = Remove.EnvironmentEntries(session, installDir);
                if (result.Equals(ActionResult.Failure))
                {
                    string msg = "Could not remove environment entries";
                    session.Log(msg);
                    RollbarReport.Critical(msg, session);
                    return(ActionResult.Failure);
                }
            }
            else
            {
                session.Log("REMEMBER variable was not set in UNINSTALL");
            }

            string shortcutDir = session.CustomActionData["REMEMBER_SHORTCUTDIR"];

            if (shortcutDir != "")
            {
                result = Remove.Dir(session, shortcutDir);
                if (result.Equals(ActionResult.Failure))
                {
                    string msg = "Could not remove shortcuts directory";
                    session.Log(msg);
                    RollbarReport.Critical(msg, session);
                    return(ActionResult.Failure);
                }
            }
            else
            {
                session.Log("REMEMBER_SHORTCUTDIR was not set in UNINSTALL");
            }

            result = UninstallPreset(session);
            if (result.Equals(ActionResult.Failure))
            {
                string msg = "Could not uninstall language preset";
                session.Log(msg);
                RollbarReport.Critical(msg, session);
                return(ActionResult.Failure);
            }
            return(result);
        }