상속: IDisposable
예제 #1
0
        public Tuple <int, int>[] idx_in_line(aliases aliases)
        {
            compute_entry_and_indexes();

            var idx = new Tuple <int, int> [(int)info_type.max];

            for (int i = 0; i < idx.Length; ++i)
            {
                idx[i] = new Tuple <int, int>(-1, -1);
            }

            var sorted = indexes_.OrderBy(x => x.Value).Select(x => new Tuple <int, int>((int)aliases.to_info_type(x.Key), x.Value)).ToList();

            for (int i = 0; i < sorted.Count; ++i)
            {
                int len     = i < sorted.Count - 1 ? sorted[i + 1].Item2 - sorted[i].Item2 : -1;
                int cur_idx = sorted[i].Item1;
                // we can have too many columns - we will ignore the last ones
                if (cur_idx < idx.Length)
                {
                    idx[sorted[i].Item1] = new Tuple <int, int>(sorted[i].Item2, len);
                }
            }

            return(idx);
        }
예제 #2
0
        public test_description_ctrl() {
            InitializeComponent();

            aliases a = new aliases("");
            a.on_column_names(new List<string>() { "thread", "time", "msg", "ctx1", "ctx2", "ctx3" });
            description_ctrl1.set_aliases(a);
        }
예제 #3
0
        private void ok_Click(object sender, EventArgs e) {
            if (text.Text.Trim() == unknown_) {
                // user hasn't changed anything
                DialogResult = DialogResult.Cancel;
                return;
            }

            var old = aliases_;
            aliases_ = aliases.from_enter_separated_string(text.Text);

            if (!aliases_.is_non_friendly_name_info_the_same(old))
                needs_restart_ = true;
            DialogResult = DialogResult.OK;
        }
예제 #4
0
        public alias_form(aliases aliases, List<string> column_names) {
            aliases_ = aliases;
            column_names_ = column_names;
            InitializeComponent();

            string existing = aliases_.to_enter_separated_string();
            if (existing != "")
                text.Text = existing;
            else {
                // try our best guess
                unknown_ = util.concatenate(column_names.Where(x => !aliases.is_known_column_name(x)).Select(x => x + "="), "\r\n");
                text.Text = unknown_;
            }
        }
예제 #5
0
        public Tuple<int, int>[] idx_in_line(aliases aliases) {
            var idx = new Tuple<int, int>[(int) info_type.max];
            for (int i = 0; i < idx.Length; ++i)
                idx[i] = new Tuple<int, int>(-1, -1);

            var sorted = infos_.OrderBy(x => x.Value).Select(x => new Tuple<int, int>((int) aliases.to_info_type(x.Key) , x.Value)).ToList();

            for (int i = 0; i < sorted.Count; ++i) {
                int len = i < sorted.Count - 1 ? sorted[i + 1].Item2 - sorted[i].Item2 : -1;
                int cur_idx = sorted[i].Item1;
                // we can have too many columns - we will ignore the last ones
                if ( cur_idx < idx.Length)
                    idx[sorted[i].Item1] = new Tuple<int, int>(sorted[i].Item2, len);
            }

            return idx;
        }
예제 #6
0
        public static aliases from_enter_separated_string(string s)
        {
            var result = new aliases()
            {
                sett_ = new settings_as_string(s)
            };

            result.init();
            // this will force matching all log columns to our Logwizard columns
            var names = result.sett_.names().ToList();

            foreach (var name in names)
            {
                result.to_info_type(name, names);
            }
            return(result);
        }
예제 #7
0
 // the aliases tell us which columns are visible
 public void set_aliases(aliases aliases) {
     // set_aliases names as well
     visible_columns_.Clear();
     names_.Clear();
     foreach ( info_type type in Enum.GetValues(typeof(info_type)))
         if (aliases.has_column(type)) {
             string name = aliases.friendly_name(type);
             visible_columns_.Add(type);
             names_.Add(type, name);
         }
     update_ui();
 }
예제 #8
0
 // if the non-friendly info changes, this requires a re-parse of the whole log
 // for now (1.4.8), just restart LogWizard
 public bool is_non_friendly_name_info_the_same(aliases other) {
     return sorted_non_friendly_name_lines().SequenceEqual(other.sorted_non_friendly_name_lines());
 }
예제 #9
0
 public static aliases from_enter_separated_string(string s) {
     var result = new aliases() { sett_ = new settings_as_string(s) };
     result.init();
     // this will force matching all log columns to our Logwizard columns
     var names = result.sett_.names().ToList();
     foreach (var name in names)
         result.to_info_type(name, names);
     return result;
 }
예제 #10
0
 public void on_aliases(aliases aliases) {
     lock(this)
         foreach ( info_type type in Enum.GetValues(typeof(info_type)))
             if ( info_type_io.is_snoopable(type))
                 if (aliases.has_column(type))
                     snoop_for(type).is_visible = false;
                 else {
                     // this column is not visible for this log
                     if (snoops_.ContainsKey(type)) {
                         var unuse_now = snoops_[type];
                         snoops_.Remove(type);
                         unused_.Add(unuse_now);
                         unuse_now.form.is_visible = false;
                     }
                 }            
     aliases_set_ = true;
 }
예제 #11
0
 // if the non-friendly info changes, this requires a re-parse of the whole log
 // for now (1.4.8), just restart LogWizard
 public bool is_non_friendly_name_info_the_same(aliases other)
 {
     return(sorted_non_friendly_name_lines().SequenceEqual(other.sorted_non_friendly_name_lines()));
 }