Esempio n. 1
0
        private void test_Click(object sender, EventArgs e)
        {
            result.Enabled = false;
            result.ClearObjects();

            // parse each line
            log_parser parse = new log_parser(new inmem_text_reader(lines.Text, syntax.Text));

            while (!parse.up_to_date)
            {
                Thread.Sleep(10);
            }

            for (int col_idx = 0; col_idx < result.AllColumns.Count; col_idx++)
            {
                var header = result.AllColumns[col_idx];

                header.Width          = col_idx > 0 ? 100 : 0;
                header.FillsFreeSpace = col_idx == (int)info_type.msg;
                header.IsVisible      = col_idx == (int)info_type.msg;
            }
            result.RebuildColumns();

            for (int idx = 0; idx < parse.line_count; ++idx)
            {
                var           l    = parse.line_at(idx);
                List <string> cols = new List <string>();
                for (int col_idx = 0; col_idx < (int)info_type.max; ++col_idx)
                {
                    cols.Add(l.part((info_type)col_idx));
                }

                result.AddObject(new item(cols));
            }

            for (int col_idx = 0; col_idx < result.AllColumns.Count; col_idx++)
            {
                var header = result.AllColumns[col_idx];

                bool column_visible = false;
                for (int idx = 0; idx < result.GetItemCount() && !column_visible; ++idx)
                {
                    if ((result.GetItem(idx).RowObject as item).part(col_idx) != "")
                    {
                        column_visible = true;
                    }
                }

                if (column_visible)
                {
                    header.Width     = 100;
                    header.IsVisible = true;
                    header.Text      = column_name(col_idx);
                }
            }
            result.RebuildColumns();
            result.Enabled = true;
        }
Esempio n. 2
0
        private void test_Click(object sender, EventArgs e) {
            result.Enabled = false;
            result.ClearObjects();

            // parse each line
            log_parser parse = new log_parser(new inmem_text_reader(lines.Text, syntax.Text));
            while (!parse.up_to_date)
                Thread.Sleep(10);

            for (int col_idx = 0; col_idx < result.AllColumns.Count; col_idx++) {
                var header = result.AllColumns[col_idx];

                header.Width = col_idx > 0 ? 100 : 0;
                header.FillsFreeSpace = col_idx == (int) info_type.msg;
                header.IsVisible = col_idx == (int) info_type.msg;
            }
            result.RebuildColumns();

            for (int idx = 0; idx < parse.line_count; ++idx) {
                var l = parse.line_at(idx);
                List<string> cols = new List<string>();
                for (int col_idx = 0; col_idx < (int) info_type.max; ++col_idx)
                    cols.Add(l.part((info_type) col_idx));

                result.AddObject(new item(cols));
            }

            for (int col_idx = 0; col_idx < result.AllColumns.Count; col_idx++) {
                var header = result.AllColumns[col_idx];

                bool column_visible = false;
                for (int idx = 0; idx < result.GetItemCount() && !column_visible; ++idx)
                    if ((result.GetItem(idx).RowObject as item).part(col_idx) != "")
                        column_visible = true;

                if (column_visible) {
                    header.Width = 100;
                    header.IsVisible = true;
                    header.Text = column_name(col_idx);
                }
            }
            result.RebuildColumns();
            result.Enabled = true;
        }