Exemplo n.º 1
0
        public void Add(Method item)
        {
            lock (syncRoot)
            {
                if (item == null)
                {
                    throw new ArgumentNullException("item");
                }

                if (item.Name != name)
                {
                    throw new ArgumentException("Cannot add overload with different name.");
                }

                if (overloads.Count > 0)
                {
                    if (item.Assembly != overloads[0].Assembly || item.MethodInfo.DeclaringType != overloads[0].MethodInfo.DeclaringType)
                    {
                        throw new ArgumentException("Cannot add overload from different assembly or type.");
                    }

                    if (item.MethodInfo.IsStatic != overloads[0].MethodInfo.IsStatic)
                    {
                        throw new ArgumentException("Cannot combine static and non-static methods.");
                    }
                }

                foreach (Method method in overloads)
                {
                    if (method.MinParameterCount > item.MaxParameterCount || method.MaxParameterCount < item.MinParameterCount)
                    {
                        continue;
                    }
                    else
                    {
                        bool different = false;

                        for (int i = 0; i < item.Parameters.Length; i++)
                        {
                            // TODO
                            different = true;
                        }

                        if (!different)
                        {
                            throw new RuntimeException(String.Format("Cannot add overload. Ambiguous method call with {0}", method));
                        }
                    }
                }

                RuntimeCore.AddAssemblyObject(item, this);
                overloads.Add(item);
                syntax = null;
            }
        }
Exemplo n.º 2
0
        public void AddGroup(Control control, string title)
        {
            Group group = new Group(control, title);

            RuntimeCore.AddAssemblyObject(group, this);
            groups.Add(group);
            group.GroupControl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            groupsPanel.Controls.Add(group.GroupControl);

            SortGroups();
        }
Exemplo n.º 3
0
        public void InsertTab(int index, Crownwood.Magic.Controls.TabPage page)
        {
            TabPageInfo tabInfo = new TabPageInfo(index, page);

            tabInfo.IndexChanged += new EventHandler(tabInfo_IndexChanged);

            RuntimeCore.AddAssemblyObject(tabInfo, this);
            tabList.Add(tabInfo);

            Debug.WriteLine("TabPage \"" + page.Title + "\" added with index " + index.ToString() + ".", "Gui");

            page.CreateControl();
            page.Control.CreateControl();

            UpdateTabs();
        }
Exemplo n.º 4
0
        public void Add(byte id, MessageCallback callback, CallbackPriority priority)
        {
            lock (syncRoot) {
                if (list[id] == null)
                {
                    list[id] = new CallbacksCollection();
                }

                CallbackObject obj = new CallbackObject(id, callback, priority);

                if (list[id].Contains(obj))
                {
                    throw new ArgumentException("Callback is already registered for this message.");
                }

                RuntimeCore.AddAssemblyObject(obj, this);
                list[id].Add(obj);

                list[id].SortByPriority();

                Debug.WriteLine(callbacksName + " callback added (0x" + id.ToString("X2") + ", " + priority.ToString() + ")", "Phoenix");
            }
        }
Exemplo n.º 5
0
 internal void AddCategory(CategoryData data)
 {
     RuntimeCore.AddAssemblyObject(data, this);
     categoryControl.AddCategory(data);
 }
Exemplo n.º 6
0
 public void AddHandler(THandler handler)
 {
     RuntimeCore.AddAssemblyObject(new EventObject(handler), this);
     handlers = Delegate.Combine(handlers, (Delegate)(object)handler);
 }