public TableCmd(string str) { this.str = null; cols = null; string[] items = str.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in items) { if (s.Contains("name=")) { Name = s.Substring(s.IndexOf("name=") + 5).Trim(); } else if (s.Contains("rowgap=")) { RowGag = s.Substring(s.IndexOf("rowgap=") + 7).Trim().Split('|'); } else if (s.Contains("colgap=")) { ColGap = s.Substring(s.IndexOf("colgap=") + 7).Trim().Split('|'); } else if (s.Contains("location=")) { Location = new BETags(s.Substring(s.IndexOf("location=") + 9).Trim()); } } }
public Cmd(string str) { string[] items = str.Split(new string[] { ";\r\n" }, StringSplitOptions.RemoveEmptyEntries); cmdkeyvalue = new Dictionary <string, string>(); foreach (string s in items) { if (s.Contains("=")) { string name = s.Substring(0, s.IndexOf('=')).Trim(); if (ValidTools.ValidName(name) && !cmdkeyvalue.ContainsKey(name)) { cmdkeyvalue[name] = s.Substring(s.IndexOf('=') + 1); } } } if (cmdkeyvalue.ContainsKey("replacetonull")) { ReplacetoNullTags = new BETags(cmdkeyvalue["replacetonull"]); } if (cmdkeyvalue.ContainsKey("addprefix")) { Prefix = cmdkeyvalue["addprefix"]; } if (cmdkeyvalue.ContainsKey("addsubfix")) { Subfix = cmdkeyvalue["addsubfix"]; } return; /////////////////////////////// if (cmdkeyvalue.ContainsKey("nexturl")) { NextUrlTags = new BETags(cmdkeyvalue["nexturl"]); } if (cmdkeyvalue.ContainsKey("nextexist")) { NextExist = cmdkeyvalue["nextexist"]; } if (cmdkeyvalue.ContainsKey("replacetemplate")) { ReplaceTemplate = cmdkeyvalue["replacetemplate"]; ReplaceTemplate = ReplaceTemplate.Replace("\\r\\n", "\r\n") .Replace("\\t", "\t"); } if (cmdkeyvalue.ContainsKey("multisubitem")) { MultiSubItemTags = new BETags(cmdkeyvalue["multisubitem"]); } if (cmdkeyvalue.ContainsKey("reversematch")) { if (cmdkeyvalue["reversematch"] == "true") { ReverseMatch = true; } } if (cmdkeyvalue.ContainsKey("txtasurl")) { if (cmdkeyvalue["txtasurl"] == "true") { TxtAsUrl = true; } } if (cmdkeyvalue.ContainsKey("dbidbeginend")) { BETags bts = new BETags(cmdkeyvalue["dbidbeginend"]); Bedbid = null; if (bts.tags.Count == 1 && ValidTools.ValidNumber(bts.tags[0].Begin) && ValidTools.ValidNumber(bts.tags[0].End)) { Bedbid = new BEId(); Bedbid.B = Convert.ToInt32(bts.tags[0].Begin); Bedbid.E = int.MaxValue; if (ValidTools.ValidNumber(bts.tags[0].End)) { Bedbid.E = Convert.ToInt32(bts.tags[0].End); } Bedbid.MoveToTop(); }//else 未设置BeDbid } if (cmdkeyvalue.ContainsKey("savepath")) { SavePath = cmdkeyvalue["savepath"]; } if (cmdkeyvalue.ContainsKey("downloadsuburl")) { string downloadsuburl = cmdkeyvalue["downloadsuburl"]; if (downloadsuburl.ToLower().Trim() == "true") { DownLoadSuburl = true; DownLoadSuburlType = "auto"; if (cmdkeyvalue.ContainsKey("downloadsuburltype")) { DownLoadSuburlType = cmdkeyvalue["downloadsuburltype"].Trim(); } } } if (cmdkeyvalue.ContainsKey("casecmd")) { BEPos bp = BETag.FormatCmd(cmdkeyvalue["casecmd"], '{', '}'); if (bp.Valid()) { string cmdstr = bp.String; caseCmd = new CaseCmd(cmdstr); } } if (cmdkeyvalue.ContainsKey("table")) { BEPos bp = BETag.FormatCmd(cmdkeyvalue["table"], '{', '}'); if (bp.Valid()) { string tablecmdstr = bp.String; tableCmd = new TableCmd(tablecmdstr); ListTable.Add(tableCmd); // 以后可以添加多个Table } } if (cmdkeyvalue.ContainsKey("tablevalue")) { BEPos bp = BETag.FormatCmd(cmdkeyvalue["tablevalue"], '{', '}'); if (bp.Valid()) { string tablecmdstr = bp.String; tablevalueCmd = new TableValueCmd(tablecmdstr); } } }