com.alachisoft.ncache.ncactivate.utils.EnvironmentUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nc-activate Show documentation
Show all versions of nc-activate Show documentation
internal package of Alachisoft.
/*
* 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