Example #1
0
        public override string ToString()
        {
            EnsureScanDefinedMethods();

            string typeName = this._comTypeDesc.TypeName;

            if (String.IsNullOrEmpty(typeName))
            {
                typeName = "IDispatch";
            }

            return(String.Format(CultureInfo.CurrentCulture, "{0} ({1})", RuntimeCallableWrapper.ToString(), typeName));
        }
Example #2
0
        public override string ToString()
        {
            ComTypeDesc ctd      = _comTypeDesc;
            string      typeName = null;

            if (ctd != null)
            {
                typeName = ctd.TypeName;
            }

            if (String.IsNullOrEmpty(typeName))
            {
                typeName = "IDispatch";
            }

            return(String.Format(CultureInfo.CurrentCulture, "{0} ({1})", RuntimeCallableWrapper.ToString(), typeName));
        }
Example #3
0
        public override string ToString()
        {
            ComTypeDesc ctd      = _comTypeDesc;
            string      typeName = null;

            if (ctd != null)
            {
                typeName = ctd.TypeName;
            }

            if (string.IsNullOrEmpty(typeName))
            {
                typeName = "IDispatch";
            }

            return($"{RuntimeCallableWrapper.ToString()} ({typeName})");
        }
Example #4
0
        internal override IList <KeyValuePair <string, object> > GetMembers(IEnumerable <string> names)
        {
            if (names == null)
            {
                names = GetMemberNames(true);
            }

            Type comType = RuntimeCallableWrapper.GetType();

            var members = new List <KeyValuePair <string, object> >();

            foreach (string name in names)
            {
                if (name == null)
                {
                    continue;
                }

                ComMethodDesc method;
                if (ComTypeDesc.TryGetFunc(name, out method) && method.IsDataMember)
                {
                    try
                    {
                        object value = comType.InvokeMember(
                            method.Name,
                            BindingFlags.GetProperty,
                            null,
                            RuntimeCallableWrapper,
                            Utils.EmptyArray <object>(),
                            CultureInfo.InvariantCulture
                            );
                        members.Add(new KeyValuePair <string, object>(method.Name, value));

                        // evaluation failed for some reason. pass exception out
                    }
                    catch (Exception ex)
                    {
                        members.Add(new KeyValuePair <string, object>(method.Name, ex));
                    }
                }
            }

            return(members.ToArray());
        }