<commit_before>/**
 * $Revision: $
 * $Date: $
 *
 * Copyright (C) 2006 Jive Software. All rights reserved.
 *
 * This software is published under the terms of the GNU Lesser Public License (LGPL),
 * a copy of which is included in this distribution.
 */

package org.jivesoftware;

import com.install4j.api.InstallAction;
import com.install4j.api.InstallerWizardContext;
import com.install4j.api.ProgressInterface;
import com.install4j.api.UserCanceledException;
import com.install4j.api.windows.WinRegistry;

import java.io.File;

public class Installer extends InstallAction {

    private InstallerWizardContext context;

    public int getPercentOfTotalInstallation() {
        return 0;
    }


    public boolean performAction(InstallerWizardContext installerWizardContext, ProgressInterface progressInterface) throws UserCanceledException {
        context = installerWizardContext;

        final String osName = System.getProperty("os.name").toLowerCase();
        boolean isWindows = osName.startsWith("windows");

        if (!isWindows) {
            return true;
        }

        addStartup(installerWizardContext.getInstallationDirectory());
        return true;
    }

    public void addStartup(File dir) {
        File jivec = new File(dir, "Spark.exe");
        String path = jivec.getAbsolutePath();
        WinRegistry.setValue(WinRegistry.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Spark", path);

        addURIMapping(dir);
    }

    private void addURIMapping(File dir) {
        File jivec = new File(dir, "Spark.exe");
        String path = jivec.getAbsolutePath();

        boolean exists = WinRegistry.keyExists(WinRegistry.HKEY_CLASSES_ROOT, "xmpp");
        if (exists) {
        }
        //   JOptionPane.showConfirmDialog(null, "Another application is currently registered to handle XMPP instant messaging. Make Spark the default XMPP instant messaging client?", "Confirmation",         }
        WinRegistry.deleteKey(WinRegistry.HKEY_CLASSES_ROOT, "xmpp", true);<commit_msg>SPARK-341  	 Online installer needs a minimum JRE preference of 1.5 SPARK-343  	 Spark does not handle upgrades with the online tag.<commit_after>/**
 * $Revision: $
 * $Date: $
 *
 * Copyright (C) 2006 Jive Software. All rights reserved.
 *
 * This software is published under the terms of the GNU Lesser Public License (LGPL),
 * a copy of which is included in this distribution.
 */

package org.jivesoftware;

import com.install4j.api.InstallAction;
import com.install4j.api.InstallerWizardContext;
import com.install4j.api.ProgressInterface;
import com.install4j.api.UserCanceledException;
import com.install4j.api.windows.WinRegistry;

import java.io.File;
import java.io.IOException;

public class Installer extends InstallAction {

    private InstallerWizardContext context;

    public int getPercentOfTotalInstallation() {
        return 0;
    }


    public boolean performAction(InstallerWizardContext installerWizardContext, ProgressInterface progressInterface) throws UserCanceledException {
        context = installerWizardContext;

        final String osName = System.getProperty("os.name").toLowerCase();
        boolean isWindows = osName.startsWith("windows");

        if (!isWindows) {
            return true;
        }

        addStartup(installerWizardContext.getInstallationDirectory());
        return true;
    }

    public void addStartup(File dir) {
        File jivec = new File(dir, "Spark.exe");
        try {
            String path = jivec.getCanonicalPath();
            WinRegistry.setValue(WinRegistry.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Spark", path);

            addURIMapping(dir, path);
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }

    private void addURIMapping(File dir, String path) {
        boolean exists = WinRegistry.keyExists(WinRegistry.HKEY_CLASSES_ROOT, "xmpp");
        if (exists) {
        }
        //   JOptionPane.showConfirmDialog(null, "Another application is currently registered to handle XMPP instant messaging. Make Spark the default XMPP instant messaging client?", "Confirmation",         }
        WinRegistry.deleteKey(WinRegistry.HKEY_CLASSES_ROOT, "xmpp", true);
{'fraction_non_alphanumeric': 0.09139910944457465, 'fraction_numerical': 0.0065619873447386925, 'mean_word_length': 3.346232179226069, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2480490', 'n_tokens_mistral': 1221, 'n_tokens_neox': 1165, 'n_words': 306}