Inheritance: settings_as_string_readonly
Esempio n. 1
0
 public dictionary_setting_readonly(settings_as_string sett, string name, T def = default(T))
 {
     sett_    = sett;
     name_    = name;
     default_ = def;
     values_  = new settings_as_string(sett.get(name).Replace(separator_, "\r\n"));
 }
Esempio n. 2
0
 protected entry_text_reader_base(settings_as_string sett) : base(sett)
 {
     new Thread(read_entries_thread)
     {
         IsBackground = true
     }.Start();
 }
Esempio n. 3
0
        protected log_settings_string_readonly(string sett)
        {
            settings_ = new settings_as_string(sett);

            // general
            guid_          = new single_setting <string>(settings_, "guid", "");
            name_          = new single_setting <string>(settings_, "name", "");
            syntax_        = new single_setting <string>(settings_, "syntax", file_text_reader.UNKNOWN_SYNTAX);
            context_       = new single_setting <string>(settings_, "context", "");
            friendly_name_ = new single_setting <string>(settings_, "friendly_name", "");
            type_          = new single_setting_enum <log_type>(settings_, "type", log_type.file);
            file_type_     = new single_setting_enum <file_log_type>(settings_, "file_type", file_log_type.best_guess);
            reverse_       = new single_setting_bool(settings_, "reverse");

            available_columns_            = new single_setting <string>(settings_, "available_columns", "");
            is_open_first_time_           = new single_setting_bool(settings_, "is_open_first_time", true);
            column_positions_             = new dictionary_setting <string>(settings_, "column_positions", "");
            apply_column_positions_to_me_ = new dictionary_setting <bool>(settings_, "apply_column_positions_to_me");

            column_formatting_             = new dictionary_setting <string>(settings_, "column_format", "");
            apply_column_formatting_to_me_ = new dictionary_setting <bool>(settings_, "apply_column_format_to_me");

            category_format_ = new single_setting <string>(settings_, "category_format", "");

            description_template_ = new single_setting <string>(settings_, "description_template", "");
            aliases_ = new single_setting <string>(settings_, "aliases", "");

            line_if_line_does_not_match_syntax_ = new single_setting_bool(settings_, "line.if_line_does_not_match_syntax");
            line_if_line_starts_with_tab_       = new single_setting_bool(settings_, "line.if_line_starts_with_tab", true);

            part_separator_ = new single_setting <string>(settings_, "part.separator", ":");

            cvs_has_header_     = new single_setting_bool(settings_, "csv.has_header", true);
            cvs_separator_char_ = new single_setting <string>(settings_, "csv.separator_char", ",");

            event_remote_machine_name_ = new single_setting <string>(settings_, "event.remote_machine_name", "");
            event_remote_domain_       = new single_setting <string>(settings_, "event.remote_domain", "");
            event_remote_user_name_    = new single_setting <string>(settings_, "event.remote_user_name", "");
            event_remote_password_     = new single_setting <string>(settings_, "event.remote_password", "");
            event_log_type_            = new single_setting <string>(settings_, "event.log_type", "Application|System");
            event_provider_name_       = new single_setting <string>(settings_, "event.provider_name", "");

            debug_global_       = new single_setting_bool(settings_, "debug.global");
            debug_process_name_ = new single_setting <string>(settings_, "debug.process_name", "");

            xml_delimiter_ = new single_setting <string>(settings_, "xml.delimiter", "");

            db_provider_ = new single_setting <string>(settings_, "db_provider", "System.Data.SQLite");
            // http://stackoverflow.com/questions/11414399/sqlite-throwing-a-string-not-recognized-as-a-valid-datetime
            db_connection_string_ = new single_setting <string>(settings_, "db_connection_string", "Data Source=<your_db_file>;Version=3;new=False;datetimeformat=CurrentCulture");
            db_table_name_        = new single_setting <string>(settings_, "db_table_name", "logtable");
            db_fields_            = new single_setting <string>(settings_, "db_fields", "time_stamp\r\nlevel\r\nlogger\r\nmessage")
            {
                can_be_multi_line = true
            };
            db_id_field_ = new single_setting <string>(settings_, "db_id_field", "");

            // = new single_setting<string>(settings_, "", "");
        }
 public settings_as_string sub(string[] names) {
     var names_to_return = this.names();
     names_to_return = names_to_return.Where(names.Contains).ToArray();
     settings_as_string other = new settings_as_string("");
     lock (this)
         other.sett_ = sett_.Where(x => names_to_return.Contains(x.Key)).ToDictionary(x => x.Key, x => x.Value);
     return other;
 }
Esempio n. 5
0
        public settings_as_string sub(string[] names)
        {
            var names_to_return = this.names();

            names_to_return = names_to_return.Where(names.Contains).ToArray();
            settings_as_string other = new settings_as_string("");

            lock (this)
                other.sett_ = sett_.Where(x => names_to_return.Contains(x.Key)).ToDictionary(x => x.Key, x => x.Value);
            return(other);
        }
Esempio n. 6
0
        // 'other' overrides all we have
        public settings_as_string merge_copy(settings_as_string_readonly other)
        {
            settings_as_string merged = new settings_as_string(ToString());

            var other_names = other.names();

            foreach (string name in other_names)
            {
                merged.set(name, other.get(name));
            }

            return(merged);
        }
        private void load_save(bool load, string prefix)
        {
            app.load_save(load, ref name, prefix + ".name", "Default");

            string settings_str = default_settings_.ToString();

            if (load)
            {
                app.load_save(load, ref settings_str, prefix + ".default_settings");
                default_settings_ = new settings_as_string(settings_str);

                if (settings_str == "")
                {
                    // ... 1.4.8- kept the old name for persistenting
                    app.load_save(load, ref settings_str, prefix + ".default_syntax");
                    if (settings_str != "")
                    {
                        default_settings_.set("syntax", settings_str);
                    }
                }
            }
            else
            {
                app.load_save(load, ref settings_str, prefix + ".default_settings");
            }

            int view_count = views.Count;

            app.load_save(load, ref view_count, prefix + ".view_count", 0);
            if (load)
            {
                views.Clear();
                while (views.Count < view_count)
                {
                    views.Add(new ui_view());
                }
            }

            for (int i = 0; i < view_count; ++i)
            {
                views[i].load_save(load, prefix + ".view" + i + ".");
            }

            if (load && views.Count == 0)
            {
                views.Add(new ui_view()
                {
                    is_default_name = true, name = "View_1"
                });
            }
        }
Esempio n. 8
0
        public file_text_reader(settings_as_string sett) : base(sett) {
            string file = sett.get("name");
            buffer_ = new byte[max_read_in_one_go];
            try {
                // get absolute path - normally, this should be the absolute path, but just to be sure
                file_ = new FileInfo(file).FullName;
            } catch {
                file_ = file;
            }

            var thread = app.inst.use_file_monitoring_api ? new Thread(read_all_file_thread_file_monitoring_api) {IsBackground = true}
                                                          : new Thread(read_all_file_thread) {IsBackground = true};
            thread.Start();
        }
        protected log_settings_string_readonly(string sett)
        {
            settings_ = new settings_as_string(sett);

            // general
            guid_          = new single_setting <string>(settings_, "guid", "");
            name_          = new single_setting <string>(settings_, "name", "");
            syntax_        = new single_setting <string>(settings_, "syntax", file_text_reader.UNKNOWN_SYNTAX);
            context_       = new single_setting <string>(settings_, "context", "");
            friendly_name_ = new single_setting <string>(settings_, "friendly_name", "");
            type_          = new single_setting_enum <log_type>(settings_, "type", log_type.file);
            file_type_     = new single_setting_enum <file_log_type>(settings_, "file_type", file_log_type.best_guess);
            reverse_       = new single_setting_bool(settings_, "reverse");

            available_columns_            = new single_setting <string>(settings_, "available_columns", "");
            is_open_first_time_           = new single_setting_bool(settings_, "is_open_first_time", true);
            column_positions_             = new dictionary_setting <string>(settings_, "column_positions", "");
            apply_column_positions_to_me_ = new dictionary_setting <bool>(settings_, "apply_column_positions_to_me");

            column_formatting_             = new dictionary_setting <string>(settings_, "column_format", "");
            apply_column_formatting_to_me_ = new dictionary_setting <bool>(settings_, "apply_column_format_to_me");

            category_format_ = new single_setting <string>(settings_, "category_format", "");

            description_template_ = new single_setting <string>(settings_, "description_template", "");
            aliases_ = new single_setting <string>(settings_, "aliases", "");

            line_if_line_ = new single_setting_bool(settings_, "line.if_line");

            part_separator_ = new single_setting <string>(settings_, "part.separator", ":");

            cvs_has_header_     = new single_setting_bool(settings_, "csv.has_header", true);
            cvs_separator_char_ = new single_setting <string>(settings_, "csv.separator_char", ",");

            event_remote_machine_name_ = new single_setting <string>(settings_, "event.remote_machine_name", "");
            event_remote_domain_       = new single_setting <string>(settings_, "event.remote_domain", "");
            event_remote_user_name_    = new single_setting <string>(settings_, "event.remote_user_name", "");
            event_remote_password_     = new single_setting <string>(settings_, "event.remote_password", "");
            event_log_type_            = new single_setting <string>(settings_, "event.log_type", "Application|System");
            event_provider_name_       = new single_setting <string>(settings_, "event.provider_name", "");

            debug_global_       = new single_setting_bool(settings_, "debug.global");
            debug_process_name_ = new single_setting <string>(settings_, "debug.process_name", "");

            xml_delimiter_ = new single_setting <string>(settings_, "xml.delimiter", "");
            // = new single_setting<string>(settings_, "", "");
        }
Esempio n. 10
0
        public test_log_view() {
            InitializeComponent();

            string file = @"C:\john\code\buff\lw-tests\small.log";
            string syntax = "$time[0,12] $ctx1[13,10] $level[24,5] $class[' ','- '] $msg";

            settings_as_string sett = new settings_as_string("");
            sett.set("type", "file");
            sett.set("name", file);
            sett.set("syntax", syntax);

            lv_ = new log_view(this, "testing 123");
            lv_.Dock = DockStyle.Fill;
            this.Controls.Add(lv_);
            lv_.show_name = false;

            lv_.set_log( new log_reader( new log_parser(new file_text_reader(sett))) );
            var filter = new List<raw_filter_row>();
            lv_.set_filter( filter  );

            app.inst.edit_mode = app.edit_mode_type.always;
//            app.inst.edit_mode = app.edit_mode_type.with_space;
        }
Esempio n. 11
0
        public file_text_reader(settings_as_string sett) : base(sett)
        {
            string file = sett.get("name");

            buffer_ = new byte[max_read_in_one_go];
            try {
                // get absolute path - normally, this should be the absolute path, but just to be sure
                file_ = new FileInfo(file).FullName;
            } catch {
                file_ = file;
            }

            var thread = app.inst.use_file_monitoring_api ? new Thread(read_all_file_thread_file_monitoring_api)
            {
                IsBackground = true
            }
                                                          : new Thread(read_all_file_thread)
            {
                IsBackground = true
            };

            thread.Start();
        }
Esempio n. 12
0
        private static void load_contexts(settings_file sett) {
            logger.Debug("loading contexts");

            int history_count = int.Parse( sett.get("history_count", "0"));
            for (int idx = 0; idx < history_count; ++idx) {
                history hist = new history();
                string guid = sett.get("history." + idx + ".guid");
                if (guid != "") {
                    // 1.5.6+ - guid points to the whole settings
                    string settings = sett.get("guid." + guid);
                    if (settings == "") {
                        logger.Debug("history guid removed " + guid);
                        continue; // entry removed
                    }
                    Debug.Assert(settings.Contains(guid));
                    hist.from_settings(new settings_as_string(settings));  
                } else {
                    // old code (pre 1.5.6)
                    string type_str = sett.get("history." + idx + "type", "file");
                    if (type_str == "0")
                        type_str = "file";
                    string name = sett.get("history." + idx + "name");
                    string friendly_name = sett.get("history." + idx + "friendly_name");

                    settings_as_string history_sett = new settings_as_string("");
                    history_sett.set("type", type_str);
                    history_sett.set("name", name);
                    history_sett.set("friendly_name", friendly_name);
                    // create a guid now
                    history_sett.set("guid", Guid.NewGuid().ToString());
                    hist.from_settings(history_sett);
                }

                history_.Add( hist );
            }
            history_ = history_.Where(h => {
                if (h.type == history.entry_type.file) {
                    // 1.5.11 - don't include this into the list next time the user opens the app
                    //          (so that he'll see the "Drop me like it's hot" huge message)
                    if (h.name.EndsWith("LogWizardSetupSample.log"))
                        return false;

                    if (File.Exists(h.name))
                        // 1.1.5+ - compute md5s for this
                        md5_log_keeper.inst.compute_default_md5s_for_file(h.name);
                    else
                        return false;
                }
                return true;
            }).ToList();


            int count = int.Parse( sett.get("context_count", "1"));
            for ( int i = 0; i < count ; ++i) {
                ui_context ctx = new ui_context();
                ctx.load("context." + i);
                contexts_.Add(ctx);
            }
            // 1.1.25 - at application start - remove empty contexts (like, the user may have dragged a file, not what he wanted, dragged another)
            contexts_ = contexts_.Where(x => x.has_not_empty_views || x.name == "Default").ToList();
        }
Esempio n. 13
0
        private void on_new_log() {
            string size = text_ is file_text_reader ? " (" + new FileInfo(text_.name).Length + " bytes)" : "";
            set_status_forever("Log: " + text_.name + size);
            dropHere.Visible = false;

            if (history_.Count < 1)
                history_select(text_.settings);

            var reader_settings_copy = new settings_as_string( text_.settings.ToString() );
            var context_settings_copy = new settings_as_string( settings_to_context(reader_settings_copy).default_settings.ToString());
            context_settings_copy.merge(reader_settings_copy.ToString());
            var file_text = text_ as file_text_reader;
            if (file_text != null) 
                if ( factory.guess_file_type(file_text.name) == "line-by-line")
                    if (reader_settings_copy.get("syntax") == "") {
                        // file reader doesn't know syntax
                        // by default - try to find the syntax by reading the header info; otherwise, try to parse it
                        string file_to_syntax = log_to.file_to_syntax(text_.name);
                        if (file_to_syntax != "") 
                            // note: file-to-syntax overrides the context syntax
                            context_settings_copy.set("syntax", file_to_syntax);                        
                        // note: if the context already knows syntax, use that
                        else if (context_settings_copy.get("syntax") == "") {
                            string found_syntax = file_text.try_to_find_log_syntax();
                            if (found_syntax != "" && found_syntax != file_text_reader.UNKNOWN_SYNTAX) 
                                context_settings_copy.set("syntax", found_syntax);
                        }
                    }            

            text_.merge_setings( context_settings_copy);

            // note: we recreate the log, so that cached filters know to rebuild
            log_parser_ = new log_parser(text_);
            log_parser_.on_aliases_changed = on_aliases_changed;
            if ( text_.settings.get("description_template") != "")
                description.set_layout( text_.settings.get("description_template"));

            ui_context log_ctx = settings_to_context( text_.settings );
            bool same_context = log_ctx == cur_context();
            if (!same_context) {
                ++ignore_change_;
                // set_aliases context based on log
                curContextCtrl.SelectedIndex = contexts_.IndexOf(log_ctx);
                --ignore_change_;

                remove_all_log_views();
                on_context_changed();
            }

            full_log_ctrl_.set_filter(new List<raw_filter_row>());
            on_new_log_parser();
            load();

            if (log_parser_.has_multi_line_columns) 
                if (!app.inst.has_shown_details_pane) {
                    app.inst.has_shown_details_pane = true;
                    show_details(global_ui.show_details = true);
                }

            add_reader_to_history();
            app.inst.set_log_file(selected_file_name());
            Text = reader_title() + " - Log Wizard " + version();

            logger.Info("new reader " + history_[logHistory.SelectedIndex].name);

            // at this point, some file has been dropped
            log_view_for_tab(0).Visible = true;

            notes.Enabled = text_ is file_text_reader;
            if (notes.Enabled) {
                notes.load(notes_keeper.inst.notes_file_for_file(text_.name));
                merge_notes();
            }

            util.postpone(update_list_view_edit, 250);
            util.postpone(check_are_settings_complete, 1500);
        }
 public void copy_from(ui_context other) {
     default_settings_ = other.default_settings_;
     name = other.name;
     views = other.views.ToList();
 }
Esempio n. 15
0
        private int history_select(string unique_name, string friendly_name = "") {
            ++ignore_change_;
            bool needs_save = false;
            logHistory.SelectedIndex = -1;

            bool found = false;
            for (int i = 0; i < history_.Count && !found; ++i)
                if (history_[i].unique_name == unique_name) {
                    found = true;
                    bool is_sample = unique_name.ToLower().EndsWith("logwizardsetupsample.log");
                    // if not default form - don't move the selection to the end
                    bool is_default_form = toggled_to_custom_ui_ < 0;
                    if (is_sample || !is_default_form)
                        logHistory.SelectedIndex = i;
                    else {
                        // whatever the user selects, move it to the end
                        history h = history_[i];
                        history_.RemoveAt(i);
                        history_.Add(h);
                        logHistory.Items.RemoveAt(i);
                        logHistory.Items.Add(h.ui_friendly_name);
                        logHistory.SelectedIndex = logHistory.Items.Count - 1;
                        needs_save = true;
                    }
                }

            if (logHistory.SelectedIndex < 0) {
                // if we end up here, it can only be a file! - we don't allow selecting anything else that we don't already have in history
                Debug.Assert(File.Exists(unique_name));
                // FIXME (minor) if not on the default form -> i should not put it last (since that will be automatically loaded at restart)
                history new_ = new history();
                settings_as_string hist_sett = new settings_as_string("");
                hist_sett.set("type", "file");
                hist_sett.set("name", unique_name);
                hist_sett.set("friendly_name", friendly_name);
                // FIXME perhaps GUID as well?
                new_.from_string(hist_sett.ToString());
                history_.Add(new_);
                logHistory.Items.Add(history_.Last().ui_friendly_name);
                logHistory.SelectedIndex = logHistory.Items.Count - 1;
            }
            --ignore_change_;

            if (needs_save)
                save();
            return logHistory.SelectedIndex;
        }
Esempio n. 16
0
 protected text_reader(settings_as_string sett) {
     settings_ = sett;
     settings_.on_changed += on_settings_changed;
 }
        private void load_save(bool load, string prefix) {
            app.load_save(load, ref name, prefix + ".name", "Default" );

            string settings_str = default_settings_.ToString();
            if (load) {
                app.load_save(load, ref settings_str, prefix + ".default_settings");
                default_settings_ = new settings_as_string(settings_str);

                if (settings_str == "") {
                    // ... 1.4.8- kept the old name for persistenting
                    app.load_save(load, ref settings_str, prefix + ".default_syntax");
                    if (settings_str != "")
                        default_settings_.set("syntax", settings_str);
                }
            }
            else
                app.load_save(load, ref settings_str, prefix + ".default_settings");

            int view_count = views.Count;
            app.load_save(load, ref view_count, prefix + ".view_count", 0);
            if (load) {
                views.Clear();
                while ( views.Count < view_count)
                    views.Add( new ui_view());
            }

            for (int i = 0; i < view_count; ++i) 
                views[i].load_save(load, prefix + ".view" + i + ".");

            if ( load && views.Count == 0)
                views.Add( new ui_view() { is_default_name = true, name = "View_1" });
        }
Esempio n. 18
0
 internal single_setting(settings_as_string sett, string name, T default_ = default(T)) : base(sett, name, default_)
 {
 }
Esempio n. 19
0
        public log_settings_string sub(string[] names)
        {
            settings_as_string sub_sett = settings_.sub(names);

            return(new log_settings_string(sub_sett.ToString()));
        }
Esempio n. 20
0
 protected text_reader(settings_as_string sett)
 {
     settings_             = sett;
     settings_.on_changed += on_settings_changed;
 }
Esempio n. 21
0
        public void merge(string other)
        {
            settings_as_string_readonly other_sett = new settings_as_string(other);

            merge(other_sett);
        }
 public void copy_from(ui_context other)
 {
     default_settings_ = other.default_settings_;
     name  = other.name;
     views = other.views.ToList();
 }
Esempio n. 23
0
 public void merge(string other) {
     settings_as_string_readonly other_sett = new settings_as_string(other);
     merge(other_sett);
 }
Esempio n. 24
0
 protected single_setting_readonly(settings_as_string sett, string name, T default_ = default(T))
 {
     sett_         = sett;
     name_         = name;
     this.default_ = default_;
 }
Esempio n. 25
0
 public debug_text_reader(settings_as_string sett) : base(sett) {
     settings.on_changed += (a) => force_reload();
 }
Esempio n. 26
0
 protected entry_text_reader_base(settings_as_string sett) : base(sett) {
     new Thread(read_entries_thread) {IsBackground = true}.Start();
 }
Esempio n. 27
0
 protected file_text_reader_base(settings_as_string sett) : base(sett)
 {
 }
Esempio n. 28
0
        private void on_new_log() {
            string size = text_ is file_text_reader ? " (" + new FileInfo(text_.name).Length + " bytes)" : "";
            set_status_forever("Log: " + text_.name + size);
            dropHere.Visible = false;

            if (history_.Count < 1)
                history_select(text_.unique_id);

            var reader_settings_copy = new settings_as_string( text_.settings.ToString() );
            var context_settings_copy = new settings_as_string( settings_to_context(reader_settings_copy).default_settings.ToString());
            context_settings_copy.merge(reader_settings_copy.ToString());
            var file_text = text_ as file_text_reader;
            if (file_text != null) 
                if ( factory.guess_file_type(file_text.name) == "line-by-line")
                    if (reader_settings_copy.get("syntax") == "") {
                        // file reader doesn't know syntax
                        // by default - try to find the syntax by reading the header info; otherwise, try to parse it
                        string file_to_syntax = log_to.file_to_syntax(text_.name);
                        if (file_to_syntax != "") {
                            // note: file-to-syntax overrides the context syntax
                            context_settings_copy.set("syntax", file_to_syntax);
                            context_settings_copy.set("syntax_type", "file_to_syntax");
                        }
                        // note: if the context already knows syntax, use that
                        else if (context_settings_copy.get("syntax") == "") {
                            string found_syntax = file_text.try_to_find_log_syntax();
                            if (found_syntax != "" && found_syntax != file_text_reader.UNKNOWN_SYNTAX) {
                                context_settings_copy.set("syntax", found_syntax);
                                context_settings_copy.set("syntax_type", "try_to_find_syntax");
                            }
                        }
                    }            

            text_.merge_setings( context_settings_copy.ToString());

            // note: we recreate the log, so that cached filters know to rebuild
            log_parser_ = new log_parser(text_);
            on_new_log_parser();

            full_log_ctrl_.set_filter(new List<raw_filter_row>());

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

            load_bookmarks();
            logger.Info("new reader " + history_[logHistory.SelectedIndex].name);

            // at this point, some file has been dropped
            log_view_for_tab(0).Visible = true;

            notes.Enabled = text_ is file_text_reader;
            if (notes.Enabled) {
                notes.load(notes_keeper.inst.notes_file_for_file(text_.name));
                merge_notes();
            }

            util.postpone(update_list_view_edit, 250);
            util.postpone(check_are_settings_complete, 1500);
        }
Esempio n. 29
0
        // 'other' overrides all we have
        public settings_as_string merge_copy(settings_as_string_readonly other) {
            settings_as_string merged = new settings_as_string(ToString());

            var other_names = other.names();
            foreach ( string name in other_names)
                merged.set(name, other.get(name));

            return merged;
        }
Esempio n. 30
0
 protected file_text_reader_base(settings_as_string sett) : base(sett) {
     
 }
Esempio n. 31
0
 public void from_text_reader(text_reader reader) {
     settings_ = reader.settings as settings_as_string;
 }
Esempio n. 32
0
 public event_log_reader(settings_as_string sett) : base(sett)
 {
     settings.on_changed += on_settings_changed;
     sett.set("name", friendly_name);
     reverse_ = settings.get("event.reversed", "0") != "0";
 }
Esempio n. 33
0
        /* 1.1.25+
            - on new file (that does not match any context)
              - we will create a context matching the name of the file (if one exists, we will automatically select it)
              - by default, we'll never go to the "Default" context
              - the idea is for the uesr not to have to mistakenly delete a context when he's selecting a different type of file,
                (since he would want new filters). thus, just create a new context where he can do anything
        */
        private void create_context_for_log(settings_as_string log_settings) {
            string context_name = log_settings.get("context");
            if (contexts_.FirstOrDefault(x => x.name == context_name) != null)
                // in this case, I already have a context, and the context exists
                return;

            ui_context log_ctx = settings_to_context(log_settings);
            if (log_ctx.name != "Default")
                // we already have a context
                return;

            ui_context new_ctx = new ui_context();
            contexts_.Add(new_ctx);

            switch (log_settings.get("type")) {
            case "file":
                string file = log_settings.get("name");
                Debug.Assert(file != "");
                new_ctx.name = Path.GetFileNameWithoutExtension(new FileInfo(file).Name);
                break;
            case "event_log":
                new_ctx.name = least_unused_context_name("Event Log");
                break;
            case "debug_print":
                new_ctx.name = least_unused_context_name("Debug");
                break;
            default:
                Debug.Assert(false);
                return;
            }

            Debug.Assert(new_ctx.name != "");
            log_settings.set("context", new_ctx.name);

            update_contexts_combos_in_all_forms();
        }
Esempio n. 34
0
 public dictionary_setting(settings_as_string sett, string name, T def = default(T)) : base(sett, name, def)
 {
 }
Esempio n. 35
0
 public debug_text_reader(settings_as_string sett) : base(sett)
 {
     settings.on_changed += (a) => force_reload();
 }
Esempio n. 36
0
 public event_log_reader(settings_as_string sett) : base(sett) {
     settings.on_changed += on_settings_changed;
     sett.set("name", friendly_name);
     reverse_ = settings.get("event.reversed", "0") != "0"; 
 }
Esempio n. 37
0
 internal single_setting_enum_readonly(settings_as_string sett, string name, T default_)
 {
     sett_         = sett;
     name_         = name;
     this.default_ = default_;
 }
Esempio n. 38
0
 public void from_settings(settings_as_string_readonly sett) {
     settings_ = sett as settings_as_string;
 }
Esempio n. 39
0
 internal single_setting_enum(settings_as_string sett, string name, T default_) : base(sett, name, default_)
 {
 }
Esempio n. 40
0
 private void on_new_file_log(string name, string friendly_name) {
     string guid = sett_.get("file_to_guid." + name);
     if (guid != "") 
         create_text_reader(new settings_as_string(sett_.get("guid." + guid)));
     else {
         // at this point, we know it's a ***new*** file
         settings_as_string file_settings = new settings_as_string("");
         file_settings.set("type", "file");
         file_settings.set("name", name);
         file_settings.set("friendly_name", friendly_name);
         file_settings.set("guid", Guid.NewGuid().ToString());
         create_text_reader(file_settings);
     }
 }
Esempio n. 41
0
 internal single_setting_bool_readonly(settings_as_string sett, string name, bool default_ = false)
 {
     sett_         = sett;
     name_         = name;
     this.default_ = default_;
 }
Esempio n. 42
0
        private void whatsupOpen_Click(object sender, EventArgs e) {
            var add = new edit_log_settings_form("", edit_log_settings_form.edit_type.add);
            if (add.ShowDialog(this) == DialogResult.OK) {
                settings_as_string_readonly settings = new settings_as_string(add.settings);
                if (is_log_in_history(ref settings)) {
                    // we already have this in history
                    create_text_reader(settings);
                    return;
                }
                var new_ = new history();
                new_.from_settings(settings);

                history_.Add(new_);
                ++ignore_change_;
                logHistory.Items.Add(history_.Last().ui_friendly_name);
                logHistory.SelectedIndex = logHistory.Items.Count - 1;
                --ignore_change_;

                Text = reader_title() + " - Log Wizard " + version();
                create_text_reader(new_.settings);
                save();
            }
        }
Esempio n. 43
0
 public single_setting_bool(settings_as_string sett, string name, bool default_ = false) : base(sett, name, default_)
 {
 }
Esempio n. 44
0
        private ui_context new_file_to_context(string name) {
            var default_ = contexts_.FirstOrDefault(x => x.name == "Default");
            if (!File.Exists(name))
                return default_;

            settings_as_string sett = new settings_as_string("");
            sett.set("type", "file");
            sett.set("name", name);
            return settings_to_context(sett);
        }
Esempio n. 45
0
 public event_log_reader(settings_as_string sett) : base(sett) {
     settings.on_changed += on_settings_changed;
 }