public static track Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { track _track = new track(); _track.m_rocrailClient = rocrailClient; _track.m_bkid = (string)xml.Attribute("bkid"); _track.m_decnr = (int?)xml.Attribute("decnr"); _track.m_desc = (string)xml.Attribute("desc"); _track.m_nr = (int?)xml.Attribute("nr"); _track.m_oppositetrack = (int?)xml.Attribute("oppositetrack"); _track.m_polarization = (bool?)xml.Attribute("polarization"); _track.m_posfb = (string)xml.Attribute("posfb"); _track.m_show = (bool?)xml.Attribute("show"); _track.m_state = (bool?)xml.Attribute("state"); return(_track); }
/// <summary> /// Создание задачи из XML-определения /// </summary> /// <param name="declaration">XML-определение</param> /// <returns></returns> public ITask Parse(System.Xml.Linq.XElement declaration) { if (declaration == null) { throw new ArgumentNullException("Отсутствует определение задачи"); } _key = declaration.Attribute("name").Value; if (declaration.Attribute("filePath") != null) { _filePath = declaration.Attribute("filePath").Value; } if (declaration.Attribute("encoding") != null) { _fileEncoding = declaration.Attribute("encoding").Value; } return(this); }
object IParser.Parse(XElement e) { e.Element("filterItem"); var predicate = e.Attribute("predicate").Value; if (string.IsNullOrEmpty(predicate)) { throw new ArgumentException(Message.Get("Xml.NoAttribute", e), "e"); } var hash = e.Attribute("hash").Value; if (string.IsNullOrEmpty(hash)) { throw new ArgumentException(Message.Get("Xml.NoAttribute", e), "e"); } return(new EntityFilterItem(hash, predicate)); }
/// /// <summary> /// Here we override ReadEvent and read additional Video property</summary> /// public override TimelineEvent ReadEvent( System.Xml.Linq.XElement row ) { TimelineEventEx e; e = base.ReadEvent(row) as TimelineEventEx; e.Video = GetAttribute(row.Attribute("video")); return(e); }
//true if all elements of a exists in b, even if b has more public static bool ElementMatch(this System.Xml.Linq.XElement a, System.Xml.Linq.XElement b) { if (!a.Name.LocalName.Equals(b.Name.LocalName)) { return(false); } if (a.HasElements != b.HasElements) { return(false); } if (!a.HasElements && !b.HasElements && !a.Value.Equals(b.Value, StringComparison.CurrentCultureIgnoreCase)) { return(false); } foreach (System.Xml.Linq.XAttribute at in a.Attributes()) { if (b.Attribute(at.Name) == null || !at.Value.Equals(b.Attribute(at.Name).Value, StringComparison.CurrentCultureIgnoreCase)) { return(false); } } if (a.HasElements == b.HasElements == true && a.Elements().Count() > b.Elements().Count()) { return(false); } foreach (var ae in a.Elements()) { var be = b.Elements().Where(s => ae.ElementMatch(s)); if (!be.Any()) { return(false); } } return(true); }
public static cvbyte Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { cvbyte _cvbyte = new cvbyte(); _cvbyte.m_rocrailClient = rocrailClient; _cvbyte.m_cat = (string)xml.Attribute("cat"); _cvbyte.m_desc = (string)xml.Attribute("desc"); _cvbyte.m_dipid = (string)xml.Attribute("dipid"); _cvbyte.m_info = (string)xml.Attribute("info"); _cvbyte.m_nr = (int?)xml.Attribute("nr"); _cvbyte.m_readonly = (bool?)xml.Attribute("readonly"); _cvbyte.m_url = (string)xml.Attribute("url"); _cvbyte.m_value = (int?)xml.Attribute("value"); _cvbyte.m_word = (bool?)xml.Attribute("word"); Definitions.Tools.ParseList <adip>(_cvbyte.m_adiplist, xml, "adip", adip.Parse, rocrailClient); return(_cvbyte); }
public static modplan Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { modplan _modplan = new modplan(); _modplan.m_rocrailClient = rocrailClient; _modplan.m_initfield = (bool?)xml.Attribute("initfield"); _modplan.m_locs = (string)xml.Attribute("locs"); _modplan.m_modified = (bool?)xml.Attribute("modified"); _modplan.m_modroutes = (bool?)xml.Attribute("modroutes"); _modplan.m_routes = (string)xml.Attribute("routes"); _modplan.m_savemodplan = (bool?)xml.Attribute("savemodplan"); _modplan.m_savemodules = (bool?)xml.Attribute("savemodules"); _modplan.m_subtitle = (string)xml.Attribute("subtitle"); _modplan.m_title = (string)xml.Attribute("title"); Definitions.Tools.ParseList <module>(_modplan.m_modulelist, xml, "module", module.Parse, rocrailClient); return(_modplan); }
public ActionData(XE actionData) { var pidAttribute = actionData.Attribute(C.pid); var pidAttributeValue = int.Parse(pidAttribute.Value); if (!Enum.IsDefined(typeof(PromptId), pidAttributeValue)) { throw new ArgumentException($"Unknown {nameof(C.pid)} '{pidAttributeValue}'"); } Id = (PromptId)pidAttributeValue; Value = new ActionDataValue(actionData.Value); }
public override void InitByXml(System.Xml.Linq.XElement xml) { string att = null; if (xml.Attribute("legenditemspan") != null) { att = xml.Attribute("legenditemspan").Value; if (!string.IsNullOrEmpty(att)) { int.TryParse(att, out _legendItemSpan); } } if (xml.Attribute("linecount") != null) { att = xml.Attribute("linecount").Value; if (!string.IsNullOrEmpty(att)) { int.TryParse(att, out _colCount); } } if (xml.Attribute("isshowcolor") != null) { att = xml.Attribute("isshowcolor").Value; if (!string.IsNullOrEmpty(att)) { bool.TryParse(att, out _isShowColor); } } base.InitByXml(xml); }
public ITask Parse(System.Xml.Linq.XElement declaration) { if (declaration == null) { throw new ArgumentNullException("Отсутствует определение задачи"); } if (declaration.Attribute("template") != null) { _template = declaration.Attribute("template").Value; } if (declaration.Attribute("templateFile") != null) { _templateFile = declaration.Attribute("templateFile").Value; } _outputParam = declaration.Attribute("outputParam").Value; var tmpParams = declaration.XPathSelectElements("//Param"); if (tmpParams.Any()) { _paramsDescription = new List <ParameterDescription>(); foreach (var param in tmpParams) { _paramsDescription.Add(new ParameterDescription() { Name = param.Attribute("name").Value, FilePath = param.Attribute("file").Value, HasHeaders = bool.Parse(param.Attribute("headerRow").Value), Mode = param.Attribute("mode") == null ? "text" : param.Attribute("mode").Value.ToLower(CultureInfo.InvariantCulture), Encoding = param.Attribute("encoding") == null ? null : param.Attribute("encoding").Value.ToLower(CultureInfo.InvariantCulture), }); } } return(this); }
public static sc Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { sc _sc = new sc(); _sc.m_rocrailClient = rocrailClient; _sc.m_cycles = (int?)xml.Attribute("cycles"); _sc.m_fromhour = (int?)xml.Attribute("fromhour"); _sc.m_id = (string)xml.Attribute("id"); _sc.m_maxdelay = (int?)xml.Attribute("maxdelay"); _sc.m_scaction = (string)xml.Attribute("scaction"); _sc.m_timeframe = (int?)xml.Attribute("timeframe"); _sc.m_timeprocessing = (int?)xml.Attribute("timeprocessing"); _sc.m_tohour = (int?)xml.Attribute("tohour"); _sc.m_type = (string)xml.Attribute("type"); Definitions.Tools.ParseList <actionctrl>(_sc.m_actionctrllist, xml, "actionctrl", actionctrl.Parse, rocrailClient); Definitions.Tools.ParseList <scentry>(_sc.m_scentrylist, xml, "scentry", scentry.Parse, rocrailClient); return(_sc); }
public override void InitByXml(System.Xml.Linq.XElement xml) { if (xml.Attribute("unit") != null) { string s = xml.Attribute("unit").Value; switch (s.ToLower()) { case "pixel": _unit = enumLayoutUnit.Pixel; break; case "centimeter": _unit = enumLayoutUnit.Centimeter; break; } } if (xml.Attribute("size") != null) { _size = (SizeF)LayoutFromFile.Base64StringToObject(xml.Attribute("size").Value); } base.InitByXml(xml); }
/// <summary> /// 获取XML对象的属性值 /// 属性未定义则返回默认值 /// </summary> public static string GetXmlAttributeValue(System.Xml.Linq.XElement xe, string attrName, string defaultValue = "") { string attrValue = defaultValue; var xattr = xe.Attribute(attrName); if (xattr != null && xattr.Value != null) { attrValue = xattr.Value; } return(attrValue); }
private static string _ReadAttributeString(System.Xml.Linq.XElement xElement, string attributeName) { if (xElement == null) { return(""); } System.Xml.Linq.XAttribute xAttribute = xElement.Attribute(attributeName); if (xAttribute == null) { return(""); } return(xAttribute.Value); }
public override void InitByXml(System.Xml.Linq.XElement xml) { string att = null; if (xml.Attribute("legendItemspan") != null) { att = xml.Attribute("legendItemspan").Value; if (!string.IsNullOrEmpty(att)) { _legendItemSpan = int.Parse(att); } } if (xml.Attribute("legenditemheight") != null) { att = xml.Attribute("legenditemheight").Value; if (!string.IsNullOrEmpty(att)) { _legendItemHeight = int.Parse(att); } } base.InitByXml(xml); }
public static section Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { section _section = new section(); _section.m_rocrailClient = rocrailClient; _section.m_action = (string)xml.Attribute("action"); _section.m_fbid = (string)xml.Attribute("fbid"); _section.m_fbidocc = (string)xml.Attribute("fbidocc"); _section.m_id = (string)xml.Attribute("id"); _section.m_idx = (int?)xml.Attribute("idx"); _section.m_lcid = (string)xml.Attribute("lcid"); _section.m_len = (int?)xml.Attribute("len"); _section.m_nr = (int?)xml.Attribute("nr"); return(_section); }
public static acc Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { acc _acc = new acc(); _acc.m_rocrailClient = rocrailClient; _acc.m_accevent = (bool?)xml.Attribute("accevent"); _acc.m_devid = (int?)xml.Attribute("devid"); _acc.m_iid = (string)xml.Attribute("iid"); _acc.m_nodenr = (int?)xml.Attribute("nodenr"); _acc.m_val1 = (int?)xml.Attribute("val1"); _acc.m_val2 = (int?)xml.Attribute("val2"); _acc.m_val3 = (int?)xml.Attribute("val3"); _acc.m_val4 = (int?)xml.Attribute("val4"); return(_acc); }
public static zlevel Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { zlevel _zlevel = new zlevel(); _zlevel.m_rocrailClient = rocrailClient; _zlevel.m_active = (bool?)xml.Attribute("active"); _zlevel.m_modid = (string)xml.Attribute("modid"); _zlevel.m_modviewcx = (int?)xml.Attribute("modviewcx"); _zlevel.m_modviewcy = (int?)xml.Attribute("modviewcy"); _zlevel.m_modviewx = (int?)xml.Attribute("modviewx"); _zlevel.m_modviewy = (int?)xml.Attribute("modviewy"); _zlevel.m_title = (string)xml.Attribute("title"); _zlevel.m_z = (int?)xml.Attribute("z"); return(_zlevel); }
public static occ Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { occ _occ = new occ(); _occ.m_rocrailClient = rocrailClient; _occ.m_auto = (bool?)xml.Attribute("auto"); _occ.m_bkid = (string)xml.Attribute("bkid"); _occ.m_blockenterside = (int?)xml.Attribute("blockenterside"); _occ.m_closed = (bool?)xml.Attribute("closed"); _occ.m_lcid = (string)xml.Attribute("lcid"); _occ.m_placing = (int?)xml.Attribute("placing"); _occ.m_scid = (string)xml.Attribute("scid"); _occ.m_secid = (string)xml.Attribute("secid"); return(_occ); }
public static netrsp Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { netrsp _netrsp = new netrsp(); _netrsp.m_rocrailClient = rocrailClient; _netrsp.m_host = (string)xml.Attribute("host"); _netrsp.m_localbk = (string)xml.Attribute("localbk"); _netrsp.m_localid = (string)xml.Attribute("localid"); _netrsp.m_plan = (string)xml.Attribute("plan"); _netrsp.m_port = (int?)xml.Attribute("port"); _netrsp.m_remotebk = (string)xml.Attribute("remotebk"); _netrsp.m_remoteid = (string)xml.Attribute("remoteid"); _netrsp.m_rsp = (string)xml.Attribute("rsp"); return(_netrsp); }
public static channelsetup Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { channelsetup _channelsetup = new channelsetup(); _channelsetup.m_rocrailClient = rocrailClient; _channelsetup.m_channel = (int?)xml.Attribute("channel"); _channelsetup.m_delay = (int?)xml.Attribute("delay"); _channelsetup.m_offpos = (int?)xml.Attribute("offpos"); _channelsetup.m_offsteps = (int?)xml.Attribute("offsteps"); _channelsetup.m_onpos = (int?)xml.Attribute("onpos"); _channelsetup.m_onsteps = (int?)xml.Attribute("onsteps"); _channelsetup.m_options = (int?)xml.Attribute("options"); _channelsetup.m_state = (int?)xml.Attribute("state"); return(_channelsetup); }
public static custom Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { custom _custom = new custom(); _custom.m_rocrailClient = rocrailClient; _custom.m_arg1 = (string)xml.Attribute("arg1"); _custom.m_arg2 = (string)xml.Attribute("arg2"); _custom.m_arg3 = (string)xml.Attribute("arg3"); _custom.m_arg4 = (string)xml.Attribute("arg4"); _custom.m_arg5 = (string)xml.Attribute("arg5"); _custom.m_arg6 = (string)xml.Attribute("arg6"); _custom.m_cmd = (string)xml.Attribute("cmd"); _custom.m_iid = (string)xml.Attribute("iid"); return(_custom); }
public static response Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { response _response = new response(); _response.m_rocrailClient = rocrailClient; _response.m_data = (string)xml.Attribute("data"); _response.m_error = (bool?)xml.Attribute("error"); _response.m_iid = (string)xml.Attribute("iid"); _response.m_msg = (string)xml.Attribute("msg"); _response.m_rc = (int?)xml.Attribute("rc"); _response.m_retry = (bool?)xml.Attribute("retry"); _response.m_sender = (string)xml.Attribute("sender"); _response.m_state = (string)xml.Attribute("state"); return(_response); }
public virtual void From_XML(System.Xml.Linq.XElement xml) { Source_Startup_Policy = Libvirt.Models.Concrete.Disk.Source_Startup_Policies.mandatory; if (xml != null) { var attr = xml.Attribute("startupPolicy"); if (attr != null) { var b = Libvirt.Models.Concrete.Disk.Source_Startup_Policies.mandatory; Enum.TryParse(attr.Value, true, out b); Source_Startup_Policy = b; } } }
public static macro Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { macro _macro = new macro(); _macro.m_rocrailClient = rocrailClient; _macro.m_class = (int?)xml.Attribute("class"); _macro.m_hours = (int?)xml.Attribute("hours"); _macro.m_minutes = (int?)xml.Attribute("minutes"); _macro.m_nr = (int?)xml.Attribute("nr"); _macro.m_repeat = (int?)xml.Attribute("repeat"); _macro.m_slowdown = (int?)xml.Attribute("slowdown"); _macro.m_uid = (int?)xml.Attribute("uid"); _macro.m_wday = (int?)xml.Attribute("wday"); Definitions.Tools.ParseList <macroline>(_macro.m_macrolinelist, xml, "macroline", macroline.Parse, rocrailClient); return(_macro); }
public static link Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { link _link = new link(); _link.m_rocrailClient = rocrailClient; _link.m_active = (bool?)xml.Attribute("active"); _link.m_allowfollowup = (bool?)xml.Attribute("allowfollowup"); _link.m_desc = (string)xml.Attribute("desc"); _link.m_dst = (string)xml.Attribute("dst"); _link.m_id = (string)xml.Attribute("id"); _link.m_maxfollowup = (int?)xml.Attribute("maxfollowup"); _link.m_src = (string)xml.Attribute("src"); _link.m_usage = (int?)xml.Attribute("usage"); Definitions.Tools.ParseList <linkcond>(_link.m_linkcondlist, xml, "linkcond", linkcond.Parse, rocrailClient); return(_link); }
object IParser.Parse(XElement e) { if (e == null) { throw new ArgumentNullException("e", Message.Get("Common.NullArgument", "e")); } var valueAttribute = e.Attribute("value"); if (valueAttribute == null) { throw new ArgumentException(Message.Get("Xml.NoElement", "value", e), "e"); } var fieldIDAttribute = e.Attribute("fieldID"); if (fieldIDAttribute == null) { throw new ArgumentException(Message.Get("Xml.NoElement", "fieldID", e), "e"); } return(new Property(accessor(fieldIDAttribute.Value), valueAttribute.Value)); }
public static cbnode Parse(System.Xml.Linq.XElement xml, CRocrailClient rocrailClient) { cbnode _cbnode = new cbnode(); _cbnode.m_rocrailClient = rocrailClient; _cbnode.m_canid = (int?)xml.Attribute("canid"); _cbnode.m_manuid = (int?)xml.Attribute("manuid"); _cbnode.m_mtyp = (int?)xml.Attribute("mtyp"); _cbnode.m_nr = (int?)xml.Attribute("nr"); _cbnode.m_nrevt = (int?)xml.Attribute("nrevt"); _cbnode.m_nrevtvar = (int?)xml.Attribute("nrevtvar"); _cbnode.m_nrvar = (int?)xml.Attribute("nrvar"); _cbnode.m_version = (string)xml.Attribute("version"); Definitions.Tools.ParseList <cbnodeevent>(_cbnode.m_cbnodeeventlist, xml, "cbnodeevent", cbnodeevent.Parse, rocrailClient); Definitions.Tools.ParseList <cbnodevar>(_cbnode.m_cbnodevarlist, xml, "cbnodevar", cbnodevar.Parse, rocrailClient); return(_cbnode); }
protected void ParseObject(XElement e, out object id, out string name) { if (e == null) { throw new ArgumentNullException("e", Message.Get("Common.NullArgument", "e")); } var idAttribute = e.Attribute("id"); if (idAttribute == null) { throw new ArgumentException(Message.Get("Xml.NoAttribute", "id", e), "e"); } var nameAttribute = e.Attribute("name"); if (nameAttribute == null) { throw new ArgumentException(Message.Get("Xml.NoAttribute", "name", e), "e"); } id = idAttribute.Value; name = nameAttribute.Value; }
private static Project _ParseProject(System.Xml.Linq.XElement root) { var ver = root.Attribute("Version").Value; if (!Version.TryParse(ver, out Version docVer)) { throw new System.IO.FileLoadException(); } if (docVer > CurrentVersion) { throw new System.IO.FileLoadException("Document Version " + docVer + " not supported"); } return(Unknown.ParseXml(root, _Factory) as Project); }