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()); }
public DWSElement(DWSValue value) { if (value == null) { throw new ArgumentNullException("value"); } _name = value.GetNativeValue().GetValueAsString(); _value = (int)value.GetNativeValue().GetValueAsInt64(); }
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()); } }
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); }
public DWSArray(DWSValue value) : base(value.GetNativeValue()) { }
public virtual void Set(string name, DWSValue value) { _value.SetField(name, value.GetNativeValue()); }