Ejemplo n.º 1
0
 private string ToCaseDesc(XPathRuleItem ruleItem)
 {
     foreach (var kv in ruleItem.namePatternFormats)
     {
         if (string.IsNullOrEmpty(kv.caseformat))
         {
             continue;
         }
         if (Regex.IsMatch(eventName, kv.pattern, RegexOptions.IgnoreCase))
         {
             string format = kv.caseformat;
             if (Regex.IsMatch(format, @"\$\d+"))
             {
                 format = Regex.Replace(eventName, kv.pattern, kv.caseformat);
             }
             if (format.Contains("eventname"))
             {
                 return(UtilWxg.ReplaceKeyValue(kv.caseformat, "eventname", eventName));
             }
             else
             {
                 return(format);
             }
         }
     }
     return(UtilWxg.ReplaceKeyValue(ruleItem.caseDescFormat, "eventname", eventName));
 }
Ejemplo n.º 2
0
        public void Export(string resultFolder)
        {
            string caseFileName = Config.GetAppSettingValue("caseFileName");

            caseFileName = UtilWxg.ReplaceKeyValue(caseFileName, "title", titleText);
            caseFileName = UtilWxg.ReplaceKeyValue(caseFileName, "filename", this.FileName);

            string[] lines        = listNode.Select(ci => ci.ToStringLine()).ToArray();
            string   exportFolder = Config.GetAppSettingValue2("exportFolder", "exportText");

            if (!exportFolder.EndsWith("\\"))
            {
                exportFolder = exportFolder + "\\";
            }
            if (!Directory.Exists(exportFolder))
            {
                Directory.CreateDirectory(exportFolder);
            }
            exportFolder = exportFolder + resultFolder + "\\";
            if (!Directory.Exists(exportFolder))
            {
                Directory.CreateDirectory(exportFolder);
            }

            exportFile = exportFolder + caseFileName;
            File.WriteAllLines(exportFile, lines);
        }
Ejemplo n.º 3
0
        public void ToCaseDesc(XPathRuleItem ruleItem, HtmlNode node)
        {
            if (ruleItem.name.Contains("sortlink"))
            {
                if (node.OuterHtml.Contains("ASC"))
                {
                    eventText = string.Format(ruleItem.eventText, eventName, "△");
                    caseDesc  = ToCaseDesc(ruleItem);
                    caseDesc  = UtilWxg.ReplaceKeyValue(caseDesc, "sorttype", "昇順");
                }
                else
                {
                    eventText = string.Format(ruleItem.eventText, eventName, "▽");
                    caseDesc  = ToCaseDesc(ruleItem);
                    caseDesc  = UtilWxg.ReplaceKeyValue(caseDesc, "sorttype", "降順");
                }
                return;
            }

            if (ruleItem.name.Contains("calender"))
            {
                if (eventKey.EndsWith("_S"))
                {
                    eventName = eventName + " 開始";
                }
                else if (eventKey.EndsWith("_E"))
                {
                    eventName = eventName + " 終了";
                }
                this.eventText = ToEventText(ruleItem);
                this.caseDesc  = ToCaseDesc(ruleItem);
                return;
            }

            if (ruleItem.name.Contains("select") ||
                ruleItem.name.Contains("tabpage"))
            {
                //初期表示:DropList
                this.eventText = ToEventText(ruleItem);
                this.caseDesc  = ToCaseDesc(ruleItem);
                return;
            }

            this.eventText = ToEventText(ruleItem);
            if (!string.IsNullOrEmpty(this.eventName) && ruleItem.caseMap.ContainsKey(this.eventName))
            {
                this.caseDesc = ruleItem.caseMap[this.eventName];
            }
            else
            {
                this.caseDesc = ToCaseDesc(ruleItem);
            }
        }