Inheritance: IDisposable
Exemple #1
0
        public static log_type type(text_reader reader)
        {
            if (reader is file_text_reader)
            {
                return(log_type.file);
            }

            if (reader is inmem_text_reader)
            {
                return(log_type.file);
            }

            if (reader is event_log_reader)
            {
                return(log_type.event_log);
            }
            if (reader is debug_text_reader)
            {
                return(log_type.debug_print);
            }
            if (reader is database_table_reader)
            {
                return(log_type.db);
            }

            Debug.Assert(false);
            return(log_type.file);
        }
        public log_parser(text_reader reader) {
            Debug.Assert(reader != null);
            reader_ = reader;
            reader_.on_set_parser(this);

            forward_to_parser_ = factory.create_parser(reader);

            force_reload();
            new Thread(refresh_thread) {IsBackground = true}.Start();
        }
Exemple #3
0
        public log_parser(text_reader reader)
        {
            Debug.Assert(reader != null);
            reader_ = reader;
            reader_.on_set_parser(this);

            forward_to_parser_ = factory.create_parser(reader);

            force_reload();
            new Thread(refresh_thread)
            {
                IsBackground = true
            }.Start();
        }
Exemple #4
0
        public static string type(text_reader reader)
        {
            if (reader is file_text_reader)
            {
                return("file");
            }

            if (reader is inmem_text_reader)
            {
                return("file");
            }

            if (reader is event_log_reader)
            {
                return("event_log");
            }
            if (reader is debug_text_reader)
            {
                return("debug_print");
            }

            Debug.Assert(false);
            return("file");
        }
Exemple #5
0
        private void editSettings_Click(object sender, EventArgs e) {
            if (logHistory.SelectedIndex < 0)
                return;

            var cur_history = history_[logHistory.SelectedIndex];
            var old_syntax = cur_history.settings.get("syntax");
            var edit = new edit_log_settings_form(cur_history.settings.ToString());
            if (edit.ShowDialog(this) == DialogResult.OK) {
                bool friendly_name_changed = cur_history.friendly_name != edit.friendly_name;
                // at this point, we've updated all settings
                text_.merge_setings(new settings_as_string(edit.settings));
                cur_context().merge_settings( factory.get_context_dependent_settings(text_, text_.settings), edit.edited_syntax_now);

                Text = reader_title() + " - Log Wizard " + version();

                if (friendly_name_changed) 
                    update_history();

                bool will_restart = false;
                if ( edit.needs_restart)
                    if (MessageBox.Show("Changes will take effect only after restart.\r\nWould you like to restart LogWizard now?", "LogWizard", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        will_restart = true;

                var new_settings = cur_history.settings; 
                var new_syntax = new_settings.get("syntax");
                if ( new_settings.get("type") == "file")
                    if (old_syntax != new_syntax && !will_restart) {
                        // in this case, the user has changed the syntax - need to reload everything
                        save();

                        // force complete refresh
                        text_.Dispose();
                        text_ = null;
                        remove_all_log_views();
                        load();
                        on_file_drop(selected_file_name());
                        // we want to refresh it only after it's been loaded, so that it visually shows that
                        util.postpone(() => full_log_ctrl_.force_refresh_visible_columns( all_log_views() ), 2000);
                    }
                save();

                if ( will_restart)
                    restart_app();
            }
        }
Exemple #6
0
        private void create_text_reader(settings_as_string_readonly settings) {
            bool is_file = settings.get("type") == "file";
            if (text_ != null && text_.settings.get("guid") == settings.get("guid")) {
                if (is_file)
                    merge_notes();
                return;
            }
#if old_code
            if (text_ != null && is_file && text_.name == settings.get("name")) {
                merge_notes();
                return;
            }
#endif

            if (text_ != null)
                text_.Dispose();

            create_context_for_log( settings as settings_as_string);
            text_ = factory.create_text_reader(settings as settings_as_string);
            on_new_log();
                
            if (log_parser_.needs_text_syntax) {
                var file_settings = log_parser_.settings;
                if ( file_settings.get("syntax") == find_log_syntax.UNKNOWN_SYNTAX) {
                    set_status("We don't know the syntax of this Log File. We recommend you set it yourself. Press the 'Edit Log Settings' button on the top-right.",
                        status_ctrl.status_type.err);
                    show_source(true);
                }
                else if (!cur_context().has_not_empty_views)
                    set_status("Don't the columns look ok? Perpaps LogWizard did not correctly parse them... If so, Toggle the Source Pane ON (Alt-O), anc click on 'Test'.", status_ctrl.status_type.warn, 15000);
                else if ( !cur_context().has_views)
                    set_status("Why so dull? <a http://www.codeproject.com/Articles/1045528/LogWizard-Filter-your-Logs-Inside-out>Add some colors!</a>");
            } 
            force_initial_refresh_of_all_views();
        }
Exemple #7
0
 public void from_text_reader(text_reader reader) {
     settings_ = reader.settings as settings_as_string;
 }
        public static log_type type(text_reader reader) {
            if (reader is file_text_reader)
                return log_type.file;

            if (reader is inmem_text_reader)
                return log_type.file;

            if (reader is event_log_reader)
                return log_type.event_log;
            if (reader is debug_text_reader)
                return log_type.debug_print;

            Debug.Assert(false);
            return log_type.file;
        }
        public static string type(text_reader reader) {
            if (reader is file_text_reader)
                return "file";

            if (reader is inmem_text_reader)
                return "file";

            if (reader is event_log_reader)
                return "event_log";
            if (reader is debug_text_reader)
                return "debug_print";

            Debug.Assert(false);
            return "file";
        }
Exemple #10
0
 public void from_text_reader(text_reader reader) {
     settings_ = reader.write_settings;
 }