public override void SetPropValue(int propNum, IValue newVal)
        {
            var prop = _props[propNum];

            var dispId = prop.DispatchId;

            try
            {
                try
                {
                    object argToPass;
                    if (newVal.DataType == Machine.DataType.Date)
                    {
                        var date = newVal.AsDate();
                        if (date == DateTime.MinValue)
                        {
                            argToPass = new DateTime(100, 1, 1); // Min OLEAuth Date
                        }
                        else
                        {
                            argToPass = MarshalIValue(newVal);
                        }
                    }
                    else
                    {
                        argToPass = MarshalIValue(newVal);
                    }
                    DispatchUtility.InvokeSetProperty(Instance, dispId, argToPass);
                }
                catch (System.Reflection.TargetInvocationException e)
                {
                    throw e.InnerException ?? e;
                }
            }
            catch (System.MissingMemberException)
            {
                throw RuntimeException.PropNotFoundException(prop.Name);
            }
            catch (System.MemberAccessException)
            {
                throw RuntimeException.PropIsNotWritableException(prop.Name);
            }
        }
Пример #2
0
 public override void SetPropValue(int propNum, IValue newVal)
 {
     try
     {
         try
         {
             object argToPass;
             if (newVal.DataType == Machine.DataType.Date)
             {
                 var date = newVal.AsDate();
                 if (date == DateTime.MinValue)
                 {
                     argToPass = new DateTime(100, 1, 1); // Min OLEAuth Date
                 }
                 else
                 {
                     argToPass = MarshalIValue(newVal);
                 }
             }
             else
             {
                 argToPass = MarshalIValue(newVal);
             }
             DispatchUtility.InvokeSetProperty(_instance, propNum, argToPass);
         }
         catch (System.Reflection.TargetInvocationException e)
         {
             throw e.InnerException;
         }
     }
     catch (System.MissingMemberException)
     {
         throw RuntimeException.PropNotFoundException("dispid[" + propNum.ToString() + "]");
     }
     catch (System.MemberAccessException)
     {
         throw RuntimeException.PropIsNotWritableException("dispid[" + propNum.ToString() + "]");
     }
 }
Пример #3
0
 public override void SetPropValue(int propNum, IValue newVal)
 {
     try
     {
         try
         {
             DispatchUtility.InvokeSetProperty(_instance, propNum, MarshalIValue(newVal));
         }
         catch (System.Reflection.TargetInvocationException e)
         {
             throw e.InnerException;
         }
     }
     catch (System.MissingMemberException)
     {
         throw RuntimeException.PropNotFoundException("dispid[" + propNum.ToString() + "]");
     }
     catch (System.MemberAccessException)
     {
         throw RuntimeException.PropIsNotWritableException("dispid[" + propNum.ToString() + "]");
     }
 }