コード例 #1
0
        private TextHandleBaseConfig BuildTextHanldeConfig(JToken textconfig)
        {
            TextHandleBaseConfig result = null;
            var textHanldeType          = textconfig.SelectToken("TextHandleConfig.TextHanldeType").Value <string>();
            var handldeType             = (TextHanldeType)Enum.Parse(typeof(TextHanldeType), textHanldeType);
            var textHandleConfig        = textconfig.SelectToken("TextHandleConfig");

            switch (handldeType)
            {
            case TextHanldeType.Split:
                result = JsonConvert.DeserializeObject <TextSplitingHandleConfig>(textHandleConfig.ToString());
                break;

            case TextHanldeType.Regex:
                result = JsonConvert.DeserializeObject <TextRegexHandleConfig>(textHandleConfig.ToString());
                break;

            case TextHanldeType.Join:
                //   result = JsonConvert.DeserializeObject<TextHandleConfig>(textconfig.ToString());
                break;

            case TextHanldeType.Replace:
                result = JsonConvert.DeserializeObject <TextReplaceHandleConfig>(textHandleConfig.ToString());
                break;

            default:
                break;
            }

            return(result);
        }
コード例 #2
0
 public override void SetData(JToken excuteConfig)
 {
     base.SetData(excuteConfig);
     TextHandleConfig = BuildTextHanldeConfig(excuteConfig);
 }