Exemplo n.º 1
0
        public override void Uninstall(IDictionary savedState)
        {
            try
            {
                InstallUtils.InstallModeEnum installMode =
                    (InstallUtils.InstallModeEnum)savedState["InstallMode"];

                string pathToAddinFile = (string)savedState["PathToAddinFile"];
                InstallUtils.UninstallRegistryFree(savedState, pathToAddinFile);
            }
            catch
            {
            }

            base.Uninstall(savedState);
        }
Exemplo n.º 2
0
        public override void Install(IDictionary stateSaver)
        {
            try
            {
                base.Install(stateSaver);

                InstallUtils.InstallModeEnum installMode = InstallUtils.InstallModeEnum.kRegistryFree;

                Assembly Asm     = Assembly.GetExecutingAssembly();
                FileInfo asmFile = new FileInfo(Asm.Location);

                stateSaver.Add("InstallMode", (int)installMode);

                stateSaver.Add("PathToAddinFile",
                               InstallUtils.InstallRegistryFree(
                                   stateSaver,
                                   Asm,
                                   InstallUtils.RegFreeModeEnum.kVersionIndep,
                                   string.Empty));

                // Example for version dependent

                //stateSaver.Add("PathToAddinFile",
                //    InstallUtils.InstallRegistryFree(
                //        stateSaver,
                //        Asm,
                //        InstallUtils.RegFreeModeEnum.kVersionDep,
                //        "Inventor 2012"));
            }
            catch (InstallException ex)
            {
                throw new InstallException(ex.Message);
            }
            catch
            {
                throw new InstallException("Error installing addin!");
            }
        }
Exemplo n.º 3
0
        public override void Uninstall(IDictionary savedState)
        {
            try
            {
                InstallUtils.InstallModeEnum installMode =
                    (InstallUtils.InstallModeEnum)savedState["InstallMode"];

                string pathToAddinFile;

                switch (installMode)
                {
                case InstallUtils.InstallModeEnum.kRegistryFree:
                    pathToAddinFile = (string)savedState["PathToAddinFile"];
                    InstallUtils.UninstallRegistryFree(savedState, pathToAddinFile);
                    break;

                case InstallUtils.InstallModeEnum.kRegistry:
                    InstallUtils.UninstallRegistry(savedState, GetType().Assembly);
                    break;

                case InstallUtils.InstallModeEnum.kBoth:
                    InstallUtils.UninstallRegistry(savedState, GetType().Assembly);
                    pathToAddinFile = (string)savedState["PathToAddinFile"];
                    InstallUtils.UninstallRegistryFree(savedState, pathToAddinFile);
                    break;

                default:
                    break;
                }
            }
            catch
            {
            }

            base.Uninstall(savedState);
        }
Exemplo n.º 4
0
        public override void Install(IDictionary stateSaver)
        {
            try
            {
                base.Install(stateSaver);

                InstallUtils.InstallModeEnum installMode = InstallUtils.InstallModeEnum.kRegistryFree;

                Assembly Asm     = Assembly.GetExecutingAssembly();
                FileInfo asmFile = new FileInfo(Asm.Location);

                stateSaver.Add("InstallMode", (int)installMode);

                switch (installMode)
                {
                case InstallUtils.InstallModeEnum.kRegistryFree:

                    stateSaver.Add("PathToAddinFile",
                                   InstallUtils.InstallRegistryFree(
                                       stateSaver,
                                       Asm,
                                       InstallUtils.RegFreeModeEnum.kVersionIndep,
                                       string.Empty));

                    // Example for version dependent

                    //stateSaver.Add("PathToAddinFile",
                    //    InstallUtils.InstallRegistryFree(
                    //        stateSaver,
                    //        Asm,
                    //        InstallUtils.RegFreeMode.kVersionDep,
                    //        "Inventor 2012"));

                    break;

                case InstallUtils.InstallModeEnum.kRegistry:

                    InstallUtils.InstallRegistry(stateSaver, GetType().Assembly);
                    break;

                case InstallUtils.InstallModeEnum.kBoth:

                    InstallUtils.InstallRegistry(stateSaver, GetType().Assembly);

                    //Only value that works for kBoth install mode is kUserOverride
                    stateSaver.Add("PathToAddinFile",
                                   InstallUtils.InstallRegistryFree(
                                       stateSaver,
                                       Asm,
                                       InstallUtils.RegFreeModeEnum.kUserOverride,
                                       "Inventor 2012"));
                    break;

                default:
                    break;
                }
            }
            catch (InstallException ex)
            {
                throw new InstallException(ex.Message);
            }
            catch
            {
                throw new InstallException("Error installing addin!");
            }
        }