Esempio n. 1
0
 public DanuInterfaceObject(string name, DanuBindingTime bindingTime, int minVar, int maxVar)
 {
     this.name        = name;
     this.bindingTime = bindingTime;
     this.minVar      = minVar;
     this.maxVar      = maxVar;
     relatedSockets   = new Dictionary <DanuComponent, DanuSocket>();
     possibleSockets  = new List <DanuComponent>();
 }
Esempio n. 2
0
        /// <summary>
        /// Adds Interface to Danu. Adds its name, minVar, maxVar and bindingTime.
        /// </summary>
        public void AddInterface(InterfaceObject io)
        {
            SMartyBindingTimeTypes bindingTime    = default(SMartyBindingTimeTypes);
            DanuBindingTime        newBindingTime = default(DanuBindingTime);
            SMarty attach = null;

            foreach (IAttachment attachment in io.Attachments)
            {
                if (attachment.GetType().Equals(typeof(SMarty)))
                {
                    attach = (SMarty)attachment;
                }
            }

            int minVar = attach.MinSelection;
            int maxVar = attach.MaxSelection;

            foreach (IAttachment attachment in io.Attachments)
            {
                if (attachment.GetType().Equals(typeof(SMarty)))
                {
                    SMarty smarty = (SMarty)attachment;
                    bindingTime = smarty.BindingTime;
                    minVar      = smarty.MinSelection;
                    maxVar      = smarty.MaxSelection;
                    break;
                }
            }

            if (!bindingTime.Equals(default(SMartyBindingTimeTypes)))
            {
                switch (bindingTime)
                {
                case SMartyBindingTimeTypes.CompileTime:
                    newBindingTime = DanuBindingTime.CompileTime;
                    break;

                case SMartyBindingTimeTypes.LinkingTime:
                    newBindingTime = DanuBindingTime.LinkingTime;
                    break;

                case SMartyBindingTimeTypes.Runtime:
                    newBindingTime = DanuBindingTime.Runtime;
                    break;

                case SMartyBindingTimeTypes.UpdateTime:
                    newBindingTime = DanuBindingTime.UpdateTime;
                    break;
                }
            }

            DanuInterfaceObject newInterface = new DanuInterfaceObject(io.Name, newBindingTime, minVar, maxVar);

            interfaces.Add(newInterface.Name, newInterface);
        }
Esempio n. 3
0
        public void ReadXmlInterfaces(System.Xml.XmlReader reader)
        {
            reader.Read();

            while (reader.Read())
            {
                if (reader.IsStartElement())
                {
                    DanuBindingTime btype = default(DanuBindingTime);

                    switch (reader["BindingTime"])
                    {
                    case "Runtime":
                        btype = DanuBindingTime.Runtime;
                        break;

                    case "LinkingTime":
                        btype = DanuBindingTime.LinkingTime;
                        break;

                    case "CompileTime":
                        btype = DanuBindingTime.CompileTime;
                        break;

                    case "UpdateTime":
                        btype = DanuBindingTime.UpdateTime;
                        break;
                    }

                    DanuInterfaceObject io = new DanuInterfaceObject(reader["Name"], btype,
                                                                     int.Parse(reader["MinVar"]), int.Parse(reader["MaxVar"]));

                    this.interfaces.Add(io.Name, io);
                }
            }

            reader.Close();
        }