private static void read_library (ShaderLibrary effect, XElement element) { foreach(XElement e in element.Elements()) { if (e.Name.LocalName.ToLower() == "source") { Source source = new Source(); read_source(source, e); effect.sources.Add(source); } if (e.Name.LocalName.ToLower() == "program") { Program program = new Program(); read_program(program, e); effect.programs.Add(program); } } }
private static void read_source (Source source, XElement element) { foreach (XAttribute a in element.Attributes()) { if (a.Name == "id") source.ID = a.Value; } source.Code = element.Value; }