Example #1
0
        public virtual bool Set(string key, DateTime value)
        {
            if (NSJSDateTime.Invalid(value))
            {
                throw new ArgumentNullException("Parameter cannot be an invalid time");
            }
            long time = NSJSDateTime.DateTimeToLocalDate(value);

            return(this.Set(key, (name) => nsjs_localvalue_object_property_set_datetime(this.Isolate, this.Handle, name, time)));
        }
Example #2
0
 public static bool operator ==(NSJSDateTime x, DateTime y)
 {
     long ticks = NSJSDateTime.DateTimeToLocalDate(y);
     if (x == null)
     {
         return ticks == 0;
     }
     else if (ticks < 0)
     {
         return false;
     }
     return unchecked(x.Value == y);
 }
Example #3
0
 public static NSJSDateTime New(NSJSVirtualMachine machine, DateTime value)
 {
     if (NSJSDateTime.Invalid(value))
     {
         throw new ArgumentOutOfRangeException("Parameter cannot be an invalid time");
     }
     if (machine == null)
     {
         throw new ArgumentNullException("machine");
     }
     IntPtr isolate = machine.Isolate;
     if (isolate == NULL)
     {
         throw new InvalidOperationException("machine");
     }
     long time = NSJSDateTime.DateTimeToLocalDate(value);
     IntPtr handle = nsjs_localvalue_datetime_new(isolate, time);
     if (handle == NULL)
     {
         throw new InvalidOperationException("machine");
     }
     return new NSJSDateTime(handle, machine);
 }