예제 #1
0
        public void AddNamedItem(string name, ScriptItem flags)
        {
            Debug.WriteLine("AddNamedItem(\"" + name + "\", " + flags.ToString() + ")");
            // What did he give us?
            object item;
            object typeinfo;

            if (this.site != null)
            {
                this.site.GetItemInfo(name, ScriptInfo.IUnknown, out item, out typeinfo);
                Type itemType = item.GetType();
                if (itemType.FullName == "System.__ComObject")
                {
                    throw new NotImplementedException();
                }
                else
                {
                    ProcessItem(name, flags, item, itemType);
                }
            }
            else
            {
                throw new NotImplementedException();
            }

            //if (this.site != null) {
            //    try {
            //        this.site.GetItemInfo (name, ScriptInfo.IUnknown, out item, out typeinfo);
            //        Debug.WriteLine ("item is " + item.ToString ());
            //        Type type = (item as IDispatch).GetTypeInfo (0, 0x409);
            //        Debug.WriteLine ("Type is " + type.ToString ());
            //        foreach (System.Reflection.MemberInfo minfo in type.GetMembers ())
            //            Debug.WriteLine (minfo);
            //    }
            //    catch (Exception e) {
            //        Debug.WriteLine ("Exception " + e.ToString ());
            //    }
            //}
            //else {
            //    // I guess we can find out later.
            //    Debug.WriteLine ("No site, but named items being added.");
            //}
        }
예제 #2
0
        public void AddNamedItem(string name, ScriptItem flags)
        {
            Debug.WriteLine ("AddNamedItem(\"" + name + "\", " + flags.ToString () + ")");
            // What did he give us?
            object item;
            object typeinfo;
            if (this.site != null) {
                this.site.GetItemInfo (name, ScriptInfo.IUnknown, out item, out typeinfo);
                Type itemType = item.GetType ();
                if (itemType.FullName == "System.__ComObject") {
                    throw new NotImplementedException ();
                }
                else {
                    ProcessItem (name, flags, item, itemType);
                }

            }
            else {
                throw new NotImplementedException ();
            }

            //if (this.site != null) {
            //    try {
            //        this.site.GetItemInfo (name, ScriptInfo.IUnknown, out item, out typeinfo);
            //        Debug.WriteLine ("item is " + item.ToString ());
            //        Type type = (item as IDispatch).GetTypeInfo (0, 0x409);
            //        Debug.WriteLine ("Type is " + type.ToString ());
            //        foreach (System.Reflection.MemberInfo minfo in type.GetMembers ())
            //            Debug.WriteLine (minfo);
            //    }
            //    catch (Exception e) {
            //        Debug.WriteLine ("Exception " + e.ToString ());
            //    }
            //}
            //else {
            //    // I guess we can find out later.
            //    Debug.WriteLine ("No site, but named items being added.");
            //}
        }