Exemple #1
0
        /// <summary>
        /// 문자열을 파싱하여 Vector2D 인스턴스를 빌드합니다.
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public static Vector2D Parse(string s)
        {
            s.ShouldNotBeWhiteSpace("s");

            var m = ParseReg.Match(s);

            if (m.Success)
            {
                return(new Vector2D(double.Parse(m.Result("${x}")), double.Parse(m.Result("${y}"))));
            }

            throw new InvalidOperationException("can't parse  : [" + s + "] to Vector2D");
        }
Exemple #2
0
        /// <summary>
        /// 创建 <see cref="Range" />  的新实例(Range)
        /// </summary>
        public Range(string arg)
        {
            var m = ParseReg.Match(arg);

            if (!m.Success)
            {
                throw new ArgumentException("无法分析指定的 Content-Range 标记 - " + arg);
            }

            AcceptRange = m.Groups[1].Value;
            From        = m.Groups[1].Value.ToInt64();
            To          = m.Groups[1].Value.ToInt64();
            Total       = m.Groups[1].Value.ToInt64();
        }