Пример #1
0
        public static bool Set(NSJSObject obj, object value)
        {
            if (obj == null)
            {
                return(false);
            }
            NSJSVirtualMachine machine            = obj.VirtualMachine;
            ConcurrentDictionary <int, object> dd = GetTable(machine);

            lock (dd)
            {
                int key = GetObjectIdentity(obj);
                if (dd.ContainsKey(key))
                {
                    dd[key] = value;
                }
                else
                {
                    key = GetObjectIdentity(dd);
                    dd.TryAdd(key, value);
                    obj.Set(RUNTIME_OBJECTID_PROPERTYKEY, key);
                }
                return(true);
            }
        }
Пример #2
0
        public virtual bool Extension(string key, NSJSValue value)
        {
            if (key == null)
            {
                throw new ArgumentNullException("The extension parameter key is not allowed to be null");
            }
            if (key.Length <= 0)
            {
                throw new ArgumentNullException("The extension parameter key is not allowed to be empty");
            }
            NSJSObject global = this.Global;

            return(global.Set(key, value));
        }
Пример #3
0
        public virtual void SetValue(Type type, string key, object value)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (key.Length <= 0)
            {
                throw new ArgumentException("key");
            }
            NSJSObject owner = this.Value as NSJSObject;

            if (owner != null)
            {
                NSJSVirtualMachine machine = owner.VirtualMachine;
                owner.Set(key, this.ToValue(machine, value));
            }
        }