Exemple #1
0
        /// <summary>
        /// Returns a string representing this object.
        /// </summary>
        /// <returns> A string representing this object. </returns>
        public override string ToString()
        {
            // Try calling WrappedInstance.join().
            object result;

            if (WrappedInstance.TryCallMemberFunction(out result, "join") == true)
            {
                return(TypeConverter.ToString(result));
            }

            // Otherwise, use the default Object.prototype.toString() method.
            return(ObjectInstance.ToStringJS(Engine, WrappedInstance));
        }
 private void ProcessRemoteCall(string methodName, int id, object[] parameters)
 {
     _methodProcessingQueue.QWork("Call " + methodName, () => {
         MethodInfo method = WrappedInstance.GetType().GetMethod(methodName, GetTypes(parameters));
         if (method.ReturnParameter.Equals(typeof(void)))
         {
             method.Invoke(WrappedInstance, parameters);
         }
         else
         {
             _returnValues.Add(id, method.Invoke(WrappedInstance, parameters));
         }
     });
 }
 /// <summary>
 /// Indicates whether the array index exists (has a value).
 /// </summary>
 /// <param name="index"> The index to check. </param>
 /// <returns> <c>true</c> if the index exists, <c>false</c> otherwise. </returns>
 public override bool HasProperty(int index)
 {
     return(WrappedInstance.HasProperty(index.ToString()));
 }
 /// <summary>
 /// Deletes the value at the given array index, throwing an exception on error.
 /// </summary>
 /// <param name="index"> The array index to delete. </param>
 public override void Delete(int index)
 {
     WrappedInstance.Delete((uint)index, true);
 }
 /// <summary>
 /// Removes the first occurrence of a specific object from the
 /// <see cref="ICollection{T}"/>.
 /// </summary>
 ///
 /// <returns>
 /// true if item was successfully removed from the <see cref="IList{T}"/>;
 /// otherwise, false. This method also returns false if item is not found
 /// in the original <see cref="IList{T}"/>.
 /// </returns>
 ///
 /// <param name="item">
 /// The object to remove from the <see cref="IList{T}"/>.
 /// </param>
 /// <exception cref="NotSupportedException">
 /// The <see cref="ListWrapper{T}.WrappedInstance"/> is read-only.
 /// </exception>
 /// <exception cref="InstanceSealedException">
 /// When <see cref="IsSealed"/> is <see langword="true"/>.
 /// </exception>
 public override bool Remove(T item)
 {
     FailIfSealed();
     return(WrappedInstance.Remove(item));
 }
 /// <summary>
 /// Removes the <see cref="IList{T}"/> item at the specified index.
 /// </summary>
 ///
 /// <param name="index">
 /// The zero-based index of the item to remove.</param>
 /// <exception cref="NotSupportedException">
 /// The <see cref="ListWrapper{T}.WrappedInstance"/> is read-only.
 /// </exception>
 /// <exception cref="InstanceSealedException">
 /// When <see cref="IsSealed"/> is <see langword="true"/>.
 /// </exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// index is not a valid index in the <see cref="IList{T}"/>.
 /// </exception>
 public override void RemoveAt(int index)
 {
     FailIfSealed();
     WrappedInstance.RemoveAt(index);
 }
 /// <summary>
 /// Inserts an item to the <see cref="IList{T}"/> at the specified index.
 /// </summary>
 ///
 /// <param name="item">
 /// The object to insert into the <see cref="IList{T}"/>.</param>
 /// <param name="index">
 /// The zero-based index at which item should be inserted.</param>
 /// <exception cref="NotSupportedException">
 /// The <see cref="ListWrapper{T}.WrappedInstance"/> is read-only.
 /// </exception>
 /// <exception cref="InstanceSealedException">
 /// When <see cref="IsSealed"/> is <see langword="true"/>.
 /// </exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// index is not a valid index in the <see cref="IList{T}"/>.
 /// </exception>
 public override void Insert(int index, T item)
 {
     FailIfSealed();
     WrappedInstance.Insert(index, item);
 }
 /// <summary>
 /// Removes all items from the <see cref="ICollection{T}"/>.
 /// </summary>
 ///
 /// <exception cref="NotSupportedException">
 /// The <see cref="ListWrapper{T}.WrappedInstance"/> is read-only.
 /// </exception>
 /// <exception cref="InstanceSealedException">
 /// When <see cref="IsSealed"/> is <see langword="true"/>.
 /// </exception>
 public override void Clear()
 {
     FailIfSealed();
     WrappedInstance.Clear();
 }
 /// <summary>
 /// Adds an item to the <see cref="ICollection{T}"/>.
 /// </summary>
 ///
 /// <param name="item">
 /// The object to add to the <see cref="ICollection{T}"/>.
 /// </param>
 /// <exception cref="NotSupportedException">
 /// The <see cref="ListWrapper{T}.WrappedInstance"/> is read-only.
 /// </exception>
 /// <exception cref="InstanceSealedException">
 /// When <see cref="IsSealed"/> is <see langword="true"/>.
 /// </exception>
 public override void Add(T item)
 {
     FailIfSealed();
     WrappedInstance.Add(item);
 }
 public override object ReportMethodCallReturn(string methodName, object[] parameters)
 {
     return(WrappedInstance.GetType().GetMethod(methodName, GetTypes(parameters)).Invoke(WrappedInstance, parameters));
 }
 public override void ReportMethodCallVoid(string methodName, object[] parameters)
 {
     WrappedInstance.GetType().GetMethod(methodName, GetTypes(parameters)).Invoke(WrappedInstance, parameters);
 }