AspComponent CreateComponent(Foundry foundry, string tagName, string prefix, string tag) { string source, ns; Type type; type = foundry.GetType(tag, out source, out ns); if (type == null) { return(null); } AspComponent ret = new AspComponent(type, ns, prefix, source, foundry.FromConfig); Dictionary <string, AspComponent> components = Components; components.Add(tagName, ret); return(ret); }
public AspComponent GetComponent(string tagName) { if (tagName == null || tagName.Length == 0) { return(null); } if (components != null) { AspComponent ret; if (components.TryGetValue(tagName, out ret)) { return(ret); } } string foundryName, tag; int colon = tagName.IndexOf(':'); if (colon > -1) { if (colon == 0) { throw new Exception("Empty TagPrefix is not valid."); } if (colon + 1 == tagName.Length) { return(null); } foundryName = tagName.Substring(0, colon); tag = tagName.Substring(colon + 1); } else { foundryName = String.Empty; tag = tagName; } object o = foundries [foundryName]; if (o == null) { return(null); } Foundry foundry = o as Foundry; if (foundry != null) { return(CreateComponent(foundry, tagName, foundryName, tag)); } ArrayList af = o as ArrayList; if (af == null) { return(null); } AspComponent component = null; Exception e = null; foreach (Foundry f in af) { try { component = CreateComponent(f, tagName, foundryName, tag); if (component != null) { return(component); } } catch (Exception ex) { e = ex; } } if (e != null) { throw e; } return(null); }
AspComponent CreateComponent (Foundry foundry, string tagName, string prefix, string tag) { string source, ns; Type type; type = foundry.GetType (tag, out source, out ns); if (type == null) return null; AspComponent ret = new AspComponent (type, ns, prefix, source, foundry.FromConfig); Dictionary <string, AspComponent> components = Components; components.Add (tagName, ret); return ret; }