All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alachisoft.ncache.ncactivate.utils.EnvironmentUtil Maven / Gradle / Ivy

There is a newer version: 5.3.3
Show newest version
/*
 * EnvironmentUtil.java
 *
 * Created on October 7, 2006, 3:49 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.alachisoft.ncache.ncactivate.utils;

import com.alachisoft.ncache.ncactivate.license.NetworkInfo;
import com.alachisoft.ncache.runtime.util.RuntimeUtil;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;

/**
 * @author Administrator
 */
public class EnvironmentUtil {

    /**
     * Creates a new instance of EnvironmentUtil
     */
    public EnvironmentUtil() {
    }

    public static String getComputerName() {
        String hostName = "";
        try {
            hostName = InetAddress.getLocalHost().getHostName();
        } catch (UnknownHostException unhe) {

        }
        return hostName;
    }

    public static int GetProcessorsCount() {
        Runtime rt = Runtime.getRuntime();
        return rt.availableProcessors();
    }
    public static ArrayList GetAdaptersInfo() throws IOException {
        return NetworkInfo.getMacAddress();
    }

    public static String NewGUID() {
        GUID myGUID = new GUID();
        return myGUID.toString();
    }

    public static int GetAdapter(ArrayList adapters, String adapterFound) {
        for (int i = 0; i < adapters.size(); i++) {
            String adapter = (String) adapters.get(i);
            if (adapter.compareToIgnoreCase(adapterFound) == 0)
                return i;
        }
        return -1;
    }
}






© 2015 - 2024 Weber Informatics LLC | Privacy Policy