load() public méthode

public load ( string prefix ) : void
prefix string
Résultat void
Exemple #1
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();
        }
Exemple #2
0
        private static void load_contexts(settings_file sett) {
            logger.Debug("loading contexts");
            history_list_.load();

            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();
        }