private static void MoveOrCopy(IntPtr info, bool copyMode) { NSJSFunctionCallbackInfo arguments = NSJSFunctionCallbackInfo.From(info); bool success = false; Exception exception = null; do { if (arguments.Length <= 0) { break; } NSJSString sourceFileName = arguments[0] as NSJSString; NSJSString destFileName = arguments[1] as NSJSString; if (sourceFileName == null || destFileName == null) { break; } try { if (copyMode) { if (arguments.Length < 3) { FILE.Copy(sourceFileName.Value, destFileName.Value); } else { bool overwrite = ValueAuxiliary.ToBoolean(arguments[2]); FILE.Copy(sourceFileName.Value, destFileName.Value, overwrite); } } else { FILE.Move(sourceFileName.Value, destFileName.Value); } success = true; } catch (Exception e) { exception = e; success = false; } } while (false); if (exception == null) { arguments.SetReturnValue(success); } else { Throwable.Exception(arguments.VirtualMachine, exception); } }
private static void assert(IntPtr info) { NSJSFunctionCallbackInfo arguments = NSJSFunctionCallbackInfo.From(info); if (arguments.Length > 0) { bool condition = ValueAuxiliary.ToBoolean(arguments[0]); string message = ValueAuxiliary.ToString(arguments.Length > 1 ? arguments[1] : null) ?? string.Empty; string detailMessage = ValueAuxiliary.ToString(arguments.Length > 1 ? arguments[1] : null) ?? string.Empty; NSJSConsoleHandler handler = GetConsoleHandler(arguments); handler.Assert(arguments, condition, message, detailMessage); } }