/// <summary> /// perform method as latebind call with parameters /// </summary> /// <param name="comObject">target object</param> /// <param name="name">name of method</param> /// <param name="paramsArray">array with parameters</param> public static void Method(COMObject comObject, string name, object[] paramsArray) { try { if(comObject.IsDisposed) throw new InvalidComObjectException(); if( (Settings.EnableSafeMode) && (!comObject.EntityIsAvailable(name,SupportEntityType.Method))) throw new EntityNotSupportedException(string.Format("Method {0} is not available.", name)); comObject.InstanceType.InvokeMember(name, BindingFlags.InvokeMethod | BindingFlags.GetProperty, null, comObject.UnderlyingObject, paramsArray, Settings.ThreadCulture); } catch (Exception throwedException) { DebugConsole.WriteException(throwedException); throw new System.Runtime.InteropServices.COMException(GetExceptionMessage(throwedException), throwedException); } }
/// <summary> /// perform property set as latebind call /// </summary> /// <param name="comObject">target object</param> /// <param name="name">name of property</param> /// <param name="paramsArray">array with parameters</param> /// <param name="value">value to be set</param> /// <param name="paramModifiers">array with modifiers correspond paramsArray</param> public static void PropertySet(COMObject comObject, string name, object[] paramsArray, object value, ParameterModifier[] paramModifiers) { try { if (comObject.IsDisposed) { throw new InvalidComObjectException(); } if ((Settings.EnableSafeMode) && (!comObject.EntityIsAvailable(name, SupportEntityType.Property))) { throw new EntityNotSupportedException(string.Format("Property {0} is not available.", name)); } object[] newParamsArray = new object[paramsArray.Length + 1]; for (int i = 0; i < paramsArray.Length; i++) { newParamsArray[i] = paramsArray[i]; } newParamsArray[newParamsArray.Length - 1] = value; comObject.InstanceType.InvokeMember(name, BindingFlags.SetProperty, null, comObject.UnderlyingObject, newParamsArray, paramModifiers, Settings.ThreadCulture, null); } catch (Exception throwedException) { DebugConsole.WriteException(throwedException); throw new System.Runtime.InteropServices.COMException(GetExceptionMessage(throwedException), throwedException); } }
/// <summary> /// perform property set as latebind call /// </summary> /// <param name="comObject"></param> /// <param name="name"></param> /// <param name="value"></param> public static void PropertySet(COMObject comObject, string name, object[] value) { try { if (comObject.IsDisposed) { throw new InvalidComObjectException(); } if ((Settings.EnableSafeMode) && (!comObject.EntityIsAvailable(name, SupportEntityType.Property))) { throw new EntityNotSupportedException(string.Format("Property {0} is not available.", name)); } comObject.InstanceType.InvokeMember(name, BindingFlags.SetProperty, null, comObject.UnderlyingObject, value, Settings.ThreadCulture); } catch (Exception throwedException) { DebugConsole.WriteException(throwedException); throw new System.Runtime.InteropServices.COMException(GetExceptionMessage(throwedException), throwedException); } }
/// <summary> /// perform method as latebind call with parameters and parameter modifiers to use ref parameter(s) /// </summary> /// <param name="comObject">target object</param> /// <param name="name">name of method</param> /// <param name="paramsArray">array with parameters</param> /// <param name="paramModifiers">ararry with modifiers correspond paramsArray</param> public static void SingleMethod(COMObject comObject, string name, object[] paramsArray, ParameterModifier[] paramModifiers) { try { if (comObject.IsDisposed) { throw new InvalidComObjectException(); } if ((Settings.EnableSafeMode) && (!comObject.EntityIsAvailable(name, SupportEntityType.Method))) { throw new EntityNotSupportedException(string.Format("Method {0} is not available.", name)); } comObject.InstanceType.InvokeMember(name, BindingFlags.InvokeMethod | BindingFlags.GetProperty, null, comObject.UnderlyingObject, paramsArray, paramModifiers, Settings.ThreadCulture, null); } catch (Exception throwedException) { DebugConsole.WriteException(throwedException); throw new System.Runtime.InteropServices.COMException(GetExceptionMessage(throwedException), throwedException); } }
/// <summary> /// perform property set as latebind call /// </summary> /// <param name="comObject">target object</param> /// <param name="name">name of property</param> /// <param name="value">value to be set</param> /// <param name="paramModifiers">array with modifiers correspond paramsArray</param> public void PropertySet(COMObject comObject, string name, object value, ParameterModifier[] paramModifiers) { try { if (comObject.IsDisposed) { throw new ObjectDisposedException("COMObject"); } if ((Settings.EnableSafeMode) && (!comObject.EntityIsAvailable(name, SupportEntityType.Property))) { throw new EntityNotSupportedException(string.Format("Property {0} is not available.", name)); } comObject.InstanceType.InvokeMember(name, BindingFlags.SetProperty, null, comObject.UnderlyingObject, new object[] { value }, paramModifiers, Settings.Default.ThreadCulture, null); } catch (Exception throwedException) { Console.WriteException(throwedException); throw new System.Runtime.InteropServices.COMException(GetExceptionMessage(throwedException), throwedException); } }
/// <summary> /// perform method as latebind call with parameters /// </summary> /// <param name="comObject">target object</param> /// <param name="name">name of method</param> /// <param name="paramsArray">array with parameters</param> public void Method(COMObject comObject, string name, object[] paramsArray) { try { if (comObject.IsDisposed) { throw new ObjectDisposedException("COMObject"); } if ((Settings.EnableSafeMode) && (!comObject.EntityIsAvailable(name, SupportEntityType.Method))) { throw new EntityNotSupportedException(string.Format("Method {0} is not available.", name)); } comObject.InstanceType.InvokeMember(name, BindingFlags.InvokeMethod, null, comObject.UnderlyingObject, paramsArray, Settings.Default.ThreadCulture); } catch (Exception throwedException) { Console.WriteException(throwedException); throw new System.Runtime.InteropServices.COMException(GetExceptionMessage(throwedException), throwedException); } }
/// <summary> /// Perform property set as latebind call /// </summary> /// <param name="comObject">target object</param> /// <param name="name">name of property</param> /// <param name="value">value array to be set</param> /// <param name="paramModifiers">array with modifiers correspond paramsArray</param> public void PropertySet(COMObject comObject, string name, object[] value, ParameterModifier[] paramModifiers) { try { if (comObject.IsDisposed) throw new ObjectDisposedException("COMObject"); if ((Settings.EnableSafeMode) && (!comObject.EntityIsAvailable(name, SupportEntityType.Property))) throw new EntityNotSupportedException(string.Format("Property {0} is not available.", name)); bool measureStarted = Settings.PerformanceTrace.StartMeasureTime(comObject.ComponentRootName, comObject.InstanceName, name, PerformanceTrace.CallType.PropertySet); comObject.InstanceType.InvokeMember(name, BindingFlags.SetProperty, null, comObject.UnderlyingObject, value, paramModifiers, Settings.Default.ThreadCulture, null); if (measureStarted) Settings.PerformanceTrace.StopMeasureTime(comObject.ComponentRootName, comObject.InstanceName, name, value); } catch (Exception throwedException) { Console.WriteException(throwedException); throw new System.Runtime.InteropServices.COMException(GetExceptionMessage(throwedException), throwedException); } }
/// <summary> /// Perform method as latebind call with return value /// </summary> /// <param name="comObject">target object</param> /// <param name="name">name of method</param> /// <param name="paramsArray">array with parameters</param> /// <returns>any return value</returns> public object SingleMethodReturn(COMObject comObject, string name, object[] paramsArray) { try { if (comObject.IsDisposed) throw new ObjectDisposedException("COMObject"); if ((Settings.EnableSafeMode) && (!comObject.EntityIsAvailable(name, SupportEntityType.Method))) throw new EntityNotSupportedException(string.Format("Method {0} is not available.", name)); bool measureStarted = Settings.PerformanceTrace.StartMeasureTime(comObject.ComponentRootName, comObject.InstanceName, name, PerformanceTrace.CallType.Function); object returnValue = comObject.InstanceType.InvokeMember(name, BindingFlags.InvokeMethod | BindingFlags.GetProperty, null, comObject.UnderlyingObject, paramsArray, Settings.Default.ThreadCulture); if (measureStarted) Settings.PerformanceTrace.StopMeasureTime(comObject.ComponentRootName, comObject.InstanceName, name); return returnValue; } catch (Exception throwedException) { Console.WriteException(throwedException); throw new System.Runtime.InteropServices.COMException(GetExceptionMessage(throwedException), throwedException); } }
/// <summary> /// perform property set as latebind call /// </summary> /// <param name="comObject">comobject instance</param> /// <param name="name">name of the property</param> /// <param name="value">new value of the property</param> public void PropertySet(COMObject comObject, string name, object[] value) { try { if (comObject.IsDisposed) throw new ObjectDisposedException("COMObject"); if ((Settings.EnableSafeMode) && (!comObject.EntityIsAvailable(name, SupportEntityType.Property))) throw new EntityNotSupportedException(string.Format("Property {0} is not available.", name)); comObject.InstanceType.InvokeMember(name, BindingFlags.SetProperty, null, comObject.UnderlyingObject, value, Settings.Default.ThreadCulture); } catch (Exception throwedException) { Console.WriteException(throwedException); throw new System.Runtime.InteropServices.COMException(GetExceptionMessage(throwedException), throwedException); } }
/// <summary> /// perform property set as latebind call /// </summary> /// <param name="comObject">target object</param> /// <param name="name">name of property</param> /// <param name="paramsArray">array with parameters</param> /// <param name="value">value to be set</param> /// <param name="paramModifiers">array with modifiers correspond paramsArray</param> public void PropertySet(COMObject comObject, string name, object[] paramsArray, object value, ParameterModifier[] paramModifiers) { try { if (comObject.IsDisposed) throw new ObjectDisposedException("COMObject"); if ((Settings.EnableSafeMode) && (!comObject.EntityIsAvailable(name, SupportEntityType.Property))) throw new EntityNotSupportedException(string.Format("Property {0} is not available.", name)); object[] newParamsArray = new object[paramsArray.Length + 1]; for (int i = 0; i < paramsArray.Length; i++) newParamsArray[i] = paramsArray[i]; newParamsArray[newParamsArray.Length - 1] = value; comObject.InstanceType.InvokeMember(name, BindingFlags.SetProperty, null, comObject.UnderlyingObject, newParamsArray, paramModifiers, Settings.Default.ThreadCulture, null); } catch (Exception throwedException) { Console.WriteException(throwedException); throw new System.Runtime.InteropServices.COMException(GetExceptionMessage(throwedException), throwedException); } }
/// <summary> /// perform method as latebind call with return value /// </summary> /// <param name="comObject">target object</param> /// <param name="name">name of method</param> /// <param name="paramsArray">array with parameters</param> /// <param name="paramModifiers">ararry with modifiers correspond paramsArray</param> /// <returns>any return value</returns> public object SingleMethodReturn(COMObject comObject, string name, object[] paramsArray, ParameterModifier[] paramModifiers) { try { if (comObject.IsDisposed) throw new ObjectDisposedException("COMObject"); if ((Settings.EnableSafeMode) && (!comObject.EntityIsAvailable(name, SupportEntityType.Method))) throw new EntityNotSupportedException(string.Format("Method {0} is not available.", name)); object returnValue = comObject.InstanceType.InvokeMember(name, BindingFlags.InvokeMethod | BindingFlags.GetProperty, null, comObject.UnderlyingObject, paramsArray, paramModifiers, Settings.Default.ThreadCulture, null); return returnValue; } catch (Exception throwedException) { Console.WriteException(throwedException); throw new System.Runtime.InteropServices.COMException(GetExceptionMessage(throwedException), throwedException); } }