예제 #1
0
        public override void Set(string name, DWSValue value)
        {
            int index;

            if (!int.TryParse(name, out index))
            {
                throw new ArgumentOutOfRangeException("name");
            }

            GetNativeValue().SetElementByIndex(index, value.GetNativeValue());
        }
예제 #2
0
        public DWSElement(DWSValue value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }


            _name  = value.GetNativeValue().GetValueAsString();
            _value = (int)value.GetNativeValue().GetValueAsInt64();
        }
예제 #3
0
 public object this[int index]
 {
     get
     {
         return(new DWSValue(GetNativeValue().GetElementByIndex(index)).Value);
     }
     set
     {
         var self = this.GetNativeValue();
         var v    = new DWSValue(self.GetProgramInfo().CreateTypedValue(self.GetElementsTypeName()));
         v.Value = value;
         self.SetElementByIndex(index, v.GetNativeValue());
     }
 }
예제 #4
0
 protected virtual int Callback(IDWSProgramInfo comObj)
 {
     try
     {
         var args    = new DWSValue[this.Args.Count];
         var argDefs = this.Args;
         for (int i = argDefs.Count - 1; i >= 0; i--)
         {
             args[i] = new DWSValue(comObj.GetVariable(argDefs[i].Name));
         }
         object rv = _callback.DynamicInvoke(new DWSProgramContext(comObj), args);
         if (this.ReturnTypeName != null)
         {
             var result = new DWSValue(comObj.CreateTypedValue(this.ReturnTypeName));
             result.Value = rv;
             comObj.SetResultValue(result.GetNativeValue());
         }
     }
     catch (Exception ex)
     {
         return(Marshal.GetHRForException(ex.InnerException ?? ex));
     }
     return(0);
 }
예제 #5
0
 public DWSArray(DWSValue value)
     : base(value.GetNativeValue())
 {
 }
예제 #6
0
 public virtual void Set(string name, DWSValue value)
 {
     _value.SetField(name, value.GetNativeValue());
 }