Exemple #1
0
 static StrategyInstance()
 {
     //注册转换器
     ConvertUtils.RegisteConvertor <String, TradeInfo>(ConvertUtils.strToObject <TradeInfo>);
     ConvertUtils.RegisteConvertor <TradeInfo, String>(ConvertUtils.objectToStr);
     ConvertUtils.RegisteConvertor <String, TradeDirection>(ConvertUtils.strtoenum <TradeDirection>);
     ConvertUtils.RegisteConvertor <TradeDirection, String>(ConvertUtils.enumtostr <TradeDirection>);
     ConvertUtils.RegisteConvertor <String, TradeIntent>(ConvertUtils.strtoenum <TradeIntent>);
     ConvertUtils.RegisteConvertor <TradeIntent, String>(ConvertUtils.enumtostr <TradeIntent>);
     ConvertUtils.RegisteConvertor <String, GetInMode>((x, format, props) => GetInMode.Parse(x));
 }
Exemple #2
0
        /// <summary>
        /// 解析字符串
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public static GetInMode Parse(String s)
        {
            GetInMode getin = new GetInMode();

            String[] ss = s.Split(SEP.ToArray());
            if (ss == null || ss.Length <= 0)
            {
                return(null);
            }
            if (!int.TryParse(ss[0], out getin.mode))
            {
                return(null);
            }
            getin.values = ss.ToDoubleArray(1);
            return(getin);
        }