public static ItemList GetItemList(string databaseSelect) { string rule = databaseSelect + @"\DatabaseRule.xml"; string data = databaseSelect + @"\DatabaseSelectorConfig.xml"; Digester dig = new Digester(); try { dig.Configure(rule); } catch (Exception e) { throw e; } var list = (ItemList)dig.Parse(data); return list; }
public static ItemList GetItemList(string databaseSelect) { string rule = databaseSelect + @"\DatabaseRule.xml"; string data = databaseSelect + @"\DatabaseSelectorConfig.xml"; Digester dig = new Digester(); try { dig.Configure(rule); } catch (Exception e) { throw e; } var list = (ItemList)dig.Parse(data); return(list); }
public static BundleData CreateBundleData(string manifestFile, Stream manifestFileStream) { BundleData data2; Stopwatch stopwatch = new Stopwatch(); Stream stream = new MemoryStream(); StreamWriter writer = new StreamWriter(stream, GetEncoding(manifestFileStream)); try { stopwatch.Start(); string content = new StreamReader(manifestFileStream).ReadToEnd(); content = ReplaceConstants(manifestFile, content); writer.Write(content); writer.Flush(); stream.Seek(0L, SeekOrigin.Begin); BundleData data = (BundleData)_bundleDataDigester.Parse(new XmlTextReader(stream)); stream.Seek(0L, SeekOrigin.Begin); XmlDocument doc = new XmlDocument(); doc.Load(stream); string xmlNamespace = XmlUtility.GetNamespace(doc); XmlNamespaceManager xmlnsMgr = XmlUtility.CreateXmlNamespaceManager(doc, xmlNamespace); bool withNamespace = !string.IsNullOrEmpty(xmlNamespace); data.ExtensionPoints.ForEach(delegate(ExtensionPointData item) { string xpath = string.Format((withNamespace ? "/ebm2:Bundle/ebm2:ExtensionPoint" : "/Bundle/ExtensionPoint") + "[@Point='{0}']", item.Point); GetChildNode(doc.SelectNodes(xpath, xmlnsMgr), childNode => item.ChildNodes.Add(childNode)); }); data.Extensions.ForEach(delegate(ExtensionData item) { string xpath = string.Format((withNamespace ? "/ebm2:Bundle/ebm2:Extension" : "/Bundle/Extension") + "[@Point='{0}']", item.Point); GetChildNode(doc.SelectNodes(xpath, xmlnsMgr), childNode => item.ChildNodes.Add(childNode)); }); data2 = data; } finally { stopwatch.Stop(); manifestFileStream.Close(); stream.Close(); writer.Close(); FileLogUtility.Verbose(string.Format(Messages.ParseManifestTimeCounter, stopwatch.ElapsedMilliseconds, manifestFile)); } return(data2); }