Example #1
0
        public static addition parse(string line)
        {
            line = line.Trim();
            if (line.StartsWith("#"))
                // allow comments
                return null;

            if ( line.Length < 1 || (line[0] != '-' && line[0] != '+'))
                return null;

            addition a = new addition();
            if ( line.EndsWith("ms")) {
                a.type = number_type.millisecs;
                line = line.Substring(0, line.Length - 2);
            }
            line = line.Trim();
            if (line.Length > 0 && line[0] == '-') {
                a.add = add_type.before;
                line = line.Substring(1);
            }
            if (line.Length > 0 && line[0] == '+')
                line = line.Substring(1);
            line = line.Trim();

            if ( Int32.TryParse(line, out a.number))
                return a;

            return null;
        }
Example #2
0
        public filter_row(string text)
        {
            List <filter_line> lines     = new List <filter_line>();
            List <addition>    additions = new List <addition>();

            foreach (string line in text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries))
            {
                filter_line item = filter_line.parse(line);
                if (item != null)
                {
                    lines.Add(item);
                }
                addition add = addition.parse(line);
                if (add != null)
                {
                    additions.Add(add);
                }
            }
            init(lines, additions);
        }
Example #3
0
        public static addition parse(string line)
        {
            line = line.Trim();
            if (line.StartsWith("#"))
            {
                // allow comments
                return(null);
            }

            if (line.Length < 1 || (line[0] != '-' && line[0] != '+'))
            {
                return(null);
            }

            addition a = new addition();

            if (line.EndsWith("ms"))
            {
                a.type = number_type.millisecs;
                line   = line.Substring(0, line.Length - 2);
            }
            line = line.Trim();
            if (line.Length > 0 && line[0] == '-')
            {
                a.add = add_type.before;
                line  = line.Substring(1);
            }
            if (line.Length > 0 && line[0] == '+')
            {
                line = line.Substring(1);
            }
            line = line.Trim();

            if (Int32.TryParse(line, out a.number))
            {
                return(a);
            }

            return(null);
        }
Example #4
0
 protected bool Equals(addition other)
 {
     return add == other.add && type == other.type && number == other.number;
 }
Example #5
0
 protected bool Equals(addition other)
 {
     return(add == other.add && type == other.type && number == other.number);
 }