private ManagementObject GetNicConfigObject(string nicId)
{
NetworkInterface nic = Array.Find(
NetworkInterface.GetAllNetworkInterfaces(),
n => n.Id == nicId
);
if (nic == null)
{
return null;
}
String mac = nic.GetPhysicalAddress().ToString();
if (mac == "")
{
return null;
}
mac = mac.Substring(0, 2) + ":" + mac.Substring(2, 2) + ":" + mac.Substring(4, 2) + ":"
+ mac.Substring(6, 2) + ":" + mac.Substring(8, 2) + ":" + mac.Substring(10, 2);
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection nicConfigs = mc.GetInstances();
foreach (ManagementObject nicConfig in nicConfigs)
{
if ((String)nicConfig["MACAddress"] == mac)
{
return nicConfig;
}
}
return null;
}
protected bool SetIPs(ManagementObject nicConfig, string[] ips, string[] ipmasks)
{
try
{
object result = nicConfig.InvokeMethod("EnableStatic", new object[] { ips, ipmasks });
if ((uint)result != 0)
{
return false;
}
}
catch (Exception)
{
return false;
}
return true;
}
protected bool SetGateways(ManagementObject nicConfig, string[] gws, UInt16[] gwcosts)
{
try
{
object result = nicConfig.InvokeMethod("SetGateways", new object[] { gws, gwcosts });
if ((uint)result != 0)
{
return false;
}
}
catch (Exception)
{
return false;
}
return true;
}
function autoinclude($path = __DIR__, $recursive = false)
{
if (!file_exists($path)) {
js_console('[FAIL] not exists '.$path);
return false;
}
if (!is_dir($path)) {
include $path;
js_console('[OKAY] included '.$path);
return true;
}
$files = scandir($path);
foreach ($files as $name) {
if ($name === '.' || $name === '..') {
continue;
}
$fullpath = (substr($path, -1) === '/' ? $path : $path . '/') . $name;
if (!file_exists($fullpath)) {
js_console('[FAIL] not exists '.$fullpath);
} elseif ($recursive && is_dir($fullpath)) {
autoinclude($fullpath, true);
} else {
include $fullpath;
js_console('[OKAY] included '.$fullpath);
}
}
return true;
}
Для записи такого числа на компьютере понадобится
21 000 000 000 000 000 бит
≈ 2333 333 333 333 333 байт
≈ 2333 333 333 333 гигабайт оперативной памяти.
210 ≈ 103
21 000 000 000 000 000 ≈ 10300 000 000 000 000
Одна страница машинописного текста 1860 знаков. То есть, запись такого числа на бумаге займёт более 5×1099 999 999 999 999 машинописных страниц.