/// <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); }
public void ReadXmlComponentAvailableInterfaces(System.Xml.XmlReader reader, DanuComponent comp) { reader.Read(); while (reader.Read()) { if (!reader.Name.Equals("Interface") && !reader.Name.Equals("Available_Interfaces")) { DanuInterfaceObject io = GetInterface(reader.ReadContentAsString()); foreach (EshuInterface ioEshu in comp.Specification.Interfaces) { if (ioEshu.Name.Equals(io.Name)) { io.Eshu = ioEshu; } } comp.Interfaces.Add(io); } } reader.Close(); }
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(); }
public void ReadXmlComponentImplements(System.Xml.XmlReader reader, DanuComponent comp) { reader.Read(); while (reader.Read()) { if (reader.Name.Equals("Interface")) { DanuInterfaceObject io = GetInterface(reader.ReadElementString()); DanuSocket so = new DanuSocket(comp, io); AddSocket(so); foreach (DanuComponent checkComp in Components) { if (checkComp.Interfaces.Contains(io)) { io.Eshu.Parent = checkComp.Specification.Classes.FirstOrDefault(); io.Eshu.ImplementingParents.Add(checkComp.Specification.Classes.FirstOrDefault()); } } } } reader.Close(); }
public DanuSocket(DanuComponent parent, DanuInterfaceObject interfaceUsed) { this.parent = parent; this.interfaceUsed = interfaceUsed; }