Beispiel #1
0
        /// <summary>
        /// Instantiate SocketUses based on the xml definition
        /// </summary>
        internal void CreateSocketUses()
        {
            var modDef = this.GadgeteerPartDefinition as ModuleDefinition;

            if (modDef == null)
            {
                return;
            }

            if (modDef.Sockets.Count == 0)
            {
                return;
            }

            SocketUses.Clear();

            foreach (var socketDef in modDef.Sockets)
            {
                var s = new SocketUse(this.Store)
                {
                    Label = socketDef.TypesLabel
                };
                this.SocketUses.Add(s);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Instantiate SocketUses based on the xml definition
        /// </summary>
        internal void CreateSocketUses()
        {
            var modDef = this.GadgeteerPartDefinition as ModuleDefinition;

            if (modDef == null)
            {
                return;
            }

            if (modDef.Sockets.Count == 0)
            {
                return;
            }

            var needsUnique = new Dictionary <string, bool>(modDef.Sockets.Count);

            foreach (var socketDef in modDef.Sockets)
            {
                needsUnique[socketDef.TypesLabel] = needsUnique.ContainsKey(socketDef.TypesLabel);
            }

            SocketUses.Clear();

            foreach (var socketDef in modDef.Sockets)
            {
                var s = new SocketUse(this.Store)
                {
                    Label = needsUnique[socketDef.TypesLabel] ? socketDef.UniqueLabel : socketDef.TypesLabel
                };

                this.SocketUses.Add(s);
            }
        }