private static void GetHostAddresses(IntPtr info) { NSJSFunctionCallbackInfo arguments = NSJSFunctionCallbackInfo.From(info); string hostNameOrAddress = arguments.Length > 0 ? (arguments[0] as NSJSString)?.Value : null; try { if (hostNameOrAddress == null) { Throwable.ArgumentNullException(arguments.VirtualMachine); } else if (hostNameOrAddress.Length <= 0) { Throwable.ArgumentException(arguments.VirtualMachine); } else { IPAddress[] addresses = DNS.GetHostAddresses(hostNameOrAddress); arguments.SetReturnValue(ArrayAuxiliary.ToArray(arguments.VirtualMachine, addresses)); } } catch (Exception e) { Throwable.Exception(arguments.VirtualMachine, e); } }
private static void GetHostName(IntPtr info) { NSJSFunctionCallbackInfo arguments = NSJSFunctionCallbackInfo.From(info); try { arguments.SetReturnValue(DNS.GetHostName()); } catch (Exception e) { Throwable.Exception(arguments.VirtualMachine, e); } }