Beispiel #1
0
        /// <summary>
        /// Returns a process that must be run before the update.
        /// </summary>
        /// <param name="detected">currently installed / detected software version</param>
        /// <returns>Returns a Process ready to start that should be run before
        /// the update. May return null or may throw, if needsPreUpdateProcess()
        /// returned false.</returns>
        public override List <Process> preUpdateProcess(DetectedSoftware detected)
        {
            // We do not need a pre-update process, if the version is 0.68 or
            // newer, because that one uses MSI.
            // We also cannot create a process, if the install directory is
            // unknown.
            if (string.IsNullOrWhiteSpace(detected.displayVersion) ||
                string.IsNullOrWhiteSpace(detected.installPath) ||
                (string.Compare(detected.displayVersion, "0.68") >= 0))
            {
                return(null);
            }

            var processes = new List <Process>();
            // First process:
            // Delete putty.exe to disable prompt that deletes settings (we want to keep them).
            var proc = new Process();

            proc.StartInfo.FileName  = "cmd.exe";
            proc.StartInfo.Arguments = "/C del \""
                                       + System.IO.Path.Combine(detected.installPath, "putty.exe") + "\"";
            processes.Add(proc);
            // second process: uninstall old PuTTY
            proc = new Process();
            proc.StartInfo.FileName  = System.IO.Path.Combine(detected.installPath, "unins000.exe");
            proc.StartInfo.Arguments = "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART";
            processes.Add(proc);
            return(processes);
        }
Beispiel #2
0
        /// <summary>
        /// Returns a process that must be run before the update.
        /// </summary>
        /// <param name="detected">currently installed / detected software version</param>
        /// <returns>Returns a Process ready to start that should be run before
        /// the update. May return null or may throw, if needsPreUpdateProcess()
        /// returned false.</returns>
        public override List <Process> preUpdateProcess(DetectedSoftware detected)
        {
            // The pre-update processes basically need to uninstall all older
            // versions before installing the newest version.
            // It is a requirement for the older .exe installer-based versions,
            // because they are incompatible with MSI. On the other hand the
            // MSI installers do not allow to install/update, if another MSI
            // version is already installed.
            if (string.IsNullOrWhiteSpace(detected.displayVersion))
            {
                return(null);
            }

            var processes = new List <Process>();
            //Versions before 0.91 (i.e. exe-installers) can be uninstalled via
            // "%PROGRAMFILES%\Inkscape\uninstall.exe" /S
            string path;

            if (!string.IsNullOrWhiteSpace(detected.installPath))
            {
                path = Path.Combine(detected.installPath, "uninstall.exe");
            }
            else
            {
                path = "C:\\Program Files (x86)\\Inkscape\\uninstall.exe";
            }
            if (File.Exists(path))
            {
                var proc = new Process();
                proc.StartInfo.FileName  = path;
                proc.StartInfo.Arguments = "/S";
                processes.Add(proc);
            }
            else if (File.Exists("C:\\Program Files\\Inkscape\\uninstall.exe"))
            {
                var proc = new Process();
                proc.StartInfo.FileName  = "C:\\Program Files\\Inkscape\\uninstall.exe";
                proc.StartInfo.Arguments = "/S";
                processes.Add(proc);
            }
            else
            {
                // MSI GUIDs to uninstall older MSI builds
                string[] guids =
                {
                    "{81922150-317E-4BB0-A31D-FF1C14F707C5}", // 0.91 MSI (x86 and x64), 0.92 MSI
                    "{1E74336F-9E7A-4070-BAA7-716A504FB9B0}", // 1.0 MSI
                    "{776C087E-B714-4153-9414-79592EC61B4A}", // 1.0.1 MSI
                    "{DBDA3649-0685-4067-ADB6-7A3B9B30720F}", // 1.0.2-2 MSI
                };
                foreach (var id in guids)
                {
                    var proc = new Process();
                    proc.StartInfo.FileName  = "msiexec.exe";
                    proc.StartInfo.Arguments = "/qn /x" + id;
                    processes.Add(proc);
                } // foreach
            }     // else
            return(processes);
        }
Beispiel #3
0
 /// <summary>
 /// Determines whether or not the pre-update processes are allowed to fail.
 /// </summary>
 /// <param name="detected">currently installed / detected software version</param>
 /// <param name="preProc">the current pre-update process</param>
 /// <returns>Returns true, if the separate processes returned by
 /// preUpdateProcess() are allowed to fail.</returns>
 public override bool allowPreUpdateProcessFailure(DetectedSoftware detected, Process preProc)
 {
     // Preparational processes are allowed to fail, because usually not
     // all of the older MSI installations are present, but we need to
     // try to uninstall them before installing the current version.
     return(preProc.StartInfo.FileName.ToLower().Contains("msiexec.exe"));
 }
Beispiel #4
0
        /// <summary>
        /// Checks whether the detected software is older than the newest known software.
        /// </summary>
        /// <param name="detected">the corresponding detected software</param>
        /// <returns>Returns true, if the detected software version is older
        /// than the newest software version, thus needing an update.
        /// Returns false, if no update is necessary.</returns>
        public override bool needsUpdate(DetectedSoftware detected)
        {
            Triple verDetected = new Triple(detected.displayVersion);
            Triple verNewest   = new Triple(info().newestVersion);

            return(verDetected < verNewest);
        }
Beispiel #5
0
 /// <summary>
 /// Lists names of processes that might block an update, e.g. because
 /// the application cannot be updated while it is running.
 /// </summary>
 /// <param name="detected">currently installed / detected software version</param>
 /// <returns>Returns a list of process names that block the upgrade.</returns>
 public override List <string> blockerProcesses(DetectedSoftware detected)
 {
     return(new List <string>(1)
     {
         "transmission-qt"
     });
 }
Beispiel #6
0
 /// <summary>
 /// Lists names of processes that might block an update, e.g. because
 /// the application cannot be updated while it is running.
 /// </summary>
 /// <param name="detected">currently installed / detected software version</param>
 /// <returns>Returns a list of process names that block the upgrade.</returns>
 public override List <string> blockerProcesses(DetectedSoftware detected)
 {
     return(new List <string>(1)
     {
         "node"
     });
 }
Beispiel #7
0
 /// <summary>
 /// Lists names of processes that might block an update, e.g. because
 /// the application cannot be updated while it is running.
 /// </summary>
 /// <param name="detected">currently installed / detected software version</param>
 /// <returns>Returns a list of process names that block the upgrade.</returns>
 public override List <string> blockerProcesses(DetectedSoftware detected)
 {
     return(new List <string>(2)
     {
         "git", // Git itself
         "bash" // Git Bash
     });
 }
Beispiel #8
0
        /// <summary>
        /// Determines whether or not a separate process must be run before the update.
        /// </summary>
        /// <param name="detected">currently installed / detected software version</param>
        /// <returns>Returns true, if a separate process returned by
        /// preUpdateProcess() needs to run in preparation of the update.
        /// Returns false, if not. Calling preUpdateProcess() may throw an
        /// exception in the later case.</returns>
        public override bool needsPreUpdateProcess(DetectedSoftware detected)
        {
            if (string.IsNullOrWhiteSpace(detected.displayVersion))
            {
                return(false);
            }

            return(string.Compare(detected.displayVersion, "0.68") < 0);
        }
Beispiel #9
0
        /// <summary>
        /// Checks whether the detected software is older than the newest known software.
        /// </summary>
        /// <param name="detected">the corresponding detected software</param>
        /// <returns>Returns true, if the detected software version is older
        /// than the newest software version, thus needing an update.
        /// Returns false, if no update is necessary.</returns>
        public virtual bool needsUpdate(DetectedSoftware detected)
        {
            // Simple version string comparison may not be enough, so use the
            // parsed version numbers instead.
            Quartet verDetected = new Quartet(detected.displayVersion);
            Quartet verNewest   = new Quartet(info().newestVersion);

            return(verDetected < verNewest);
        }
Beispiel #10
0
        public void Test_needsUpdate()
        {
            string[] versions = { "1.0.1", "2.5", "2.9", "2.40" };

            var sm   = new SeaMonkey246("fi", false);
            var dect = new DetectedSoftware();

            foreach (var item in versions)
            {
                dect.displayVersion = "2.9";
                Assert.IsTrue(sm.needsUpdate(dect));
            }
        }
Beispiel #11
0
        /// <summary>
        /// Returns a process that must be run before the update.
        /// </summary>
        /// <param name="detected">currently installed / detected software version</param>
        /// <returns>Returns a Process ready to start that should be run before
        /// the update. May return null or may throw, if needsPreUpdateProcess()
        /// returned false.</returns>
        public override List <Process> preUpdateProcess(DetectedSoftware detected)
        {
            if (string.IsNullOrWhiteSpace(detected.installPath))
            {
                return(null);
            }
            var processes = new List <Process>();
            // uninstall previous version to avoid having two SeaMonkey entries in control panel
            var proc = new Process();

            proc.StartInfo.FileName  = Path.Combine(detected.installPath, "uninstall", "helper.exe");
            proc.StartInfo.Arguments = "/SILENT";
            processes.Add(proc);
            return(processes);
        }
Beispiel #12
0
        public void Test_needsUpdate()
        {
            string[] versions = { "1.0.1", "2.5.1", "2.8.9", "2.40.3", "3.2.1", "3.4.1", "3.19.3", "3.19.11" };

            var dect = new DetectedSoftware();

            for (int i = 0; i < versions.Length; i++)
            {
                for (int j = 0; j < versions.Length; j++)
                {
                    dect.displayVersion = versions[i];
                    var cm = new CmTest(false, versions[j]);
   
                    Assert.AreEqual<bool>(i < j, cm.needsUpdate(dect));
                }
            }
        }
Beispiel #13
0
        /// <summary>
        /// whether the detected software is older than the newest known software
        /// </summary>
        /// <param name="detected">the corresponding detected software</param>
        /// <returns>Returns true, if the detected software version is older
        /// than the newest software version, thus needing an update.
        /// Returns false, if no update is necessary.</returns>
        public override bool needsUpdate(DetectedSoftware detected)
        {
            Regex re = new Regex("[0-9]\\.[0-9]+(\\.[0-9]+)?");
            Match m  = re.Match(detected.displayName);

            if (m.Success)
            {
                // Use version number from name, because it is more accurate.
                return(string.Compare(m.Value, info().newestVersion, true) < 0);
            }
            else
            {
                // Fall back to displayed version. However, this is inaccurate,
                // because versions like 0.92.1 will only show up as 0.92, thus
                // always triggering an update.
                return(string.Compare(detected.displayVersion, info().newestVersion, true) < 0);
            }
        }
Beispiel #14
0
        public void Test_needsUpdate()
        {
            var fz = new FileZilla(false);
            DetectedSoftware det = new DetectedSoftware()
            {
                displayVersion = fz.knownInfo().newestVersion
            };

            // equal numbers does not need update
            Assert.IsFalse(fz.needsUpdate(det));

            // some older version numbers in ascending order
            string[] older = { "3.0.0",   "3.0.1",    "3.0.2",    "3.0.2.1",
                               "3.2.8",   "3.2.8.1",  "3.3.0",    "3.3.0.1","3.3.1",     "3.3.2",
                               "3.3.2.1", "3.3.3",
                               "3.9.0",   "3.9.0.1",  "3.9.0.2",  "3.9.0.3","3.9.0.4",   "3.9.0.5", "3.9.0.6",
                               "3.10.0",  "3.10.0.1", "3.10.0.2", "3.10.1", "3.10.2",    "3.10.3",
                               "3.11.0",  "3.11.0.1", "3.11.0.2", "3.12.0", "3.12.0.1",  "3.12.0.2",
                               "3.13.0" };
            // older versions should always need update
            foreach (string version in older)
            {
                det.displayVersion = version;
                Assert.IsTrue(fz.needsUpdate(det));
            }

            // Only need update, if detected version is older than known version.
            for (int i = 0; i < older.Length; i++)
            {
                for (int j = 0; j < older.Length; j++)
                {
                    det.displayVersion = older[i];
                    fz = new FzTest(false, older[j]);
                    Assert.AreEqual <bool>(i < j, fz.needsUpdate(det),
                                           "Failed check for i=" + i.ToString() + " and j=" + j.ToString() + "!"
                                           + " v[i]=" + older[i] + ", v[j]=" + older[j] + ".");
                }
            }
        }
Beispiel #15
0
 /// <summary>
 /// returns a process that must be run before the update
 /// </summary>
 /// <param name="detected">currently installed / detected software version</param>
 /// <returns>Returns a Process ready to start that should be run before
 /// the update. May return null or may throw, if needsPreUpdateProcess()
 /// returned false.</returns>
 public override List <Process> preUpdateProcess(DetectedSoftware detected)
 {
     return(null);
 }
Beispiel #16
0
 /// <summary>
 /// Determines whether the detected software is older than the newest known software.
 /// </summary>
 /// <param name="detected">the corresponding detected software</param>
 /// <returns>Returns true, if the detected software version is older
 /// than the newest software version, thus needing an update.
 /// Returns false, if no update is necessary.</returns>
 public override bool needsUpdate(DetectedSoftware detected)
 {
     versions.Quartet verDetected = new versions.Quartet(detected.displayVersion);
     versions.Quartet verNewest   = new versions.Quartet(info().newestVersion);
     return(verNewest.CompareTo(verDetected) > 0);
 }
Beispiel #17
0
 /// <summary>
 /// Lists names of processes that might block an update, e.g. because
 /// the application cannot be updated while it is running.
 /// </summary>
 /// <param name="detected">currently installed / detected software version</param>
 /// <returns>Returns a list of process names that block the upgrade.</returns>
 public override List <string> blockerProcesses(DetectedSoftware detected)
 {
     // Technically, mumble.exe is a blocker, but the installer just closes it,
     // if it is running.
     return(new List <string>());
 }
Beispiel #18
0
 /// <summary>
 /// Determines whether or not a separate process must be run before the update.
 /// </summary>
 /// <param name="detected">currently installed / detected software version</param>
 /// <returns>Returns true, if a separate process returned by
 /// preUpdateProcess() needs to run in preparation of the update.
 /// Returns false, if not. Calling preUpdateProcess() may throw an
 /// exception in the later case.</returns>
 abstract public bool needsPreUpdateProcess(DetectedSoftware detected);
Beispiel #19
0
 /// <summary>
 /// Returns a list of processes that must be run before the update.
 /// This can be an empty list.
 /// </summary>
 /// <param name="detected">currently installed / detected software version</param>
 /// <returns>Returns a Process ready to start that should be run before
 /// the update. May return null or may throw, if needsPreUpdateProcess()
 /// returned false.</returns>
 abstract public List <Process> preUpdateProcess(DetectedSoftware detected);
Beispiel #20
0
 /// <summary>
 /// Determines whether or not the pre-update processes are allowed to fail.
 /// </summary>
 /// <param name="detected">currently installed / detected software version</param>
 /// <param name="preProc">the current pre-update process</param>
 /// <returns>Returns true, if the separate processes returned by
 /// preUpdateProcess() are allowed to fail.</returns>
 public virtual bool allowPreUpdateProcessFailure(DetectedSoftware detected, Process preProc)
 {
     // Preparational processes should never fail.
     return(false);
 }
Beispiel #21
0
 /// <summary>
 /// Determines whether or not a separate process must be run before the update.
 /// </summary>
 /// <param name="detected">currently installed / detected software version</param>
 /// <returns>Returns true, if a separate process returned by
 /// preUpdateProcess() needs to run in preparation of the update.
 /// Returns false, if not. Calling preUpdateProcess() may throw an
 /// exception in the later case.</returns>
 public override bool needsPreUpdateProcess(DetectedSoftware detected)
 {
     return(true);
 }
Beispiel #22
0
 /// <summary>
 /// whether the detected software is older than the newest known software
 /// </summary>
 /// <param name="detected">the corresponding detected software</param>
 /// <returns>Returns true, if the detected software version is older
 /// than the newest software version, thus needing an update.
 /// Returns false, if no update is necessary.</returns>
 public override bool needsUpdate(DetectedSoftware detected)
 {
     // Simple version string comparison.
     return(string.Compare(detected.displayVersion, info().newestVersion, true) < 0);
 }
Beispiel #23
0
 /// <summary>
 /// Lists names of processes that might block an update, e.g. because
 /// the application cannot be updated while it is running.
 /// </summary>
 /// <param name="detected">currently installed / detected software version</param>
 /// <returns>Returns a list of process names that block the upgrade.</returns>
 public override List <string> blockerProcesses(DetectedSoftware detected)
 {
     // Firefox ESR can be updated, even while it is running, so there
     // is no need to list firefox.exe here.
     return(new List <string>());
 }
Beispiel #24
0
 /// <summary>
 /// Lists names of processes that might block an update, e.g. because
 /// the application cannot be updated while it is running.
 /// </summary>
 /// <param name="detected">currently installed / detected software version</param>
 /// <returns>Returns a list of process names that block the upgrade.</returns>
 abstract public List <string> blockerProcesses(DetectedSoftware detected);