public XReader(XmlDocument xdoc) { rootDoc = xdoc; fullPath = null; nodePtr = new XReader(); Load(rootDoc, NodeReaderType.Node, true); }
public object RereadConfigFile() { string rlt = "", script = ""; XReader xr = new XReader(); XReader xrClient; xr.Load(AppDomain.CurrentDomain.BaseDirectory + "ClientLib.Config"); xrClient = xr.Reset()["configuration"]["client"]; string defType = xrClient.Reset()["$DefaultScriptType"].Value; string clientBasePath = xrClient.Reset()["$BaseUrl"].Value; if (!string.IsNullOrEmpty(clientBasePath) && clientBasePath[clientBasePath.Length - 1] != '/') { clientBasePath += '/'; } foreach (XReader cx in xrClient) { if (string.IsNullOrEmpty(defType)) { defType = "text/javascript"; } if (cx.Name == "Script") { rlt += "<script src='" + clientBasePath + cx.Reset()["$url"].Value + "' type='" + defType + "'></script>\n"; } } script += "<script type='text/javascript'>"; script += "var FC$ = {BaseUrl:'" + clientBasePath + "'};"; script += "</script>"; rlt = script + rlt; return rlt; }
public XReader(string xmlfile) { rootDoc = new XmlDocument(); if (!File.Exists(xmlfile)) { StreamWriter sw = File.CreateText(xmlfile); sw.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); sw.WriteLine("<root></root>"); sw.Close(); } rootDoc.Load(xmlfile); fullPath = xmlfile; nodePtr = new XReader(); Load(rootDoc, NodeReaderType.Node, true); }
public override object AddValue(string key, object value) { object o = base.AddValue(key, value); XReader rlt = new XReader(o, rootDoc); return rlt; }