Beispiel #1
0
        protected override void OnBeforeUninstall(IDictionary savedState)
        {
            string installationProg = this.Context.Parameters["assemblypath"];
            string installationPath = installationProg.Replace("CustomSetup.dll", "");

            //Microsoft.VisualBasic.FileIO.FileSystem.DeleteDirectory(installationPath, Microsoft.VisualBasic.FileIO.DeleteDirectoryOption.DeleteAllContents);
            Directory.GetFiles(installationPath, "*.txt").ToList().ForEach(q => File.Delete(q));
            Directory.GetFiles(installationPath, "*.bin").ToList().ForEach(q => File.Delete(q));
            Directory.GetFiles(installationPath, "*.jpeg").ToList().ForEach(q => File.Delete(q));
            Directory.GetFiles(installationPath, "*.jp2").ToList().ForEach(q => File.Delete(q));

            Prereq p   = new Prereq();
            string msg = string.Empty;
            bool   res = p.FirewallRuleExists(ref msg);

            if (res == true)
            {
                msg = string.Empty;
                res = p.RemoveFirewallRules(ref msg);
                if (!res)
                {
                    MessageBox.Show("Couldn't remove firewall rules for PassportService" + Environment.NewLine + "Uninstallation will fail,try to remove it manually and then try again" + Environment.NewLine + msg);
                }
            }

            base.OnBeforeUninstall(savedState);
        }
Beispiel #2
0
        protected override void OnBeforeInstall(IDictionary savedState)
        {
            //check Java
            Prereq p         = new Prereq();
            string msg       = string.Empty;
            bool   JavaCheck = p.CheckJavaPrerequisite(ref msg);

            if (!JavaCheck)
            {
                throw new InstallException("No Java installed" + Environment.NewLine + @"Check https://github.com/kansasdev for instructions");
            }
            else
            {
                bool pythonCheck = p.CheckPythonForSetup(ref msg);
                if (pythonCheck)
                {
                    base.OnBeforeInstall(savedState);
                }
                else
                {
                    throw new InstallException("No Python with Tesseract and PassportEye installed" + Environment.NewLine + msg + Environment.NewLine + @"Check https://github.com/kansasdev for instructions");
                }
            }
        }