private static string extractMessage(string exceptionFile) { System.Text.StringBuilder retVal = new System.Text.StringBuilder(); try { System.Xml.XPath.XPathDocument doc = new System.Xml.XPath.XPathDocument(exceptionFile); System.Xml.XPath.XPathNavigator nav = doc.CreateNavigator(); System.Xml.XPath.XPathNodeIterator iter = nav.Select(@"/*/ServiceException"); while (iter.MoveNext()) { if (retVal.Length > 0) { retVal.Append(System.Environment.NewLine); } System.Xml.XPath.XPathNodeIterator attIter = iter.Current.Select(@"/code|/Code|/CODE"); if (attIter.MoveNext()) { retVal.Append("(" + iter.Current.Value.Trim() + ") "); } retVal.Append(iter.Current.Value.Trim()); } } catch (System.Exception) { retVal.Append("Unable to extract the error description from the information returned by the WMS server."); } return(retVal.ToString()); }
private void updateConfigXml() { // Write install path to config file string xmlPath = Path.Combine(getInstallDir(), "Jitsi Meet Outlook Add-In.dll.config"); XmlDocument document = new XmlDocument(); document.Load(xmlPath); System.Xml.XPath.XPathNavigator navigator = document.CreateNavigator(); if (getDomain().Length != 0) { navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='Domain']/value").SetValue(getDomain()); } if (getRoomID().Length != 0) { navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='roomID']/value").SetValue(getRoomID()); } navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='requireDisplayName']/value").SetValue(getRequireDisplayName()); navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='startWithAudioMuted']/value").SetValue(getStartWithAudioMuted()); navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='startWithVideoMuted']/value").SetValue(getStartWithVideoMuted()); navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='installDirectory']/value").SetValue(getInstallDir()); navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='language']/value").SetValue(getLanguage()); document.Save(xmlPath); }
private void Init() { try { string basepath = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", "").Replace("/", @"\"); basepath = System.IO.Path.GetDirectoryName(basepath) + @"\"; GameCatalogSerializer gcs = new GameCatalogSerializer(); System.Xml.XmlDocument doc = gcs.Serialize(games); System.Xml.XPath.XPathNavigator nav = doc.CreateNavigator(); System.Xml.Xsl.XslTransform xt = new System.Xml.Xsl.XslTransform(); System.Xml.XmlResolver res = new System.Xml.XmlUrlResolver(); System.IO.StringWriter writer = new System.IO.StringWriter(); System.Xml.Xsl.XsltArgumentList args = new System.Xml.Xsl.XsltArgumentList(); System.Xml.XmlNameTable xnt = new System.Xml.NameTable(); System.Xml.XmlReader xslt = new System.Xml.XmlTextReader(new System.IO.StreamReader(basepath + "GameList.xslt"), xnt); xt.Load(xslt, res, new System.Security.Policy.Evidence()); xt.Transform(nav, args, writer, res); string html = writer.ToString(); WriteHTML(html); } catch (Exception ex) { string error = "There was an error generating HTML"; Exception xe = ex; while (xe != null) { error += "<p><b>" + xe.Message + "</b><br><pre>" + xe.StackTrace + "</pre></p>\r\n"; } WriteHTML(error); } }
bool IReflectorPersistance.Load(System.Xml.XPath.XPathNavigator r) { if (r.Name == "BoardPlugins") { bool everokay = false; bool okay; for (okay = r.MoveToFirstAttribute(); okay; okay = r.MoveToNext()) { everokay = true; try { Assembly a = Assembly.LoadFile(r.Value); LoadPeices(a); assemblies.Add(a); } catch { } } if (everokay) { r.MoveToParent(); } return(true); } //throw new NotImplementedException(); return(false); }
bool IReflectorPersistance.Load(System.Xml.XPath.XPathNavigator r) { if (tracker == null) { return(false); } switch (r.Name) { case "SQL_Security": bool everokay = false; bool okay; for (okay = r.MoveToFirstChild(); okay; okay = r.MoveToNext()) { everokay = true; r.MoveToFirstChild(); tracker.tokens.Add(r.Value as String); r.MoveToParent(); //r.Get } if (everokay) { r.MoveToParent(); } return(true); } //throw new Exception( "The method or operation is not implemented." ); return(false); }
internal Provider(System.Xml.XPath.XPathNavigator nav) { this._ProviderName = nav.GetAttribute("name", String.Empty);//.Value; this._ProviderType = nav.GetAttribute("type", String.Empty); var ns = nav.SelectChildren(System.Xml.XPath.XPathNodeType.Element); if (nav.MoveToFirstAttribute()) { if ((nav.Name != "name") & (nav.Name != "type")) { this._ProviderAttributes.Add(nav.Name, nav.Value); } while (nav.MoveToNextAttribute()) { if ((nav.Name != "name") & (nav.Name != "type")) { this._ProviderAttributes.Add(nav.Name, nav.Value); } } } while (ns.MoveNext()) { this._ProviderAttributes.Add(ns.Current.Name, ns.Current.Value); } }
/// <summary> /// Gets the attribute as double. /// </summary> /// <param name="stdnavi">The navigator.</param> /// <param name="attributeName">Name of the attribute.</param> /// <param name="expectEnglish">The expect english.</param> /// <returns></returns> public static double?GetAttributeAsDouble(this System.Xml.XPath.XPathNavigator stdnavi, string attributeName, bool expectEnglish = true) { if (null != stdnavi) { try { string tmp = stdnavi.GetAttribute(attributeName, string.Empty); if (expectEnglish) { if (!string.IsNullOrEmpty(tmp)) { return(DataTypeConverter.DoubleConverter.ParseInvariantCulture(tmp)); } } else { if (!string.IsNullOrEmpty(tmp)) { return(DataTypeConverter.DoubleConverter.Parse(tmp)); } } } catch { } } return(null); }
public static ProviderConfiguration GetProvider(System.Xml.XPath.XPathNavigator nav) { ProviderConfiguration providers = new ProviderConfiguration(); providers.GetProviders(nav); return(providers); }
protected override void ProcessFile(InstallFile file, System.Xml.XPath.XPathNavigator nav) { if (file != null) { Files.Add(file); } }
/// <summary> /// Gets the attribute as string. /// </summary> /// <param name="stdnavi">The navigator.</param> /// <param name="attributeName">Name of the attribute.</param> /// <param name="selectPath">The select path (or null if no path adjustment needed).</param> /// <param name="defaultValue">The default value.</param> /// <returns></returns> public static string GetAttributeAsString(this System.Xml.XPath.XPathNavigator stdnavi, string attributeName, string selectPath, string defaultValue) { if (null != stdnavi) { try { string tmp; if (null != selectPath) { System.Xml.XPath.XPathNavigator navi = AdjustNaviIfNeeded(stdnavi, selectPath); tmp = navi.GetAttribute(attributeName, string.Empty); } else { tmp = stdnavi.GetAttribute(attributeName, string.Empty); } if (string.IsNullOrEmpty(tmp)) { return(defaultValue); } return(tmp); } catch { } } return(defaultValue); }
private bool ParseResponse() { try { System.IO.MemoryStream stream = new System.IO.MemoryStream(); System.IO.StreamWriter writer = new System.IO.StreamWriter(stream); writer.Write(sResponse); writer.Flush(); stream.Position = 0; System.Xml.XPath.XPathDocument doc = new System.Xml.XPath.XPathDocument(stream); System.Xml.XPath.XPathNavigator nav = doc.CreateNavigator(); String sValue = nav.SelectSingleNode("/node/isMaster/text()").Value; nav = null; doc = null; stream.Close(); stream = null; return(Boolean.Parse(sValue)); } catch (Exception ex) { Trace.TraceWarning("Exception: " + ex.Message + Environment.NewLine + "StackTrace: " + ex.StackTrace); return(false); } }
Digest.Model.WebReferenceUrl[] getWebReferenceUrls(DirectoryInfo folder, string currentPath) { string relPath = Path.Combine(currentPath, folder.Name); string url = string.Empty; List <Digest.Model.WebReferenceUrl> webReferenceUrls = new List <Digest.Model.WebReferenceUrl>(); FileInfo[] fileInfo = folder.GetFiles("*.discomap"); if (fileInfo != null && fileInfo.Length > 0) { System.Xml.XPath.XPathDocument xDoc = new System.Xml.XPath.XPathDocument(fileInfo[0].FullName); System.Xml.XPath.XPathNavigator xNav = xDoc.CreateNavigator(); string xpathExpression = @"DiscoveryClientResultsFile/Results/DiscoveryClientResult[@referenceType='System.Web.Services.Discovery.ContractReference']/@url"; System.Xml.XPath.XPathNodeIterator xIter = xNav.Select(xpathExpression); if (xIter.MoveNext()) { url = xIter.Current.TypedValue.ToString(); } } if (!string.IsNullOrEmpty(url)) { Digest.Model.WebReferenceUrl newWebReferenceUrl = new Digest.Model.WebReferenceUrl(); newWebReferenceUrl.RelPath = relPath; newWebReferenceUrl.UpdateFromURL = url; webReferenceUrls.Add(newWebReferenceUrl); } foreach (DirectoryInfo dirInfo in folder.GetDirectories()) { webReferenceUrls.AddRange(getWebReferenceUrls(dirInfo, relPath)); } return(webReferenceUrls.ToArray()); }
void GetProviders(System.Xml.XPath.XPathNavigator nav1) { var navProviders = nav1.Select("providers"); while (navProviders.MoveNext()) { var navs = navProviders.Current.SelectChildren(System.Xml.XPath.XPathNodeType.Element); while (navs.MoveNext()) { var cur = navs.Current.Clone(); string name = cur.GetAttribute("name", string.Empty); switch (cur.Name.ToLower()) { case "add": this.Providers[name] = new Provider(cur); break; case "remove": this.Providers.Remove(name); break; case "clear": this.Providers.Clear(); break; } } } }
private void Display() { this.Cursor = Cursors.WaitCursor; XslCompiledTransform xsl = new XslCompiledTransform(); xsl.Load(ApplicationSettings.Instance.AppPath + @"\contacts.xslt"); // AppPath is startup and true app path if (webBrowser1.Document != null) { m_scrollTop = webBrowser1.Document.Body.ScrollTop; m_scrollLeft = webBrowser1.Document.Body.ScrollLeft; } XsltArgumentList argList = new XsltArgumentList(); argList.AddParam("systemPath", "", ApplicationSettings.Instance.AppPath); argList.AddParam("dataPath", "", ApplicationSettings.Instance.LocalDataPath); argList.AddParam("contactFilter", "", m_contactFilter); argList.AddParam("scrollTop", "", m_scrollTop.ToString()); XmlDocument outputDocument = new XmlDocument(); System.Xml.XPath.XPathNavigator outputNavigator = outputDocument.CreateNavigator(); using (XmlWriter writer = outputNavigator.AppendChild()) { xsl.Transform(Contacts.Instance.XMLDoc, argList, writer); } webBrowser1.DocumentText = outputDocument.OuterXml; }
public static void FillParams(Param[] @params, System.Xml.XPath.XPathNavigator nav) { for (int i = 0; i < @params.Length; i++) { @params[i].Value = nav.GetAttribute(@params[i].Name, ""); } }
public bool Load(System.Xml.XPath.XPathNavigator r) { if (r.Name == "BoardInformation") { foreach (Type root_type in BoardPlugin.RootPeiceTypes) { if (r.Value == root_type.ToString()) { // call the property to setup other stuff peices = BoardPlugin.PeiceTypes[root_type]; if (layers == null) { layers = new LinkedList <Layer>(); } layers.Clear(); layers.AddLast(background = new Layer(this, peices[0])); background.flags.bRoot = true; background.peice_instance = background.peice.CreateInstance(null, null); } } if (r.MoveToFirstChild()) { do { if (r.Name == "Peice") { foreach (PeiceRepresentation peice in peices) { if (r.Value == peice.GetType().ToString()) { r.MoveToFirstChild(); peice.Load(r); r.MoveToParent(); break; } } } }while(r.MoveToNext()); r.MoveToParent(); } if (r.MoveToFirstAttribute()) { do { if (r.Name == "CellWidth") { cell_width = r.ValueAsInt; } if (r.Name == "CellHeight") { cell_height = r.ValueAsInt; } } while(r.MoveToNextAttribute()); r.MoveToParent(); } return(true); } return(false); }
void TLogTranslateItem_OnBeforeRuleProcess(object sender, EventArgs e) { XmlDocument doc = (XmlDocument)sender; System.Xml.XPath.XPathNavigator nav = doc.CreateNavigator(); Shipping = doc.SelectSingleNode("CustomerOrder/Customer/@Shipping_Price") == null ? 0 : Convert.ToDouble(doc.SelectSingleNode("CustomerOrder/Customer/@Shipping_Price").Value); TaxableShipping = doc.SelectSingleNode("CustomerOrder/Customer/@Taxable_Shipping_Amount") == null ? 0 : Convert.ToDouble(doc.SelectSingleNode("CustomerOrder/Customer/@Taxable_Shipping_Amount").Value); Handling = Convert.ToDouble(nav.Evaluate("sum(//*/@Handling_Charge)")); }
bool IReflectorPersistance.Load(System.Xml.XPath.XPathNavigator r) { if (r.Name == "listbox_filter") { inventory_type_filter = r.Value; return(true); } return(false); }
public bool Load(System.Xml.XPath.XPathNavigator r) { if (r.Name == "playsound_file") { SoundFile = r.Value; return(true); } return(false); }
internal static Layer[] GetLayers(System.Xml.XPath.XPathNavigator parentNode, Server server) { // The incoming parentNode might not be a Layer node, but we assume it is here in // order to re-use the Layers property of the Layer class. If parentNode has // no Layer children, then the Layers property returns an empty array. Layer layerParent = new Layer(parentNode, server); return(layerParent.Layers); }
public static System.Xml.XPath.XPathNodeIterator GetNodeIt(System.Xml.XPath.XPathNavigator xnav, string xPath, System.Xml.XmlNamespaceManager nsmgr) { System.Xml.XPath.XPathExpression xpathExpr = xnav.Compile(xPath); if (nsmgr != null) { xpathExpr.SetContext(nsmgr); } return(xnav.Select(xpathExpr)); }
private static System.Xml.XmlNamespaceManager GetReportNamespaceManager(System.Xml.XmlDocument doc) { if (doc == null) { throw new System.ArgumentNullException(nameof(doc)); } System.Xml.XmlNamespaceManager nsmgr = new System.Xml.XmlNamespaceManager(doc.NameTable); // <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"> if (doc.DocumentElement != null) { // string strNamespace = doc.DocumentElement.NamespaceURI; // System.Console.WriteLine(strNamespace); // nsmgr.AddNamespace("dft", strNamespace); System.Xml.XPath.XPathNavigator xNav = doc.CreateNavigator(); while (xNav.MoveToFollowing(System.Xml.XPath.XPathNodeType.Element)) { System.Collections.Generic.IDictionary <string, string> localNamespaces = xNav.GetNamespacesInScope(System.Xml.XmlNamespaceScope.Local); foreach (System.Collections.Generic.KeyValuePair <string, string> kvp in localNamespaces) { string prefix = kvp.Key; if (string.IsNullOrEmpty(prefix)) { prefix = "dft"; } nsmgr.AddNamespace(prefix, kvp.Value); } // Next kvp } // Whend //System.Xml.XmlNodeList _xmlNameSpaceList = doc.SelectNodes(@"//namespace::*[not(. = ../../namespace::*)]"); //foreach (System.Xml.XmlNode currentNamespace in _xmlNameSpaceList) //{ // if (StringComparer.InvariantCultureIgnoreCase.Equals(currentNamespace.LocalName, "xmlns")) // { // nsmgr.AddNamespace("dft", currentNamespace.Value); // } // else // nsmgr.AddNamespace(currentNamespace.LocalName, currentNamespace.Value); //} return(nsmgr); } // End if (doc.DocumentElement != null) nsmgr.AddNamespace("dft", "http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition"); // nsmgr.AddNamespace("dft", "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition"); return(nsmgr); } // End Function GetReportNamespaceManager
public bool Load(System.Xml.XPath.XPathNavigator r) { if (r.Name == "TimerProperties") { sound_file = r.Value; return(true); } return(false); }
internal static string[] GetStringsInstance(System.Xml.XPath.XPathNavigator node, string selectPattern) { System.Xml.XPath.XPathNodeIterator iter = node.Select(ExpandPattern(selectPattern)); string[] retVal = new string[iter.Count]; while (iter.MoveNext()) { retVal[iter.CurrentPosition - 1] = iter.Current.Value; } return(retVal); }
bool IReflectorPersistance.Load(System.Xml.XPath.XPathNavigator r) { if (board == null) { board = new Board(); board.Width = Width; board.Height = Height; } return(board.Load(r)); }
public TowerData(System.Xml.XPath.XPathNavigator xml) { Price = float.Parse(xml.GetAttribute("Price", "")); Name = xml.GetAttribute("Name", ""); ShutdownHeat = float.Parse(xml.GetAttribute("ShutdownHeat", "")); HeatDecay = float.Parse(xml.GetAttribute("HeatDecay", "")); XAML = xml.InnerXml; }
bool IReflectorPersistance.Load(System.Xml.XPath.XPathNavigator r) { if (r.Name == "POS.plugin") { xperdex.core.osalot.AssemblyTracker tracker; POS.Local.LoadAssembly(r.Value, out tracker); return(true); } return(false); }
// // .ctor // public System.Xml.XPath.XPathNavigator TransformData(System.Xml.XPath.XPathNavigator nav, int cacheduration, IPDFDataSource source, PDFDataContext context) { //Check we have something to use for a transformation. if (string.IsNullOrEmpty(this.XSLTPath) && null == this.Transformer) { return(nav); } System.Xml.XmlWriter xmlWriter = null; System.IO.MemoryStream memoryStream = null; System.IO.StreamWriter streamWriter = null; System.Xml.XmlDocument result = null; System.Xml.XmlDocument output = new System.Xml.XmlDocument(); try { System.Xml.Xsl.XslCompiledTransform trans = this.DoGetTransformer(cacheduration, source, context); System.Xml.Xsl.XsltArgumentList args = this.DoGetArguments(context); memoryStream = new System.IO.MemoryStream(); streamWriter = new System.IO.StreamWriter(memoryStream, Encoding.UTF8); System.Xml.XmlWriterSettings writerSettings = CreateWriterSettings(); xmlWriter = System.Xml.XmlWriter.Create(streamWriter, writerSettings); trans.Transform(nav, args, xmlWriter); xmlWriter.Flush(); streamWriter.Flush(); result = new System.Xml.XmlDocument(); memoryStream.Position = 0; result.Load(memoryStream); } catch (Exception ex) { throw new PDFDataException(Errors.CouldNotTransformInputData, ex); } finally { if (null != xmlWriter) { xmlWriter.Close(); } if (null != streamWriter) { streamWriter.Dispose(); } if (null != memoryStream) { memoryStream.Dispose(); } } return(result.CreateNavigator()); }
bool IReflectorPersistance.Load(System.Xml.XPath.XPathNavigator r) { switch (r.Name) { case "MILK_Config": ConfigName = r.Value; canvas.Load(ConfigName); return(true); } return(false); }
/// <summary> /// Populates a rule condition /// </summary> /// <param name="ConditionNode"></param> /// <returns></returns> private RuleCondition PopulateCondition(XmlNode ConditionNode) { RuleCondition condition = new RuleCondition(); System.Xml.XPath.XPathNavigator nav = ConditionNode.CreateNavigator(); condition.Expression = nav.SelectSingleNode(TranslateExpressionCache.GetXpathExpression("Expression")).InnerXml; condition.ID = ConditionNode.Attributes["id"] == null ? "" : ConditionNode.Attributes["id"].Value.ToString(); condition.Name = ConditionNode.Attributes["name"] == null ? "" : ConditionNode.Attributes["name"].Value.ToString(); condition.Destination = nav.SelectSingleNode(TranslateExpressionCache.GetXpathExpression("Destination")).InnerXml; XmlNode DestinationNode = ConditionNode.SelectSingleNode("Destination"); if (DestinationNode.Attributes != null && DestinationNode.Attributes["format"] != null) { condition.format = DestinationNode.Attributes["format"].Value; condition.type = Type.GetType(String.Format(DestinationNode.Attributes["type"].Value), true, true); } //Populate attributes for true values XmlNode ConditionTrueNode = ConditionNode.SelectSingleNode("True"); if (ConditionTrueNode != null) { condition.TrueValue.Value = ConditionTrueNode.InnerXml; condition.TrueValue.ExpressionSource = ConditionTrueNode.Attributes["ExpressionSource"] == null ? "" : ConditionTrueNode.Attributes["ExpressionSource"].Value; condition.TrueValue.isExpression = ConditionTrueNode.Attributes["isExpression"] == null ? false : Convert.ToBoolean(ConditionTrueNode.Attributes["isExpression"].Value); condition.TrueValue.UseDefault = ConditionTrueNode.Attributes["UseDefault"] == null ? false : Convert.ToBoolean(ConditionTrueNode.Attributes["UseDefault"].Value); condition.TrueValue.ContunueProcessing = ConditionTrueNode.Attributes["ContinueProcessing"] == null ? true : Convert.ToBoolean(ConditionTrueNode.Attributes["ContinueProcessing"].Value); condition.TrueValue.Actionid = ConditionTrueNode.Attributes["Actionid"] == null ? "" : ConditionTrueNode.Attributes["Actionid"].Value; condition.TrueValue.ContinueTransaction = ConditionTrueNode.Attributes["ContinueTransaction"] == null ? true : Convert.ToBoolean(ConditionTrueNode.Attributes["ContinueTransaction"].Value); } //populate attributes for false values XmlNode ConditionFalseNode = ConditionNode.SelectSingleNode("False"); if (ConditionFalseNode != null) { condition.FalseValue.Value = ConditionFalseNode.InnerXml; condition.FalseValue.ExpressionSource = ConditionFalseNode.Attributes["ExpressionSource"] == null ? "" : ConditionFalseNode.Attributes["ExpressionSource"].Value; condition.FalseValue.isExpression = ConditionFalseNode.Attributes["isExpression"] == null ? false : Convert.ToBoolean(ConditionFalseNode.Attributes["isExpression"].Value); condition.FalseValue.UseDefault = ConditionFalseNode.Attributes["UseDefault"] == null ? false : Convert.ToBoolean(ConditionFalseNode.Attributes["UseDefault"].Value);; condition.FalseValue.ContunueProcessing = ConditionFalseNode.Attributes["ContinueProcessing"] == null ? true : Convert.ToBoolean(ConditionFalseNode.Attributes["ContinueProcessing"].Value); condition.FalseValue.Actionid = ConditionFalseNode.Attributes["Actionid"] == null ? "" : ConditionFalseNode.Attributes["Actionid"].Value; condition.FalseValue.ContinueTransaction = ConditionFalseNode.Attributes["ContinueTransaction"] == null ? true : Convert.ToBoolean(ConditionFalseNode.Attributes["ContinueTransaction"].Value); } if (condition.TrueValue != null && condition.FalseValue != null) { return(condition); } else { return(null); } }