Exemplo n.º 1
0
        /// <summary>
        /// Wraps the 'System.String ToString()' on the 'System.IO.Stream' type.
        /// </summary>
        /// <returns>The value returned by the underlying method.</returns>
        public override string ToString()
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.Object", "mscorlib", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "System.String ToString()");

            return(WrapperUtilities.InvokeMethodAndCast <string>(this, methodInfo, new object[] { }));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Wraps the 'Boolean Equals(System.Object)' on the 'System.IO.Stream' type.
        /// </summary>
        /// <param name="obj">The value of the 'obj' parameter.</param>
        /// <returns>The value returned by the underlying method.</returns>
        public override bool Equals(object obj)
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.Object", "mscorlib", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "Boolean Equals(System.Object)");

            return(WrapperUtilities.InvokeMethodAndCast <bool>(this, methodInfo, new object[] { obj }));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Wraps the 'Int32 Read(Byte[], Int32, Int32)' on the 'System.IO.Stream' type.
        /// </summary>
        /// <param name="buffer">The value of the 'buffer' parameter.</param>
        /// <param name="offset">The value of the 'offset' parameter.</param>
        /// <param name="count">The value of the 'count' parameter.</param>
        /// <returns>The value returned by the underlying method.</returns>
        public override int Read(byte[] buffer, int offset, int count)
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.IO.Stream", "mscorlib", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "Int32 Read(Byte[], Int32, Int32)");

            return(WrapperUtilities.InvokeMethodAndCast <int>(this, methodInfo, new object[] { buffer, offset, count }));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Wraps the 'Void Write(Byte[], Int32, Int32)' on the 'System.IO.Stream' type.
        /// </summary>
        /// <param name="buffer">The value of the 'buffer' parameter.</param>
        /// <param name="offset">The value of the 'offset' parameter.</param>
        /// <param name="count">The value of the 'count' parameter.</param>
        public override void Write(byte[] buffer, int offset, int count)
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.IO.Stream", "mscorlib", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "Void Write(Byte[], Int32, Int32)");

            WrapperUtilities.InvokeMethodWithoutResult(this, methodInfo, new object[] { buffer, offset, count });
        }
Exemplo n.º 5
0
        /// <summary>
        /// Wraps the 'Void EndWrite(System.IAsyncResult)' on the 'System.IO.Stream' type.
        /// </summary>
        /// <param name="asyncResult">The value of the 'asyncResult' parameter.</param>
        public override void EndWrite(System.IAsyncResult asyncResult)
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.IO.Stream", "mscorlib", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "Void EndWrite(System.IAsyncResult)");

            WrapperUtilities.InvokeMethodWithoutResult(this, methodInfo, new object[] { asyncResult });
        }
Exemplo n.º 6
0
        /// <summary>
        /// Wraps the 'System.IAsyncResult BeginWrite(Byte[], Int32, Int32, System.AsyncCallback, System.Object)' on the 'System.IO.Stream' type.
        /// </summary>
        /// <param name="buffer">The value of the 'buffer' parameter.</param>
        /// <param name="offset">The value of the 'offset' parameter.</param>
        /// <param name="count">The value of the 'count' parameter.</param>
        /// <param name="callback">The value of the 'callback' parameter.</param>
        /// <param name="state">The value of the 'state' parameter.</param>
        /// <returns>The value returned by the underlying method.</returns>
        public override System.IAsyncResult BeginWrite(byte[] buffer, int offset, int count, System.AsyncCallback callback, object state)
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.IO.Stream", "mscorlib", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "System.IAsyncResult BeginWrite(Byte[], Int32, Int32, System.AsyncCallback, System.Object)");

            return(WrapperUtilities.InvokeMethodAndCast <System.IAsyncResult>(this, methodInfo, new object[] { buffer, offset, count, callback, state }));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Wraps the 'System.Linq.IQueryable`1[TElement] CreateQuery[TElement](System.Linq.Expressions.Expression)' on the 'System.Linq.IQueryProvider' type.
        /// </summary>
        /// <typeparam name="TElement">The wrapper type for the 'TElement' generic parameter.</typeparam>
        /// <param name="expression">The value of the 'expression' parameter.</param>
        /// <returns>The value returned by the underlying method.</returns>
        public virtual System.Linq.IQueryable <TElement> CreateQuery <TElement>(System.Linq.Expressions.Expression expression)
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.Linq.IQueryProvider", "System.Core", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "System.Linq.IQueryable`1[TElement] CreateQuery[TElement](System.Linq.Expressions.Expression)");

            return((System.Linq.IQueryable <TElement>)ProxyFactory.CreateProxyIfPossible(this.Scope, WrapperUtilities.InvokeMethodAndCast <System.Linq.IQueryable <TElement> >(this, methodInfo, new object[] { expression }, new Type[] { typeof(TElement) }), typeof(System.Linq.IQueryable <TElement>)));
        }
Exemplo n.º 8
0
        /// <summary>
        /// Wraps the 'Void WriteByte(Byte)' on the 'System.IO.Stream' type.
        /// </summary>
        /// <param name="value">The value of the 'value' parameter.</param>
        public override void WriteByte(byte value)
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.IO.Stream", "mscorlib", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "Void WriteByte(Byte)");

            WrapperUtilities.InvokeMethodWithoutResult(this, methodInfo, new object[] { value });
        }
Exemplo n.º 9
0
        /// <summary>
        /// Wraps the 'System.Collections.IEnumerator GetEnumerator()' on the 'System.Linq.IQueryable' type.
        /// </summary>
        /// <returns>The value returned by the underlying method.</returns>
        public virtual System.Collections.IEnumerator GetEnumerator()
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.Collections.IEnumerable", "mscorlib", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "System.Collections.IEnumerator GetEnumerator()");

            return((System.Collections.IEnumerator)ProxyFactory.CreateProxyIfPossible(this.Scope, WrapperUtilities.InvokeMethodAndCast <System.Collections.IEnumerator>(this, methodInfo, new object[] { }), typeof(System.Collections.IEnumerator)));
        }
Exemplo n.º 10
0
        /// <summary>
        /// Wraps the 'System.Object Execute(System.Linq.Expressions.Expression)' on the 'System.Linq.IQueryProvider' type.
        /// </summary>
        /// <param name="expression">The value of the 'expression' parameter.</param>
        /// <returns>The value returned by the underlying method.</returns>
        public virtual object Execute(System.Linq.Expressions.Expression expression)
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.Linq.IQueryProvider", "System.Core", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "System.Object Execute(System.Linq.Expressions.Expression)");

            return(WrapperUtilities.InvokeMethodAndCast <object>(this, methodInfo, new object[] { expression }));
        }
Exemplo n.º 11
0
        /// <summary>
        /// Wraps the 'Void Reset()' on the 'System.Collections.IEnumerator' type.
        /// </summary>
        public virtual void Reset()
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.Collections.IEnumerator", "mscorlib", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "Void Reset()");

            WrapperUtilities.InvokeMethodWithoutResult(this, methodInfo, new object[] { });
        }
Exemplo n.º 12
0
        /// <summary>
        /// Wraps the 'Boolean MoveNext()' on the 'System.Collections.IEnumerator' type.
        /// </summary>
        /// <returns>The value returned by the underlying method.</returns>
        public virtual bool MoveNext()
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.Collections.IEnumerator", "mscorlib", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "Boolean MoveNext()");

            return(WrapperUtilities.InvokeMethodAndCast <bool>(this, methodInfo, new object[] { }));
        }
Exemplo n.º 13
0
 /// <summary>
 /// Gets a value of the 'Item' property on 'System.Collections.ObjectModel.ReadOnlyCollection`1'
 /// </summary>
 /// <param name="index">The value of the 'index' parameter.</param>
 public virtual T this[int index]
 {
     get
     {
         return(WrapperUtilities.InvokeMethodAndWrap <T>(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "T get_Item(Int32)"), new object[] { index }));
     }
 }
Exemplo n.º 14
0
        /// <summary>
        /// Wraps the 'Int64 Seek(Int64, System.IO.SeekOrigin)' on the 'System.IO.Stream' type.
        /// </summary>
        /// <param name="offset">The value of the 'offset' parameter.</param>
        /// <param name="origin">The value of the 'origin' parameter.</param>
        /// <returns>The value returned by the underlying method.</returns>
        public override long Seek(long offset, System.IO.SeekOrigin origin)
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.IO.Stream", "mscorlib", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "Int64 Seek(Int64, System.IO.SeekOrigin)");

            return(WrapperUtilities.InvokeMethodAndCast <long>(this, methodInfo, new object[] { offset, origin }));
        }
Exemplo n.º 15
0
        /// <summary>
        /// Wraps the 'Int32 ReadByte()' on the 'System.IO.Stream' type.
        /// </summary>
        /// <returns>The value returned by the underlying method.</returns>
        public override int ReadByte()
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.IO.Stream", "mscorlib", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "Int32 ReadByte()");

            return(WrapperUtilities.InvokeMethodAndCast <int>(this, methodInfo, new object[] { }));
        }
Exemplo n.º 16
0
        /// <summary>
        /// Wraps the 'Void Close()' on the 'System.IO.Stream' type.
        /// </summary>
        public override void Close()
        {
            var type       = WrapperUtilities.GetTypeFromCache("System.IO.Stream", "mscorlib", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "Void Close()");

            WrapperUtilities.InvokeMethodWithoutResult(this, methodInfo, new object[] { });
            this.Dispose(true);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Wraps the 'Tasks.Task`int WriteAsync(Byte[], Int32, Int32, CancellationToken)' on the 'System.IO.Stream' type.
        /// </summary>
        /// <param name="buffer">The value of the 'buffer' parameter.</param>
        /// <param name="offset">The value of the 'offset' parameter.</param>
        /// <param name="count">The value of the 'count' parameter.</param>
        /// <param name="cancellationToken">The value of the 'cancellationToken' parameter.</param>
        /// <returns>The value returned by the underlying method.</returns>
        public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
        {
            // this method has been added manually - WrapperGenerator will not be able to produce this
            var type       = WrapperUtilities.GetTypeFromCache("System.IO.Stream", "mscorlib", TypeCache);
            var methodInfo = WrapperUtilities.GetMethodInfo(type, MethodInfoCache, "System.Threading.Tasks.Task WriteAsync(Byte[], Int32, Int32, System.Threading.CancellationToken)");

            return(WrapperUtilities.InvokeMethodAndCast <Task>(this, methodInfo, new object[] { buffer, offset, count, cancellationToken }));
        }
Exemplo n.º 18
0
        /// <summary>
        /// Wraps the 'Boolean Contains(T)' on the 'System.Collections.ObjectModel.ReadOnlyCollection`1' type.
        /// </summary>
        /// <param name="value">The value of the 'value' parameter.</param>
        /// <returns>The value returned by the underlying method.</returns>
        public virtual bool Contains(T value)
        {
#if !WINDOWS_PHONE
            return(WrapperUtilities.InvokeMethodAndCast <bool>(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "Boolean Contains(T)"), new object[] { value }));
#else
            return(WrapperUtilities.InvokeMethodAndCast <bool>(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "System.Boolean Contains(T)"), new object[] { value }));
#endif
        }
Exemplo n.º 19
0
        /// <summary>
        /// Wraps the 'Void CopyTo(T[], Int32)' on the 'System.Collections.ObjectModel.ReadOnlyCollection`1' type.
        /// </summary>
        /// <param name="array">The value of the 'array' parameter.</param>
        /// <param name="index">The value of the 'index' parameter.</param>
        public virtual void CopyTo(WrappedArray <T> array, int index)
        {
#if !WINDOWS_PHONE
            WrapperUtilities.InvokeMethodWithoutResult(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "Void CopyTo(T[], Int32)"), new object[] { array, index });
#else
            WrapperUtilities.InvokeMethodWithoutResult(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "System.Void CopyTo(T[], System.Int32)"), new object[] { array, index });
#endif
        }
Exemplo n.º 20
0
        /// <summary>
        /// Wraps the 'Int32 IndexOf(T)' on the 'System.Collections.ObjectModel.ReadOnlyCollection`1' type.
        /// </summary>
        /// <param name="value">The value of the 'value' parameter.</param>
        /// <returns>The value returned by the underlying method.</returns>
        public virtual int IndexOf(T value)
        {
#if !WINDOWS_PHONE
            return(WrapperUtilities.InvokeMethodAndCast <int>(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "Int32 IndexOf(T)"), new object[] { value }));
#else
            return(WrapperUtilities.InvokeMethodAndCast <int>(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "System.Int32 IndexOf(T)"), new object[] { value }));
#endif
        }
Exemplo n.º 21
0
        /// <summary>
        /// Gets the MethodHandle based on the given signature
        /// </summary>
        /// <param name="type">The type where the method is</param>
        /// <param name="methodInfoCache">The cache of method infos</param>
        /// <param name="signature">The signature of the method to look up</param>
        /// <returns>Runtime method handle.</returns>
        public static MethodInfo GetMethodInfo(Type type, IDictionary <string, MethodInfo> methodInfoCache, string signature)
        {
            if (PlatformMethodMap.ContainsKey(signature))
            {
                signature = PlatformMethodMap[signature];
            }

            return(WrapperUtilities.GetMethodInfo(type, methodInfoCache, signature));
        }
Exemplo n.º 22
0
        /// <summary>
        /// Gets a value of the 'Item' property on 'System.Collections.ObjectModel.ReadOnlyCollection`1'
        /// </summary>
        /// <param name="index">The value of the 'index' parameter.</param>
        public virtual T this[int index]
        {
            get
            {
#if !WINDOWS_PHONE
                return(WrapperUtilities.InvokeMethodAndWrap <T>(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "T get_Item(Int32)"), new object[] { index }));
#else
                return(WrapperUtilities.InvokeMethodAndWrap <T>(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "T get_Item(System.Int32)"), new object[] { index }));
#endif
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// Gets or sets a value of the 'Item' property on 'System.Collections.Generic.IList`1'
        /// </summary>
        /// <param name="index">The value of the 'index' parameter.</param>
        public virtual T this[int index]
        {
            get
            {
                return(WrapperUtilities.InvokeMethodAndWrap <T>(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "T get_Item(Int32)"), new object[] { index }));
            }

            set
            {
                WrapperUtilities.InvokeMethodWithoutResult(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "Void set_Item(Int32, T)"), new object[] { index, value });
            }
        }
Exemplo n.º 24
0
 /// <summary>
 /// Wraps the 'Void CopyTo(System.Array, Int32)' on the 'System.Collections.ICollection' type.
 /// </summary>
 /// <param name="array">The value of the 'array' parameter.</param>
 /// <param name="index">The value of the 'index' parameter.</param>
 public virtual void CopyTo(WrappedObject array, int index)
 {
     WrapperUtilities.InvokeMethodWithoutResult(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "Void CopyTo(System.Array, Int32)"), new object[] { array, index });
 }
Exemplo n.º 25
0
 /// <summary>
 /// Wraps the 'System.Collections.IEnumerator GetEnumerator()' on the 'System.Collections.IEnumerable' type.
 /// </summary>
 /// <returns>The value returned by the underlying method.</returns>
 public virtual WrappedIEnumerator GetEnumerator()
 {
     return(WrapperUtilities.InvokeMethodAndWrap <WrappedIEnumerator>(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "System.Collections.IEnumerator GetEnumerator()"), new object[] { }));
 }
Exemplo n.º 26
0
 /// <summary>
 /// Wraps the 'Void Dispose()' on the 'System.IDisposable' type.
 /// </summary>
 public virtual void Dispose()
 {
     WrapperUtilities.InvokeMethodWithoutResult(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "Void Dispose()"), new object[] { });
 }
Exemplo n.º 27
0
 /// <summary>
 /// Wraps the 'TResult Execute[TResult](System.Linq.Expressions.Expression)' on the 'System.Linq.IQueryProvider' type.
 /// </summary>
 /// <typeparam name="TResult">The wrapper type for the 'TResult' generic parameter.</typeparam>
 /// <param name="typeTResult">The CLR generic type for the 'TResult' parameter.</param>
 /// <param name="expression">The value of the 'expression' parameter.</param>
 /// <returns>The value returned by the underlying method.</returns>
 public virtual TResult Execute <TResult>(Type typeTResult, WrappedObject expression)
     where TResult : WrappedObject
 {
     return(WrapperUtilities.InvokeMethodAndWrap <TResult>(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "TResult Execute[TResult](System.Linq.Expressions.Expression)"), new object[] { expression }, new Type[] { typeTResult }));
 }
Exemplo n.º 28
0
 /// <summary>
 /// Wraps the 'Int32 IndexOf(T)' on the 'System.Collections.Generic.IList`1' type.
 /// </summary>
 /// <param name="item">The value of the 'item' parameter.</param>
 /// <returns>The value returned by the underlying method.</returns>
 public virtual int IndexOf(T item)
 {
     return(WrapperUtilities.InvokeMethodAndCast <int>(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "Int32 IndexOf(T)"), new object[] { item }));
 }
Exemplo n.º 29
0
 /// <summary>
 /// Wraps the 'Void Insert(Int32, T)' on the 'System.Collections.Generic.IList`1' type.
 /// </summary>
 /// <param name="index">The value of the 'index' parameter.</param>
 /// <param name="item">The value of the 'item' parameter.</param>
 public virtual void Insert(int index, T item)
 {
     WrapperUtilities.InvokeMethodWithoutResult(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "Void Insert(Int32, T)"), new object[] { index, item });
 }
Exemplo n.º 30
0
 /// <summary>
 /// Wraps the 'Void RemoveAt(Int32)' on the 'System.Collections.Generic.IList`1' type.
 /// </summary>
 /// <param name="index">The value of the 'index' parameter.</param>
 public virtual void RemoveAt(int index)
 {
     WrapperUtilities.InvokeMethodWithoutResult(this, WrapperUtilities.GetMethodInfo(WrappedObjectType, MethodInfoCache, "Void RemoveAt(Int32)"), new object[] { index });
 }