public override bool Equals(Object rhs) { if (rhs == this) { return(true); } if (rhs is JsLibrary) { JsLibrary lib = (JsLibrary)rhs; return(content.Equals(lib.content) && type.Equals(lib.type)); } return(false); }
private void ProcessContext(ParsedFeature feature, XmlElement context, RenderingContext renderingContext) { String container = XmlUtil.getAttribute(context, "container", ContainerConfig.DEFAULT_CONTAINER); XmlNodeList libraries = context.GetElementsByTagName("script"); foreach (XmlElement script in libraries) { bool inlineOk = XmlUtil.getBoolAttribute(script, "inline", true); String source = XmlUtil.getAttribute(script, "src"); String content; JsLibrary.Type type; if (source == null) { type = JsLibrary.Type.INLINE; content = script.InnerText; } else { content = source; if (content.StartsWith("http://")) { type = JsLibrary.Type.URL; } else if (content.StartsWith("//")) { type = JsLibrary.Type.URL; content = content.Substring(1); } else if (content.StartsWith("res://")) { Debug.Assert(true); // should never reach here content = content.Substring(6); type = JsLibrary.Type.RESOURCE; } else { content = feature.BasePath + content; type = JsLibrary.Type.FILE; } } JsLibrary library = JsLibrary.Create(type, content, feature.Name, inlineOk ? fetcher : null); foreach (String cont in container.Split(',')) { feature.AddLibrary(renderingContext, cont.Trim(), library); } } }
public void AddLibrary(RenderingContext ctx, String cont, JsLibrary library) { Dictionary <String, List <JsLibrary> > ctxLibs; if (!libraries.TryGetValue(ctx, out ctxLibs)) { ctxLibs = new Dictionary <String, List <JsLibrary> >(); libraries.Add(ctx, ctxLibs); } List <JsLibrary> containerLibs; if (!ctxLibs.TryGetValue(cont, out containerLibs)) { containerLibs = new List <JsLibrary>(); ctxLibs.Add(cont, containerLibs); } containerLibs.Add(library); }
public void AddLibrary(RenderingContext ctx, String cont, JsLibrary library) { Dictionary<String, List<JsLibrary>> ctxLibs; if (!libraries.TryGetValue(ctx, out ctxLibs)) { ctxLibs = new Dictionary<String, List<JsLibrary>>(); libraries.Add(ctx, ctxLibs); } List<JsLibrary> containerLibs; if (!ctxLibs.TryGetValue(cont, out containerLibs)) { containerLibs = new List<JsLibrary>(); ctxLibs.Add(cont, containerLibs); } containerLibs.Add(library); }