コード例 #1
0
ファイル: Extensions.cs プロジェクト: DiablosOffens/Moras.Net
        public static void SetHint(this Control ctl, string value)
        {
            Control parent = ctl;

            while (parent != null && !(parent is TCustomForm))
            {
                parent = parent.Parent;
            }
            if (parent == null)
            {
                return;
            }

            ComponentCollection comps = GetComponents(parent);

            if (comps == null)
            {
                return;
            }

            foreach (IComponent comp in comps)
            {
                ToolTip tip = comp as ToolTip;
                if (tip != null)
                {
                    tip.SetToolTip(ctl, value);
                    //break; // TODO: only first?
                }
            }
        }
コード例 #2
0
ファイル: Extensions.cs プロジェクト: DiablosOffens/Moras.Net
        public static void SetHelpKeyword(this Control ctl, string value)
        {
            Control parent = ctl;

            while (parent != null && !(parent is TCustomForm))
            {
                parent = parent.Parent;
            }
            if (parent == null)
            {
                return;
            }

            ComponentCollection comps = GetComponents(parent);

            if (comps == null)
            {
                return;
            }

            foreach (IComponent comp in comps)
            {
                HelpProvider help = comp as HelpProvider;
                if (help != null)
                {
                    help.SetHelpKeyword(ctl, value);
                    //break; // TODO: only first?
                }
            }
        }
コード例 #3
0
ファイル: Extensions.cs プロジェクト: DiablosOffens/Moras.Net
        //public static bool CanPersist(this object obj)
        //{
        //    if (obj is ISerializable)
        //        return true;
        //    if (obj.GetType().GetCustomAttributes(typeof(SerializableAttribute), true).Length != 0)
        //        return true;
        //    return false;
        //}

        public static string GetHint(this Control ctl)
        {
            Control parent = ctl;

            while (parent != null && !(parent is TCustomForm))
            {
                parent = parent.Parent;
            }
            if (parent == null)
            {
                return(null);
            }

            ComponentCollection comps = GetComponents(parent);

            if (comps == null)
            {
                return(null);
            }

            foreach (IComponent comp in comps)
            {
                ToolTip tip  = comp as ToolTip;
                string  hint = null;
                if (tip != null)
                {
                    hint = tip.GetToolTip(ctl);
                }
                if (!string.IsNullOrEmpty(hint))
                {
                    return(hint);
                }
            }
            return(null);
        }
コード例 #4
0
        /*public ICollection GetStandardValues ()
         * {
         *  return null;
         * }*/

        public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            if (context == null)
            {
                return(null);
            }

            IContainer container = context.Container;

            if (container == null)
            {
                return(null);
            }

            ComponentCollection ctrlCollection = container.Components;
            ArrayList           arrayList      = new ArrayList(0);

            foreach (Control control in ctrlCollection)
            {
                if (FilterControl(control))
                {
                    arrayList.Add(control.ID);
                }
            }
            return(new StandardValuesCollection(arrayList));
        }
コード例 #5
0
 public AddLargeRoomStep(RandRange roomAmount, List <BaseRoomFilter> filters)
     : this()
 {
     RoomAmount     = roomAmount;
     RoomComponents = new ComponentCollection();
     Filters        = filters;
 }
コード例 #6
0
        public void AddAfterLock_ThrowsInvalidOperationException()
        {
            var collection = new ComponentCollection <int>();

            collection.Lock();
            Assert.Throws <InvalidOperationException>(() => collection.Add("one", 1));
        }
コード例 #7
0
 private void Remove(IComponent component, bool preserveSite)
 {
     lock (syncObj)
     {
         if (component == null)
         {
             return;
         }
         ISite site = component.Site;
         if (site == null || site.Container != this)
         {
             return;
         }
         if (!preserveSite)
         {
             component.Site = null;
         }
         for (int i = 0; i < siteCount; i++)
         {
             if (sites[i] == site)
             {
                 siteCount--;
                 Array.Copy(sites, i + 1, sites, i, siteCount - i);
                 sites[siteCount] = null;
                 components       = null;
                 break;
             }
         }
     }
 }
コード例 #8
0
        private object[] GetControls(IContainer container)
        {
            ComponentCollection componentCollection = container.Components;
            ArrayList           ctrlList            = new ArrayList();

            foreach (IComponent comp in componentCollection)
            {
                Control ctrl = (Control)comp;

                if (ctrl is CardTypesListBox)
                {
                    if (ctrl.ID != null && ctrl.ID.Length != 0)
                    {
                        ValidationPropertyAttribute vpa =
                            (ValidationPropertyAttribute)TypeDescriptor.GetAttributes(ctrl)[typeof(ValidationPropertyAttribute)];
                        if (vpa != null && vpa.Name != null)
                        {
                            ctrlList.Add(String.Copy(ctrl.ID));
                        }
                    }
                }
            }

            ctrlList.Sort();

            return(ctrlList.ToArray());
        }
コード例 #9
0
        static void Main(string[] args)
        {
            LibraryContainer cntrExmpl = new LibraryContainer();

            try
            {
                BookComponent book1 = new BookComponent("Wizard's First Rule", "Terry Gooodkind");
                cntrExmpl.Add(book1, "0812548051");
                BookComponent book2 = new BookComponent("Stone of Tears", "Terry Gooodkind");
                cntrExmpl.Add(book2, "0812548094");
                BookComponent book3 = new BookComponent("Blood of the Fold", "Terry Gooodkind");
                cntrExmpl.Add(book3, "0812551478");
                BookComponent book4 = new BookComponent("The Soul of the Fire", "Terry Gooodkind");
                //This will generate exception because the ISBN already exists in the container.
                cntrExmpl.Add(book4, "0812551478");
            }
            catch (ArgumentException e)
            {
                Console.WriteLine("Unable to add books: " + e.Message);
            }

            ComponentCollection datalist = cntrExmpl.Components;
            IEnumerator         denum    = datalist.GetEnumerator();

            while (denum.MoveNext())
            {
                BookComponent cmp = (BookComponent)denum.Current;
                Console.WriteLine("Book Title: " + cmp.Title);
                Console.WriteLine("Book Author: " + cmp.Author);
                Console.WriteLine("Book ISBN: " + cmp.Site.Name);
            }
        }
コード例 #10
0
        /// <summary>
        /// Opens component collection as serializable stream based on chosen serialization type
        /// </summary>
        private void OpenComponentCollection(object dummy)
        {
            ObservableCollection <Component> tmp = Model.OpenCollection();

            if (tmp != null)
            {
                ComponentCollection = tmp;
                ComputerCollection  = new ObservableCollection <ComputerItem>();
                foreach (Component c in ComponentCollection)
                {
                    if (c.GetType() == typeof(Computer))
                    {
                        ObservableCollection <FieldInfo> fInfos = Model.GetAllFieldsOfComponentByTypeName(CreatableTypes, c.GetType().Name);

                        ObservableCollection <ComponentField> componentFields = new ObservableCollection <ComponentField>(fInfos.Select(f => new ComponentField(f, f.GetValue(c))));

                        //Making sure that all fields inside computer are the same as in collection otherwise changing collection wont change computer components
                        for (int i = 0; i < componentFields.Count; i++)
                        {
                            if (componentFields[i].fieldValue is Component)
                            {
                                Component comp = ComponentCollection.Single(cmp => cmp.GetType() == componentFields[i].fieldValue.GetType() && cmp.GetName() == ((Component)componentFields[i].fieldValue).GetName());
                                fInfos[i].SetValue(c, comp);
                                componentFields[i].fieldValue = comp;
                            }
                        }

                        ComputerCollection.Add(new ComputerItem(c as Computer, componentFields));
                    }
                }
            }
        }
コード例 #11
0
        private object [] GetControls(IContainer container)
        {
            ComponentCollection allComponents = container.Components;
            ArrayList           array         = new ArrayList();

            // for each control in the container
            foreach (IComponent comp in (IEnumerable)allComponents)
            {
                if (comp is Control)
                {
                    Control control = (Control)comp;

                    // Must have an ID
                    if (control.ID == null || control.ID.Length == 0)
                    {
                        continue;
                    }

                    // Must have a validation property
                    ValidationPropertyAttribute valProp = (ValidationPropertyAttribute)TypeDescriptor.GetAttributes(control)[typeof(ValidationPropertyAttribute)];
                    if (valProp != null && valProp.Name != null)
                    {
                        array.Add(string.Copy(control.ID));
                    }
                }
            }
            array.Sort(Comparer.Default);
            return(array.ToArray());
        }
コード例 #12
0
 /// <summary>
 /// Registers the learn logic all components.
 /// </summary>
 /// <param name="components">The components.</param>
 /// <remarks>Documented by Dev02, 2008-04-24</remarks>
 private void RegisterLearnLogicAllComponents(ComponentCollection components)
 {
     foreach (Component component in components)
     {
         RegisterLearnLogicObject(component);
     }
 }
コード例 #13
0
ファイル: SceneView.cs プロジェクト: aologos/Citrus
        public static bool Consume <T>(ComponentCollection <Component> components) where T : Node
        {
            Type     type;
            ICommand command;

            return(Consume <T>(components, out type, out command));
        }
コード例 #14
0
        private IEnumerable RecurseObjects(object root)
        {
            Queue items = new Queue();

            items.Enqueue(root);
            while (items.Count > 0)
            {
                object obj = items.Dequeue();
                yield return(obj);

                Control control = obj as Control;
                if (null != control)
                {
                    // regular controls and sub-controls
                    foreach (Control item in control.Controls)
                    {
                        items.Enqueue(item);
                    }
                    // top-level menu items
                    ToolStrip ts = control as ToolStrip;
                    if (ts != null)
                    {
                        foreach (ToolStripItem tsi in ts.Items)
                        {
                            items.Enqueue(tsi);
                        }
                    }
                }
                // child menus
                ToolStripDropDownItem tsddi = obj as ToolStripDropDownItem;
                if (null != tsddi && tsddi.HasDropDownItems)
                {
                    foreach (ToolStripItem item in tsddi.DropDownItems)
                    {
                        items.Enqueue(item);
                    }
                }
                //catch MainMenu and MenuItem components
                ComponentCollection componentCollection = obj as ComponentCollection;
                if (null != componentCollection)
                {
                    foreach (var item in componentCollection)
                    {
                        if (item is MainMenu)
                        {
                            items.Enqueue(item);
                            break; //there is only one MainMenu per Form
                        }
                    }
                }
                Menu menu = obj as Menu;
                if (null != menu)
                {
                    foreach (var item in menu.MenuItems)
                    {
                        items.Enqueue(item);
                    }
                }
            }
        }
コード例 #15
0
 public ComponentCollectionTests()
 {
     _addedCount          = 0;
     _componentCollection = new ComponentCollection();
     _componentCollection.ComponentAdded   += (s, e) => _addedCount++;
     _componentCollection.ComponentRemoved += (s, e) => _addedCount--;
 }
コード例 #16
0
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposedValue)
     {
         if (disposing)
         {
             Owner.Disposed -= new EventHandler(OnOwnerDisposed);
             Monitor.Enter(_sites);
             try
             {
                 LinkedListNode <Site> node = _sites.First;
                 while (null != node)
                 {
                     LinkedListNode <Site> next = node.Next;
                     Site       site            = node.Value;
                     IComponent c = site.Component;
                     ISite      s = c.Site;
                     _sites.Remove(node);
                     _components = null;
                     if (null != s && Object.ReferenceEquals(site, s) && Object.ReferenceEquals(this, s.Container))
                     {
                         c.Dispose();
                     }
                 }
             }
             finally { Monitor.Exit(_sites); }
         }
         _disposedValue = true;
     }
 }
コード例 #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="container"></param>
        /// <returns></returns>
        protected override object[] GetControls(IContainer container)
        {
            ComponentCollection components = container.Components;
            ArrayList           controls   = new ArrayList();

            foreach (IComponent component in components)
            {
                if (component is System.Web.UI.Control)
                {
                    Control c = (Control)component;

                    List <ButtonBase> buttons = ControlUtils.FindControls <ButtonBase>(c);

                    if (buttons != null && buttons.Count > 0)
                    {
                        foreach (ButtonBase btn in buttons)
                        {
                            if (btn.ID.IsNotEmpty() && !controls.Contains(btn.ID))
                            {
                                controls.Add(btn.ID);
                            }
                        }
                    }
                }
            }

            controls.Sort(Comparer.Default);

            return(controls.ToArray());
        }
コード例 #18
0
 public CombineGridRoomStep(int combineChance, List <BaseRoomFilter> filters)
 {
     CombineChance  = combineChance;
     GiantRooms     = new SpawnList <RoomGen <T> >();
     RoomComponents = new ComponentCollection();
     Filters        = filters;
 }
コード例 #19
0
 public AddLargeRoomStep()
     : base()
 {
     GiantRooms     = new SpawnList <LargeRoom <T> >();
     RoomComponents = new ComponentCollection();
     Filters        = new List <BaseRoomFilter>();
 }
コード例 #20
0
        private void Remove(IComponent component, bool preserveSite)
        {
            lock (_syncObj)
            {
                ISite site = component?.Site;
                if (site == null || site.Container != this)
                {
                    return;
                }

                if (!preserveSite)
                {
                    component.Site = null;
                }

                for (int i = 0; i < _siteCount; i++)
                {
                    if (_sites[i] == site)
                    {
                        _siteCount--;
                        Array.Copy(_sites, i + 1, _sites, i, _siteCount - i);
                        _sites[_siteCount] = null;
                        _components        = null;
                        break;
                    }
                }
            }
        }
コード例 #21
0
        public string CreateName(IContainer container, Type type)
        {
            if (null == container)
            {
                return(string.Empty);
            }

            ComponentCollection cc = container.Components;
            int min   = int.MaxValue;
            int max   = int.MinValue;
            int count = 0;

            int i = 0;

            while (i < cc.Count)
            {
                Component comp = cc[i] as Component;

                if (comp.GetType() == type)
                {
                    count++;

                    string name = comp.Site.Name;
                    if (name.StartsWith(type.Name))
                    {
                        try
                        {
                            int value = int.Parse(name.Substring(type.Name.Length));
                            if (value < min)
                            {
                                min = value;
                            }
                            if (value > max)
                            {
                                max = value;
                            }
                        }
                        catch (Exception) { }
                    } //end_if
                }     //end_if

                i++;
            } //end_while

            if (0 == count)
            {
                return(type.Name + "1");
            }
            else if (min > 1)
            {
                int j = min - 1;
                return(type.Name + j.ToString());
            }
            else
            {
                int j = max + 1;
                return(type.Name + j.ToString());
            }
        }
コード例 #22
0
        string INameCreationService.CreateName(IContainer container, Type type)
        {
            ComponentCollection cc = container.Components;

            int min   = Int32.MaxValue;
            int max   = Int32.MinValue;
            int count = 0;

            for (int i = 0; i < cc.Count; i++)
            {
                Component comp = cc[i] as Component;

                if (comp.GetType() == type)
                {
                    count++;

                    string name = comp.Site.Name;
                    if (name.StartsWith(type.Name))
                    {
                        try
                        {
                            int value = Int32.Parse(name.Substring(type.Name.Length));

                            if (value < min)
                            {
                                min = value;
                            }

                            if (value > max)
                            {
                                max = value;
                            }
                        }
                        catch (Exception ex)
                        {
                            Trace.WriteLine(ex.ToString());
                        }
                    }
                }
            }            // for

            if (count == 0)
            {
                return(type.Name + "1");
            }

            else if (min > 1)
            {
                int j = min - 1;

                return(type.Name + j.ToString());
            }
            else
            {
                int j = max + 1;

                return(type.Name + j.ToString());
            }
        }
コード例 #23
0
    //- realy on SurfaceManager.ActiveDesignSurface
    //- which effectively points to ACTIVE DesignSurface
    public void ReloadComboBox() {
        _bSuppressEvents = true;
        try {
            //- IDesignerEventService provides a global eventing mechanism for designer events. With this mechanism,
            //- an application is informed when a designer becomes active. The service provides a collection of
            //- designers and a single place where global objects, such as the Properties window, can monitor selection
            //- change events.
            IDesignerEventService des = (IDesignerEventService) SurfaceManager.GetService( typeof( IDesignerEventService ) );
            if( null == des )
                return;
            IDesignerHost host = des.ActiveDesigner;


            object selectedObj = pgrdPropertyGrid.SelectedObject;
            if( null == selectedObj )
                return; //- don't reload at all


            //- get the name of the control selected from the comboBox
            //- and if we are not able to get it then it's better to exit
            string sName = string.Empty;
            if( selectedObj is Form ) {
                sName = ((Form) selectedObj).Name;
            }
            else if( selectedObj is Control ) {
                sName = ((Control) selectedObj).Site.Name;
            }
            if( string.IsNullOrEmpty( sName ) )
                return;



            //- prepare the data for reloading the combobox (begin)
            List<object> ctrlsToAdd = new List<object>();
            string pgrdComboBox_Text = string.Empty;
            try {
                ComponentCollection ctrlsExisting = host.Container.Components;
                Debug.Assert( 0 != ctrlsExisting.Count );


                foreach( Component comp in ctrlsExisting ) {
                    string sItemText = TranslateComponentToName( comp );
                    ctrlsToAdd.Add( sItemText );
                    if( sName == comp.Site.Name )
                        pgrdComboBox_Text = sItemText;
                }//end_foreach
            }
            catch( Exception ) {
                return; //- (rollback)
            }
            //- update the combobox (commit)
            pgrdComboBox.Items.Clear();
            pgrdComboBox.Items.AddRange( ctrlsToAdd.ToArray() );
            pgrdComboBox.Text = pgrdComboBox_Text;
        }
        finally {
            _bSuppressEvents = false;
        }
    }
コード例 #24
0
ファイル: Agent.cs プロジェクト: BantamJoe/unity_aisandbox
        // --------------------------------------------------------------------------------

        public virtual void Awake()
        {
            m_transform = GetComponent <Transform>();
            Debug.Assert(m_transform != null, "[Agent::Awake] GetComponent<Transform> failed\n");

            m_componentCollection = GetComponentInChildren <ComponentCollection>();
            Debug.Assert(m_componentCollection != null, "[Agent::Awake] GetComponent<ComponentCollection> failed\n");
        }
コード例 #25
0
        /// <include file='doc\UserNTServiceDesigner.uex' path='docs/doc[@for="UserNTServiceDesigner.OnAddInstallerVerb"]/*' />
        /// <devdoc>
        /// called when the user clicks the Add Installer hotlink for a service
        /// </devdoc>
        private void OnAddInstallerVerb(object sender, EventArgs e)
        {
            IComponent ourComponent = Component; // the thing we're the designer for.

            // find the Installer document in the project that holds all the installers.
            IDesignerHost host = InstallerDesign.GetProjectInstallerDocument(ourComponent);


            // create the ServiceInstaller for this service
            ServiceInstaller serviceInstaller = new ServiceInstaller();

            // make sure the installer knows about this service. This will add a new
            // ServiceInstaller to the Installers collection on the ServiceProcessInstaller.
            serviceInstaller.CopyFromComponent(ourComponent);

            // get the components in our container
            IContainer              container        = host.Container;
            ComponentCollection     components       = container.Components;
            ServiceProcessInstaller processInstaller = null;

            // see if there is already an equivalent installer added
            foreach (IComponent comp in components)
            {
                ServiceInstaller other = comp as ServiceInstaller;
                if (other != null)
                {
                    if (serviceInstaller.IsEquivalentInstaller(other))
                    {
                        InstallerDesign.SelectComponent(other);
                        return;
                    }
                }
            }

            // go through the installers in that document and look for a ServiceProcessInstaller
            foreach (IComponent comp in components)
            {
                if (comp is ServiceProcessInstaller)
                {
                    // we found one
                    processInstaller = (ServiceProcessInstaller)comp;
                    break;
                }
            }
            if (processInstaller == null)
            {
                // there weren't any UserNTServiceProcessInstallers.
                // create a new one, and add it to the document
                processInstaller = new ServiceProcessInstaller();
                container.Add(processInstaller);
            }

            // now add that installer to the document too.
            container.Add(serviceInstaller);

            // select it
            InstallerDesign.SelectComponent(serviceInstaller);
        }
コード例 #26
0
        public void AddWithoutNameViaExtension_IncreasesCount()
        {
            var collection = new ComponentCollection <int>
            {
                1,
            };

            Assert.AreEqual(1, collection.Count);
        }
コード例 #27
0
        public void AddWithDuplicateName_ThrowsArgumentException()
        {
            var collection = new ComponentCollection <int>
            {
                { "one", 1 },
            };

            Assert.Throws <ArgumentException>(() => collection.Add("one", 2));
        }
コード例 #28
0
        public static NetConnection GetConnection(this ComponentCollection components)
        {
            if (components == null)
            {
                throw new ArgumentNullException(nameof(components));
            }

            return(components.Get <Component <NetConnection> >().Entity);
        }
コード例 #29
0
 public XAopComponent FindFaceConfig(string face)
 {
     ComponentCollection.FindByFace(face);
     if (_componentCollection == null)
     {
         _componentCollection = (XAopComponentCollection)_configs.Find(XAopComponent.TAG);
     }
     return((_componentCollection != null) ? _componentCollection.FindByFace(face) : null);
 }
コード例 #30
0
        public static Player GetPlayer(this ComponentCollection components)
        {
            if (components == null)
            {
                throw new ArgumentNullException(nameof(components));
            }

            return(components.Get <Component <Player> >().Entity);
        }
コード例 #31
0
ファイル: GameScreen.cs プロジェクト: JllyGrnGiant/game_demo
        // Constructor takes name of component
        public GameScreen(string Name)
        {
            // Register with engine
            Components = new ComponentCollection(this);
            this.Name = Name;
            Engine.GameScreens.Add(this);

            // Initialize component
            if (!Initialized) { Initialize(); }
        }
コード例 #32
0
 private ComponentCollection GetComponentList(IPayLoad context)
 {
     IComponentManager manager = new ComponentsManager();
     var mc = new ComponentCollection();
     mc.Name = "Componets";
     var hostUrl = context.HostUrl;
     List<IComponent> list = manager.GetAllComponents();
     List<Component> components = new List<Component>();
     foreach (IComponent c in list)
     {
         string name = c.GetID();
         components.Add(new Component() { Name = name, Url = hostUrl + "component/" + name + context.Query });
     }
     components = components.OrderBy(o => o.Name).ToList();
     mc.Components = components;
     return mc;
 }
コード例 #33
0
 private ComponentCollection GetComponentList(IPayLoad context)
 {
     IComponentManager manager = new ComponentsManager();
     var mc = new ComponentCollection();
     mc.Name = "Componets";
     List<IComponent> list = manager.GetAllComponents();
     List<Component> components = new List<Component>();
     foreach (IComponent c in list)
     {
         string name = c.GetID();
         if (name == "fx.default" || name == "fx.allcomponents")
         {
             continue;
         }
         components.Add(new Component() { Name = name, Url = context.HostUrl + "components/" + name, Detail = AttributeHelper.GetComponentDetail(c) });
     }
     components = components.OrderBy(o => o.Name).ToList();
     mc.Components = components;
     return mc;
 }
コード例 #34
0
        private ComponentCollection GetConigurationList(IPayLoad context)
        {
            ConfigurationPayLoad config = context as ConfigurationPayLoad;
            var mc = new ComponentCollection();
            mc.Name = "Configurations";
            List<Component> components = new List<Component>();
            IConfigBeanManager manager = new ConfigBeanManager();
            List<IConfigBean> configList = manager.GetAllConfigBeans();
            foreach (IConfigBean c in configList)
            {
                string name = c.GetID();
                if (name == "fx.configuration.default")
                {
                    continue;
                }
                components.Add(new Component() { Name = name, Url = context.HostUrl + "configurations/beans/" + name });
            }

            //IConfigFile dirFile = new ConfigDirFile(config.AppPath);
            //if (dirFile.GetFileInfos() != null)
            //{
            //    foreach (FileInfo file in dirFile.GetFileInfos())
            //    {
            //        components.Add(new Component() { Name = file.Name, Url = context.HostUrl + "configurations/files/" + file.FileName() });
            //    }
            //}          
            //IConfigFile runFile = new ConfigRunDirFile(config.AppPath);
            //if (runFile.GetFileInfos() != null)
            //{
            //    foreach (FileInfo file in runFile.GetFileInfos())
            //    {
            //        components.Add(new Component() { Name = file.Name, Url = context.HostUrl + "configurations/files/" + file.FileName() });
            //    }
            //}
           
            components = components.OrderBy(o => o.Name).ToList();
            mc.Components = components;
            return mc;
        }
コード例 #35
0
ファイル: Arbiter.cs プロジェクト: venusdharan/systemsharp
 public Testbench()
 {
     _clkgen = new Clock(ClockCycle)
     {
         Clk = _clk
     };
     _arbiter = new Arbiter(NumMasters)
     {
         Clk = _clk,
         Request = _request,
         Grant = _grant
     };
     _masters = new ComponentCollection(CreateBusMasters());
 }
コード例 #36
0
 internal static void LoadComponentData(WebDomainData data, ComponentCollection componentCollection, String webDomainBasedOn)
 {
     List<ComponentElement> componentList = componentCollection.OrderBy(p => p.Priority).ToList();
     foreach (ComponentElement element in componentList)
     {
         ComponentData activeComponent = null;
         String componentType = element.ComponentType;
         String key = element.Key;
         ParameterDataList parameterDataList;
         //+ load
         if (String.IsNullOrEmpty(webDomainBasedOn))
         {
             parameterDataList = GetComponentParameterData(element.Parameters);
             //+
             activeComponent = new ComponentData
                               {
                                   ComponentType = componentType,
                                   Key = key,
                                   ParameterDataList = parameterDataList
                               };
             //+ No base
             data.ComponentDataList.Add(activeComponent);
         }
         else
         {
             //+ Has base
             ComponentElement newElement = element;
             //+ find new
             ComponentData existingData = data.ComponentDataList.FirstOrDefault(p => p.Key == key);
             componentType = existingData.ComponentType;
             activeComponent = existingData;
             if (existingData == null)
             {
                 continue;
             }
             if (String.IsNullOrEmpty(existingData.ComponentType))
             {
                 throw new InvalidOperationException(Resource.General_NotFound);
             }
             //+ copy new
             parameterDataList = existingData.ParameterDataList;
             if (newElement.Parameters.ResetCollection)
             {
                 parameterDataList = GetComponentParameterData(newElement.Parameters);
             }
             Boolean hasDifferentParameter = false;
             ComponentParameterCollection parameterCollection = newElement.Parameters;
             foreach (ParameterElement parameterElement in parameterCollection)
             {
                 ParameterData existingParameterData = parameterDataList.FirstOrDefault(p => p.Name == parameterElement.Name);
                 if (existingParameterData != null)
                 {
                     if (!parameterElement.Value.Equals(existingParameterData.Value))
                     {
                         hasDifferentParameter = true;
                     }
                     existingParameterData.Value = parameterElement.Value;
                 }
             }
             if (hasDifferentParameter)
             {
                 RemoveEachPartInstalledByComponent(data, key);
             }
         }
         //+
         try
         {
             var component = ObjectCreator.CreateAs<Component>(componentType);
             if (component == null)
             {
                 throw new EntityNotFoundException(String.Format(Resource.General_NotFound, componentType));
             }
             component.Key = key;
             //+
             if (component != null)
             {
                 if (!activeComponent.IsInstalled)
                 {
                     component.Connect(data.FactoryDataList, data.ProcessorDataList, data.EndpointDataList);
                     component.ParameterMap = parameterDataList.GetMap();
                     component.Register();
                     activeComponent.IsInstalled = true;
                 }
             }
         }
         catch (Exception ex)
         {
             if (WebProcessingReportController.Reporter.Initialized)
             {
                 var map = new Map();
                 map.Add("Section", "Component");
                 map.Add("Type", componentType);
                 map.Add("Message", ex.Message);
                 map.Add("Exception Type", ex.GetType().FullName);
                 //+
                 WebProcessingReportController.Reporter.AddMap(map);
             }
         }
     }
 }
コード例 #37
0
 private void AddAuthorizationsFromXml(XmlElement documentRoot, string xpath, string keyAttribute)
 {
     foreach (var authNode in documentRoot.SelectNodes(xpath).Cast<XmlNode>())
     {
         var key = authNode.Attributes[keyAttribute].Value;
         if (_map.ContainsKey(key))
         {
             throw new ArgumentException(key + " has already been added to the AuthorizationMap.", keyAttribute);
         }
         var sets = new List<ComponentCollection>();
         _map.Add(key, sets);
         foreach (var setNode in authNode.SelectNodes("ComponentSets/ComponentSet").Cast<XmlNode>())
         {
             var set = new ComponentCollection();
             sets.Add(set);
             foreach (var componentNode in setNode.SelectNodes("Component").Cast<XmlNode>())
             {
                 set.Add(int.Parse(componentNode.Attributes["id"].Value, CultureInfo.InvariantCulture));
             }
         }
     }
 }
コード例 #38
0
ファイル: CameraScheme.cs プロジェクト: kirlianstudios/armada
 public CameraScheme()
 {
     Cameras = new ComponentCollection<Id, ICamera>();
 }
コード例 #39
0
ファイル: TestLicense.cs プロジェクト: rickeygalloway/Test
            public void ComponentSet_Or()
            {
                //setup
                _mockClock.Setup(c => c.Now).Returns(new DateTime(2011, 9, 13));
                var license = License.FromXml(Load("LicenseGood.xml"));
                var componentSets = new List<ComponentCollection>();

                var set1 = new ComponentCollection {10, 11, 12};
                componentSets.Add(set1);

                var set2 = new ComponentCollection {99, 100, 101};
                componentSets.Add(set2);

                //assert
                Assert.IsTrue(license.IsAuthorized(componentSets, _mockClock.Object));
            }
	// Methods
	public virtual ComponentCollection FilterComponents(ComponentCollection components) {}
コード例 #41
0
ファイル: Component.cs プロジェクト: JllyGrnGiant/game_demo
 public ComponentDrawOrderChangedEventArgs(Component Component, int LastDrawOrder, ComponentCollection ParentCollection)
 {
     this.Component = Component;
     this.LastDrawOrder = LastDrawOrder;
     this.ParentCollection = ParentCollection;
 }
コード例 #42
0
 // Constructor sets local component list and order
 public ComponentEnumerator(ComponentCollection Collection, List<int> Order)
 {
     this.collection = Collection;
     this.ordered = Order;
 }
コード例 #43
0
ファイル: IdentityController.cs プロジェクト: anurse/MaVeriCk
 public IdentityController()
 {
     IdentitySources = new ComponentCollection<IdentitySource>();
 }
コード例 #44
0
 public void Add_Requires_Non_Null_Export()
 {
     ComponentCollection<DataContextFactory> collection = new ComponentCollection<DataContextFactory>();
     AutoTester.ArgumentNull<Export<DataContextFactory, ComponentMetadata>>(
         marker => collection.Add(marker));
 }