public override void LoadSettings(System.Xml.XmlNode settingsXml) { Url = Umbraco.Courier.Core.Helpers.Xml.GetNodeValue(settingsXml.SelectSingleNode("./url")); Login = Umbraco.Courier.Core.Helpers.Xml.GetNodeValue(settingsXml.SelectSingleNode("./login")); Password = Umbraco.Courier.Core.Helpers.Xml.GetNodeValue(settingsXml.SelectSingleNode("./password")); LocationAlias = Umbraco.Courier.Core.Helpers.IO.SanitizeFileName(settingsXml.Attributes["alias"].Value); }
private Topic CastToTopic(System.Xml.XmlNode topicNode) { try { var title = topicNode.SelectSingleNode("./title").InnerText; var link = topicNode.SelectSingleNode("./link").InnerText; var pubDate = topicNode.SelectSingleNode("./pubDate").InnerText; var guid = topicNode.SelectSingleNode("./guid").InnerText; var creator = topicNode.SelectNodes("./*").Cast <System.Xml.XmlNode>().SingleOrDefault(node => node.LocalName.Equals("creator"))?.InnerText; var categories = topicNode.SelectNodes("./category").Cast <System.Xml.XmlNode>().Select(node => node.InnerText); var descriprion = topicNode.SelectSingleNode("./description").InnerText; return(new Topic { Title = title, Link = link, PublisDate = System.DateTime.Parse(pubDate), Creator = creator, Categories = categories, Description = descriprion, Guid = guid }); } catch (System.Exception e) { System.Console.WriteLine(e); return(null); } }
public XmlLayoutDefinition(System.Xml.XmlNode layoutNode) { Width = new Dimension(layoutNode.SelectSingleNode("width")); Height = new Dimension(layoutNode.SelectSingleNode("height")); HOffset = new Dimension(layoutNode.SelectSingleNode("hoffset")); VOffset = new Dimension(layoutNode.SelectSingleNode("voffset")); }
public static EmbeddedConfiguration GetConfigurationFromEmbeddedFile(string logicalConnectionName) { System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); using (System.IO.Stream s = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ITPCfSQL.Azure.CLR.Configuration.Connections.xml")) { doc.Load(s); } string query = "ConnectionList/Connection[LogicalName='" + logicalConnectionName + "']"; //Microsoft.SqlServer.Server.SqlContext.Pipe.Send(query); System.Xml.XmlNode node = doc.SelectSingleNode(query); if (node == null) { throw new ArgumentException("Cannot find \"" + logicalConnectionName + "\" logical connection. Are you sure you spelled it right?"); } try { return(new EmbeddedConfiguration() { LogicalName = node.SelectSingleNode("LogicalName").InnerText, AccountName = node.SelectSingleNode("AccountName").InnerText, SharedKey = node.SelectSingleNode("SharedKey").InnerText, UseHTTPS = bool.Parse(node.SelectSingleNode("UseHTTPS").InnerText) }); } catch (Exception exce) { throw new ArgumentException("There is an error in the configuration file. Some node is missing.", exce); } }
public void LoadConfiguration(System.Xml.XmlNode configNode) { if (configNode.ChildNodes.Count == 0) { configNode.InnerXml = Resources.ResourceUtils.ReadString("ToolboxControls.AddinGuard.DefaultConfiguration.txt"); } System.Xml.XmlNode node = configNode.SelectSingleNode("Active"); bool mode = Convert.ToBoolean(node.Value); if (mode) { radioButtonActivate.Checked = true; } node = configNode.SelectSingleNode("SetLoadBehavior"); mode = Convert.ToBoolean(node.Value); if (mode) { checkBoxRestoreLoadBehavior.Checked = true; } node = configNode.SelectSingleNode("TrayNotify"); mode = Convert.ToBoolean(node.Value); if (mode) { radioButtonTray.Checked = true; } }
public static Size GetElementSize(System.Xml.XmlNode element) { return(new Size( int.Parse(element.SelectSingleNode("position").Attributes["Width"].Value), int.Parse(element.SelectSingleNode("position").Attributes["Height"].Value) )); }
public static IFileEntry ToFileEntry(System.Xml.XmlNode xFile) { string name = xFile.Attributes["name"].Value; // Normal files have an "currentRevision", which represent the most recent successfully upload // (could also checked that currentRevision/state is "COMPLETED", but should not be necessary). // There might also be a newer "latestRevision" coming from an incomplete or corrupt upload, // but we ignore that here and use the information about the last valid version. System.Xml.XmlNode xRevision = xFile.SelectSingleNode("currentRevision"); if (xRevision != null) { System.Xml.XmlNode xState = xRevision.SelectSingleNode("state"); if (xState != null && xState.InnerText == "COMPLETED") // Think "currentRevision" always is a complete version, but just to be on the safe side.. { System.Xml.XmlNode xSize = xRevision.SelectSingleNode("size"); long size; if (xSize == null || !long.TryParse(xSize.InnerText, out size)) { size = -1; } DateTime lastModified; System.Xml.XmlNode xModified = xRevision.SelectSingleNode("modified"); // There is created, modified and updated time stamps, but not last accessed. if (xModified == null || !DateTime.TryParseExact(xModified.InnerText, JFS_DATE_FORMAT, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.AdjustToUniversal, out lastModified)) { lastModified = new DateTime(); } FileEntry fe = new FileEntry(name, size, lastModified, lastModified); return(fe); } } return(null); }
public Rectangle(System.Xml.XmlNode rectangleNode) { this.Initialize(rectangleNode); try { Bordercolor = rectangleNode.Attributes["bordercolor"].Value; Borderwidth = rectangleNode.Attributes["borderwidth"].Value; if (rectangleNode.SelectSingleNode("content") != null) { XmlContent = new XmlContent(rectangleNode.SelectSingleNode("content")); } if (rectangleNode.Attributes["fillcolor"] != null) { Fillcolor = rectangleNode.Attributes["fillcolor"].Value; } if (rectangleNode.Attributes["roundness"] != null) { Roundness = rectangleNode.Attributes["roundness"].Value; } } catch (NullReferenceException nrf) { throw new MissingAttributeException("", "rectangle"); } }
/// <summary> /// 获取审批人列表 /// </summary> /// <param name="applicationConfigFile"></param> /// <returns></returns> private ReviewederObject GetReviewederObject(string applicationConfigFile) { System.Xml.XmlDocument xmldom = new System.Xml.XmlDocument(); xmldom.Load(applicationConfigFile); System.Xml.XmlNode root = xmldom.DocumentElement; System.Xml.XmlNode node = root.SelectSingleNode("ResourceInfo"); try { ReviewederObject obj = new ReviewederObject(); obj.LuoJun = new StaffObj() { StaffID = node.SelectSingleNode("Revieweder[@name=\"LuoJun\"]").Attributes["staffid"].Value, StaffName = node.SelectSingleNode("Revieweder[@name=\"LuoJun\"]").Attributes["staffname"].Value }; obj.LiLong = new StaffObj() { StaffID = node.SelectSingleNode("Revieweder[@name=\"LiLong\"]").Attributes["staffid"].Value, StaffName = node.SelectSingleNode("Revieweder[@name=\"LiLong\"]").Attributes["staffname"].Value }; return(obj); } catch { } return(new ReviewederObject()); }
/// <summary> /// Virtual method - override to define appropriate load from XML semantics for /// the subclass. Note: Call base class method from override to correctly /// load common elements. /// </summary> /// <param name="xmlData">Xml containing the Instance configuration. /// Should be identical in structure and scope to the output of the ToXml /// method in the same class.</param> public virtual void FromXml(System.Xml.XmlNode xmlData) { DateTime Start = Debug.ExecStart; _InstanceName = xmlData.Attributes[xmlAttrName].ChildNodes[0].Value; try { // This is in a try block because older config files don't have // this entry; we need to default it. This was introduced in 0.2.26 _RemoteFAHLogFilename = xmlData.SelectSingleNode(xmlNodeFAHLog).InnerText; } catch { _RemoteFAHLogFilename = LocalFAHLog; } try { // This is in a try block because older config files don't have // this entry; we need to default it. This was introduced in 0.2.26 _RemoteUnitInfoFilename = xmlData.SelectSingleNode(xmlNodeUnitInfo).InnerText; } catch { _RemoteUnitInfoFilename = LocalUnitInfo; } ClassLogger.Log(LogLevel.Trace, String.Format("{0} Execution Time: {1}", Debug.FunctionName, Debug.GetExecTime(Start)), ""); }
private static void BaseClassImplementation(System.CodeDom.Compiler.IndentedTextWriter inWriter, System.Xml.XmlNamespaceManager nsmgr, System.Xml.XmlNode node) { Support.MakeRegion(inWriter, "Base Class Implementation"); System.Xml.XmlNode nodeTemp = node.SelectSingleNode("dbs:TableConstraints/dbs:PrimaryKey/dbs:PKField", nsmgr); string primaryKeyName = ""; System.Xml.XmlNode primaryKey; if (nodeTemp != null) { primaryKeyName = Utility.Tools.GetAttributeOrEmpty(nodeTemp, "Name"); } primaryKey = node.SelectSingleNode("dbs:TableColumns/dbs:TableColumn[@Name='" + primaryKeyName + "']", nsmgr); if (primaryKey != null) { if (Utility.Tools.GetAttributeOrEmpty(primaryKey, "IsAutoIncrement") == "1") { inWriter.WriteLine("internal void SetNewPrimaryKey()"); Support.WriteLineAndIndent(inWriter, "{"); inWriter.WriteLine(primaryKeyName + " = mNextPrimaryKey"); inWriter.WriteLine("mNextPrimaryKey --"); Support.WriteLineAndOutdent(inWriter, "}"); } } Support.EndRegion(inWriter); }
static bool callback(System.Xml.XmlNode result) { bool KEEP_GOING = true; bool STOP_RUNNING = false; if (result.Name != "test") { return(KEEP_GOING); } if (result.Attributes["result"].Value == "Fail") { Console.WriteLine("The test {0} has damaged your karma. The following stack trace has been declared to be at fault", result.Attributes["name"].Value); Console.WriteLine(result.SelectSingleNode("failure/message").InnerText); Console.WriteLine(result.SelectSingleNode("failure/stack-trace").InnerText); Console.WriteLine(result.OuterXml); TEST_FAILED = 1; return(STOP_RUNNING); } else { Console.WriteLine("{0} has expanded your awareness", result.Attributes["name"].Value); return(STOP_RUNNING); } }
/// <summary> /// 根据IP 获取物理地址 /// </summary> /// <param name="strIP"></param> /// <returns></returns> static string GetCityName(string strIP) { string Location = ""; //string strURL = "http://pv.sohu.com/cityjson/" + strIP; string strURL = "http://ip.taobao.com/service/getIpInfo.php?ip=" + strIP; System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); //Xml文档 string dsdsd = GetHtml(strURL); //加载strURL指定XML数据 System.Xml.XmlNodeList nodeLstCity = doc.GetElementsByTagName("City"); //获取标签 Location = "获取单个物理位置:" + nodeLstCity[0].InnerText + ""; Console.WriteLine(Location); //通过SelectSingleNode匹配匹配第一个节点 System.Xml.XmlNode root = doc.SelectSingleNode("Response"); if (root != null) { { string CountryName = (root.SelectSingleNode("CountryName")).InnerText; string RegionName = (root.SelectSingleNode("RegionName")).InnerText; string City = (root.SelectSingleNode("City")).InnerText; Location = "国家名称:" + CountryName + "\n区域名称:" + RegionName + "\n城市名称:" + City; return(Location); } } return(Location); }
public override void LoadDataFromXmlNode(System.Xml.XmlNode node) { base.LoadDataFromXmlNode(node); try { this.title = node.SelectSingleNode("Title").InnerText; } catch { } try { this.url = node.SelectSingleNode("Url").InnerText; } catch { } try { this.urlSizeAware = Convert.ToBoolean(node.SelectSingleNode("UrlSA").InnerText); } catch { } try { this.width = Convert.ToInt32(node.SelectSingleNode("Width").InnerText); } catch { } try { this.height = Convert.ToInt32(node.SelectSingleNode("Height").InnerText); } catch { } }
public object Create(object parent, object configContext, System.Xml.XmlNode section) { SapConfig sapConfig = new SapConfig(); var appServerHost = section.SelectSingleNode("AppServerHost"); if (appServerHost != null && appServerHost.Attributes != null) { var attribute = appServerHost.Attributes["Value"]; if (attribute != null) { sapConfig.AppServerHost = attribute.Value; } } var user = section.SelectSingleNode("User"); if (user != null && user.Attributes != null) { var attribute = user.Attributes["Value"]; if (attribute != null) { sapConfig.User = attribute.Value; } } var password = section.SelectSingleNode("Password"); if (password != null && password.Attributes != null) { var attribute = password.Attributes["Value"]; if (attribute != null) { sapConfig.Password = attribute.Value; } } var client = section.SelectSingleNode("Client"); if (client != null && client.Attributes != null) { var attribute = client.Attributes["Value"]; if (attribute != null) { sapConfig.Client = attribute.Value; } } var systemID = section.SelectSingleNode("SystemID"); if (systemID != null && systemID.Attributes != null) { var attribute = systemID.Attributes["Value"]; if (attribute != null) { sapConfig.SystemID = attribute.Value; } } return(sapConfig); }
public override void FromXml(System.Xml.XmlNode xmlData) { base.FromXml(xmlData); this._URL = xmlData.SelectSingleNode(XmlPropURL).InnerText; this._Username = xmlData.SelectSingleNode(XmlPropUser).InnerText; this._Password = xmlData.SelectSingleNode(XmlPropPass).InnerText; }
public static void PublicAndFriend(System.CodeDom.Compiler.IndentedTextWriter inWriter, System.Xml.XmlNamespaceManager nsmgr, System.Xml.XmlNode node) { Support.MakeRegion(inWriter, "Public and Friend Properties, Methods and Events"); System.Xml.XmlNode nodeTemp = node.SelectSingleNode("dbs:TableConstraints/dbs:PrimaryKey/dbs:PKField", nsmgr); string primaryKeyName = ""; System.Xml.XmlNode primaryKey; if (nodeTemp != null) { primaryKeyName = Utility.Tools.GetAttributeOrEmpty(nodeTemp, "Name"); } primaryKey = node.SelectSingleNode("dbs:TableColumns/dbs:TableColumn[@Name='" + primaryKeyName + "']", nsmgr); inWriter.WriteLine("public overloads void Fill( "); inWriter.Indent += 4; if (primaryKey != null) { inWriter.WriteLine(Utility.Tools.GetAttributeOrEmpty(primaryKey, "NETType") + primaryKeyName + ","); } inWriter.WriteLine("int UserID"); inWriter.Indent -= 4; Support.WriteLineAndIndent(inWriter, "{"); inWriter.Write(Utility.Tools.GetAttributeOrEmpty(node, "SingularName") + "DataAccessor.Fill( this, "); if (primaryKey != null) { inWriter.Write(primaryKeyName + ", "); } inWriter.WriteLine("UserID );"); Support.WriteLineAndOutdent(inWriter, "}"); Support.EndRegion(inWriter); }
public object Create(object parent, object configContext, System.Xml.XmlNode section) { MessengerConfiguration cfg = new MessengerConfiguration(); cfg.RetrieveMessageInterval = Convert.ToInt32(GetAttribute("retrieveMessageInterval", section, "60000")); cfg.RetryInterval = Convert.ToInt32(GetAttribute("retryInterval", section, "3000")); cfg.SendInterval = Convert.ToInt32(GetAttribute("sendInterval", section, "3000")); cfg.RetryLimit = Convert.ToInt32(GetAttribute("retryLimit", section, "3")); cfg.ReloadMessageLimit = Convert.ToInt32(GetAttribute("reloadMessageLimit", section, "20")); cfg.BeginSmsTransmissionPeriod = TimeSpan.Parse(GetAttribute("beginSmsTransmisionPeriod", section, "08:00")); cfg.EndSmsTransmissionPeriod = TimeSpan.Parse(GetAttribute("endSmsTransmisionPeriod", section, "22:00")); cfg.SmsServiceProvider = GetAttribute("smsServiceProvider", section, null); cfg.SmsServiceParameters = GetProviderConfiguration(section.SelectSingleNode("smsProvider")); cfg.MailServer = GetMailServerConfiguration(section.SelectSingleNode("mailServer")); //REQUIRED cfg.GetMessageStoredProcedure = GetAttribute("getMessageSP", section); cfg.GetMessageAttachmentsStoredProcedure = GetAttribute("getMessageAttachmentsSP", section); cfg.SetMessageTransmissionSuccessStoredProcedure = GetAttribute("setSuccessSP", section); cfg.SetMessageTransmissionErrorStoredProcedure = GetAttribute("setErrorSP", section); cfg.ServiceName = GetAttribute("name", section); if (ConfigurationManager.ConnectionStrings["messengerDB"] == null) { throw new ConfigurationErrorsException("Nie zdefiniowano połączenia do bazy o nazwie messengerDB"); } else { cfg.MessageDBConnectionString = ConfigurationManager.ConnectionStrings["messengerDB"].ConnectionString; } return(cfg); }
public static Point GetElementPosition(System.Xml.XmlNode element) { return(new Point( int.Parse(element.SelectSingleNode("position").Attributes["StartX"].Value), int.Parse(element.SelectSingleNode("position").Attributes["StartY"].Value) )); }
/// <summary> /// Returns the internationalised version of the string provided according to the current /// language (and the availability of the translation.) /// </summary> /// <param name="text"></param> /// <returns></returns> /// <remarks> /// If there is no "item" node in AssemblyName.Language.xml that has a "key" node /// containing the argument text then the argument text is returned. This means that /// if the code calls GetText("Hello world") and no translation is provided then then /// function will return "Hello world". On the assumption that calling code is English /// there is therefore an implicit English default. /// If the "item" node that matches the argument text has a "leaveBlank" child then /// the empty string is returned. /// </remarks> public string GetText(string text) { Initialise(); string key = null; key = text.Replace("\"", "'"); System.Xml.XmlNode n = null; if (_applicationXMLFound) { n = _applicationXML.DocumentElement.SelectSingleNode("item[key=\"" + key + "\"]"); } if (n == null) { //Nothing found in the application translation file: try our common language file. if (_commonXMLFound) { n = _commonXML.DocumentElement.SelectSingleNode("item[key=\"" + key + "\"]"); } if (n == null) { if (_debug) { WriteDebug("<item><key>" + key + "</key><content language=\"en\">" + text + "</content><content language=\"xx\">Xxxxx</content></item>"); } return text; } else { System.Xml.XmlNode item = n.SelectSingleNode("content[@language=\"" + _languageCode + "\"]"); if (item == null) { return text; } else { return item.InnerText; } } } else { if (n.SelectSingleNode("leaveBlank") == null) { System.Xml.XmlNode item = n.SelectSingleNode("content[@language=\"" + _languageCode + "\"]"); if (item == null) { return text; } else { return item.InnerText; } } else { return ""; } } }
public static HumanSuperscale LoadFromXml(System.Xml.XmlNode node) { HumanSuperscale h = new HumanSuperscale(); h.Enable = Convert.ToBoolean(node.SelectSingleNode("Enable").InnerText); h.UpperLimit = Convert.ToUInt32(node.SelectSingleNode("UpperLimit").InnerText); h.UnitTime = Convert.ToUInt32(node.SelectSingleNode("UnitTime").InnerText); return(h); }
public void Parse(ICompilateur comp, System.Xml.XmlNode node) { if (node.Attributes.GetNamedItem("indent") != null) { Int32.TryParse(node.Attributes.GetNamedItem("indent").Value, out this.indent); } this.varName = node.SelectSingleNode("variable").InnerText; this.expression = node.SelectSingleNode("expression").InnerText; }
public override void LoadDataFromXmlNode(System.Xml.XmlNode node) { base.LoadDataFromXmlNode(node); try { this.imageUrl = node.SelectSingleNode("Url").InnerText; } catch { } try { this.addTimeIndex = (node.SelectSingleNode("TI").InnerText == "True"); } catch { } }
public ForumModel(System.Xml.XmlNode childNode, Func <string, List <ThreadModel> > readThreads) { // TODO: Complete member initialization // this.childNode = childNode; ForumID = childNode.SelectSingleNode("Id").InnerText; Name = childNode.SelectSingleNode("Name").InnerText; // Description = childNode.SelectSingleNode("Description").ToString(); GroupID = childNode.SelectSingleNode("Group/Id").InnerText; readThreadFunc = readThreads; }
public override void LoadDataFromXmlNode(System.Xml.XmlNode node) { base.LoadDataFromXmlNode(node); try { this.fixedReferenceHasCount = FormUtil.GetBoolean(node.SelectSingleNode("FRHC").InnerText); } catch { } try { this.fixedReferenceHasImage = FormUtil.GetBoolean(node.SelectSingleNode("FRHI").InnerText); } catch { } }
public void Load(ICompilateurInstance comp, System.Xml.XmlNode node) { if (node.Attributes.GetNamedItem("indent") != null) { Int32.TryParse(node.Attributes.GetNamedItem("indent").Value, out this.indent); } this.varName = node.SelectSingleNode("terme").InnerText; this.tabName = node.SelectSingleNode("tableau").InnerText; this.cachedComp = comp; }
public void Load(ICompilateurInstance comp, System.Xml.XmlNode node) { if (node.Attributes.GetNamedItem("indent") != null) { Int32.TryParse(node.Attributes.GetNamedItem("indent").Value, out this.indent); } this.expression = node.SelectSingleNode("expression").InnerText; this.labelTrue = node.SelectSingleNode("iftrue").InnerText; this.labelFalse = node.SelectSingleNode("iffalse").InnerText; }
public void Load(ICompilateurInstance comp, System.Xml.XmlNode node) { if (node.Attributes.GetNamedItem("indent") != null) { Int32.TryParse(node.Attributes.GetNamedItem("indent").Value, out this.indent); } this.varName = node.SelectSingleNode("variable").InnerText; this.expression = node.SelectSingleNode("expression").InnerText; // on en a besoin pour plus tard dans la conversion this.cachedComp = comp; }
internal List <TableEntity> _QueryInternal( string NextPartitionKey, string NextRowKey, out string continuationNextPartitionKey, out string continuationNextRowKey, string xmsclientrequestId = null) { List <TableEntity> lEntities = new List <TableEntity>(); string res = ITPCfSQL.Azure.Internal.InternalMethods.QueryTable( AzureTableService.UseHTTPS, AzureTableService.SharedKey, AzureTableService.AccountName, this.Name, NextPartitionKey, NextRowKey, out continuationNextPartitionKey, out continuationNextRowKey, xmsclientrequestId); System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); using (System.IO.StringReader sr = new System.IO.StringReader(res)) { using (System.Xml.XmlReader reader = System.Xml.XmlReader.Create(sr)) { doc.Load(reader); } } System.Xml.XmlNamespaceManager man = new System.Xml.XmlNamespaceManager(doc.NameTable); man.AddNamespace("d", "http://schemas.microsoft.com/ado/2007/08/dataservices"); man.AddNamespace("m", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"); man.AddNamespace("f", "http://www.w3.org/2005/Atom"); foreach (System.Xml.XmlNode node in doc.SelectNodes("f:feed/f:entry", man)) { System.Xml.XmlNode nCont = node.SelectSingleNode("f:content/m:properties", man); System.Xml.XmlNode nTimeStamp = nCont.SelectSingleNode("d:Timestamp", man); TableEntity te = new TableEntity() { PartitionKey = nCont.SelectSingleNode("d:PartitionKey", man).InnerText, RowKey = nCont.SelectSingleNode("d:RowKey", man).InnerText, TimeStamp = DateTime.Parse(nTimeStamp.InnerText) }; // custom attrib handling System.Xml.XmlNode nFollow = nTimeStamp.NextSibling; while (nFollow != null) { te.Attributes[nFollow.LocalName] = nFollow.InnerText; nFollow = nFollow.NextSibling; } lEntities.Add(te); } return(lEntities); }
public Color(System.Xml.XmlNode colorNode) { Key = colorNode.Attributes["key"].Value; CMYKColor = new CMYKColor(colorNode.SelectSingleNode("cmyk")); RGBColor = new RGBColor(colorNode.SelectSingleNode("rgb")); if (colorNode.SelectSingleNode("pms") != null) { PMSColor = new PMSColor(colorNode.SelectSingleNode("pms")); } }