Exemple #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;
        }
Exemple #2
0
        public raw_filter_row(string text, bool apply_to_existing_lines)
        {
            this.apply_to_existing_lines = apply_to_existing_lines;
            List <filter_line> lines     = new List <filter_line>();
            List <addition>    additions = new List <addition>();

            lines_ = text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string line in lines_)
            {
                filter_line item = filter_line.parse(line);
                if (item != null)
                {
                    lines.Add(item);
                }
                addition add = addition.parse(line);
                if (add != null)
                {
                    additions.Add(add);
                }

                bool is_comment = line.StartsWith("#"), is_empty = line.Trim() == "";
                if (!is_comment && !is_empty && !filter_line.is_color_or_font_line(line))
                {
                    unique_id_ += line.Trim() + "\r\n";
                }

                if (item == null && add == null)
                {
                    if (!is_comment && !is_empty)
                    {
                        // in this case, the line is not valid yet
                        valid_ = false;
                    }
                }
            }
            unique_id_ += "" + apply_to_existing_lines;
            font_       = font_info.default_font_copy;
            init(lines, additions);

            if (items_.Count < 1)
            {
                valid_ = false;
            }
        }
Exemple #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);
        }
Exemple #4
0
 protected bool Equals(addition other)
 {
     return(add == other.add && type == other.type && number == other.number);
 }
Exemple #5
0
 protected bool Equals(addition other) {
     return add == other.add && type == other.type && number == other.number;
 }