public void merge(settings_as_string_readonly other_sett)
 {
     // note: i set it like this, so that in case of any change, I call the on_change delegate
     foreach (var name in other_sett.names())
     {
         set(name, other_sett.get(name));
     }
 }
 public void merge_settings(settings_as_string_readonly other_sett, bool edited_syntax_now)
 {
     if (edited_syntax_now)
     {
         if (default_settings_.get("syntax") == "")
         {
             default_settings_.set("syntax", other_sett.get("syntax"));
         }
     }
     default_settings_.set("aliases", other_sett.get("aliases"));
     default_settings_.set("description_template", other_sett.get("description_template"));
 }
        // '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);
        }
Exemple #4
0
        private ui_context settings_to_context(settings_as_string_readonly log_settings) {
            string context_name = log_settings.get("context");
            if (context_name != "") {
                var existing = contexts_.FirstOrDefault(x => x.name == context_name);
                if (existing != null)
                    // 1.5.6+ - we now keep the context in the settings 
                    return existing;                
            }

            // old way of forcing file to have a context (pre 1.5.6)
            string file = log_settings.get("type") == "file" ? log_settings.get("name") : "";
            if ( file != "" && app.inst.forced_file_to_context.ContainsKey(file)) {
                string forced = app.inst.forced_file_to_context[file];
                var context_from_forced = contexts_.FirstOrDefault(x => x.name == forced);
                if (context_from_forced != null)
                    // return it, only if we have a specific Template for it
                    return context_from_forced;
            }

            if (file != "") {
                string from_header = log_to.file_to_context(file);
                if (from_header != null) {
                    // ... case-insensitive search (easier for user)
                    var context_from_header = contexts_.FirstOrDefault(x => x.name.ToLower() == from_header.ToLower());
                    if (context_from_header != null)
                        // return it, only if we have a specific Template for it
                        return context_from_header;
                }
                // 1.1.25+ - match the context that matches the name completely
                string name_no_ext = Path.GetFileNameWithoutExtension(new FileInfo(file).Name);
                var found = contexts_.FirstOrDefault(x => x.name == name_no_ext);
                if (found != null)
                    return found;
            }

            var default_ = contexts_.FirstOrDefault(x => x.name == "Default");
            return default_ ?? contexts_[0];
        }
Exemple #5
0
        private void history_select(settings_as_string_readonly settings) {
            ++ignore_change_;
            bool needs_save = false;
            logHistory.SelectedIndex = -1;
            string unique_id = settings.get("guid");

            bool found = false;
            for (int i = 0; i < history_.Count && !found; ++i)
                if (history_[i].unique_id == unique_id) {
                    found = true;
                    bool is_sample = settings.get("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) {
                // 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();
                new_.from_settings(settings);
                history_.Add(new_);
                logHistory.Items.Add(history_.Last().ui_friendly_name);
                logHistory.SelectedIndex = logHistory.Items.Count - 1;
            }
            --ignore_change_;

            if (needs_save)
                save();
            return;
        }
Exemple #6
0
        // checks if log is already in history - if so, updates its guid and returns true
        private bool is_log_in_history(ref settings_as_string_readonly settings) {
            if (settings.get("type") == "file") {
                string name = settings.get("name");
                var found = history_.FirstOrDefault(x => x.name == name);
                if (found != null) {
                    settings = found.settings;
                    return true;
                }
            }

            return false;
        }
Exemple #7
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 #8
0
 public void from_settings(settings_as_string_readonly sett) {
     settings_ = sett as settings_as_string;
 }
        // '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;
        }
 public void merge(string other) {
     settings_as_string_readonly other_sett = new settings_as_string_readonly(other);
     merge(other_sett);
 }
 public void merge(settings_as_string_readonly other_sett) {
     // note: i set it like this, so that in case of any change, I call the on_change delegate
     foreach ( var name in other_sett.names())
         set( name, other_sett.get(name));
 }
        public void merge(string other)
        {
            settings_as_string_readonly other_sett = new settings_as_string_readonly(other);

            merge(other_sett);
        }
Exemple #13
0
 public void merge_setings(settings_as_string_readonly other)
 {
     settings_.merge(other);
 }
 public void merge_settings(settings_as_string_readonly other_sett) {
     if ( other_sett.get("syntax_type") == "edited_now")
         if ( default_settings_.get("syntax") == "")
             default_settings_.set("syntax", other_sett.get("syntax"));
     default_settings_.set( "aliases", other_sett.get("aliases"));
 }
Exemple #15
0
 public void merge_setings(settings_as_string_readonly other) {
     settings_.merge(other);
 }
 public void merge_settings(settings_as_string_readonly other_sett, bool edited_syntax_now) {
     if ( edited_syntax_now)
         if ( default_settings_.get("syntax") == "")
             default_settings_.set("syntax", other_sett.get("syntax"));
     default_settings_.set( "aliases", other_sett.get("aliases"));
     default_settings_.set("description_template", other_sett.get("description_template"));
 }