Esempio n. 1
0
        private void save_settings()
        {
            settings_.set("type", index_to_type());
            settings_.set("file_type", index_to_file_type());

            if (index_to_type() == "file" && edit_ == edit_type.add)
            {
                settings_.set("name", fileName.Text);
            }

            settings_.set("friendly_name", friendlyName.Text);

            settings_.set("syntax", syntax.Text);
            settings_.set("line.if_line", ifLine.Checked ? "1" : "0");
            settings_.set("part.separator", partSeparator.Text);
            settings_.set("xml.delimeter", xmlDelimeter.Text);
            settings_.set("csv.has_header", csvHasHeader.Checked ? "1" : "0");
            settings_.set("csv.separator", csvSeparator.Text);

            settings_.set("event.remote_machine_name", remoteMachineName.Text);
            settings_.set("event.remote_domain", remoteDomain.Text);
            settings_.set("event.remote_user_name", remoteUserName.Text);
            settings_.set("event.remote_password", remotePassword.Text);
            settings_.set("event.log_type", selectedEventLogs.Text.Trim().Replace("\r\n", "|"));
            settings_.set("event.reversed", eventsReversed.Checked ? "1" : "0");

            settings_.set("debug.global", debugGlobal.Checked ? "1" : "0");
            settings_.set("debug.process_name", debugProcessName.Text);

            edited_syntax_now_ = settings_.get("syntax") != old_settings_.get("syntax");
        }
Esempio n. 2
0
        internal override void load_syntax(settings_as_string sett, ref string error) {
            base.load_syntax(sett, ref error);

            load_sub_syntax(sett, multi_, "multiline", ref error);
            load_sub_syntax(sett, color_, "all", ref error);
            load_sub_syntax(sett, date_, "date", ref error);
            load_sub_syntax(sett, time_, "time", ref error);
            load_sub_syntax(sett, compare_number_, "compare-n", ref error);
            load_sub_syntax(sett, format_number_, "number", ref error);
            load_sub_syntax(sett, alternate_bg_, "alternate", ref error);

            for (int idx = 0;; idx++) {
                string prefix = "regex" + (idx > 0 ? "" + (idx + 1) : "");
                string regex_expr = sett.get(prefix + ".expr");
                if (regex_expr != "") {
                    regex_color regex = new regex_color();
                    load_sub_syntax(sett, regex, prefix, ref error);
                    sub_.Add(regex);
                } else break;
            }

            for (int idx = 0;; idx++) {
                string prefix = "abb" + (idx > 0 ? "" + (idx + 1) : "");
                string abbr_expr = sett.get(prefix + ".find");
                if (abbr_expr != "") {
                    var abb = new abbreviation();
                    load_sub_syntax(sett, abb, prefix, ref error);
                    sub_.Add(abb);
                } else break;
            }
        }
Esempio n. 3
0
        internal override void load_syntax(settings_as_string sett, ref string error) {
            base.load_syntax(sett, ref error);
            var format = sett.get("format");
            if ( format != "")
                formatting_ = text_part.from_friendly_string(format);

            var sel = sett.get("selection");
            var bookmark = sett.get("bookmark");
            if (sel != "")
                sel = util.absolute_logwizard_filename(sel);
            if (bookmark != "")
                bookmark = util.absolute_logwizard_filename(bookmark);

            if ( sel != "")
                try {
                    selection_image_ = Image.FromFile(sel);
                } catch(Exception e) {
                    logger.Error("bad picture " + e.Message);
                    error = "Bad image file: " + sel;
                }
            if ( bookmark != "")
                try {
                    bookmark_image_ = Image.FromFile(bookmark);
                } catch(Exception e) {
                    logger.Error("bad picture " + e.Message);
                    error = "Bad image file: " + bookmark;
                }

            if (selection_image_ != null && bookmark_image_ != null)
                selection_and_bookmark_image_ = util.merge_images_horizontally(selection_image_, bookmark_image_);
        }
Esempio n. 4
0
        internal override void load_syntax(settings_as_string sett, ref string error)
        {
            base.load_syntax(sett, ref error);
            light_color_ = sett.get("light");
            if (light_color_ != "" && !is_color_str_valid(light_color_))
            {
                error = "Invalid color: " + light_color_;
            }

            show_diff_ = sett.get("show_diff", "1") == "1";
            var format = sett.get("format");

            if (format != "")
            {
                formatting_ = text_part.from_friendly_string(format);
            }

            format_time_ = sett.get("format_time");
            try {
                if (format_time_ != "")
                {
                    DateTime.Now.ToString(format_time_);
                }
            } catch {
                error        = "Invalid time format: " + format_time_;
                format_time_ = "";
            }
        }
Esempio n. 5
0
 internal override void load_syntax(settings_as_string sett, ref string error) {
     base.load_syntax(sett, ref error);
     base_ = int.Parse(sett.get("base", "10"));
     pad_ = sett.get("pad");
     color_ = sett.get("color", "red");
     if (color_ == "-")
         color_ = "";
     look_for_hex_ = sett.get("look_for_hex", "1") == "1";
 }
Esempio n. 6
0
 internal override void load_syntax(settings_as_string sett, ref string error)
 {
     base.load_syntax(sett, ref error);
     base_  = int.Parse(sett.get("base", "10"));
     pad_   = sett.get("pad");
     color_ = sett.get("color", "red");
     if (color_ == "-")
     {
         color_ = "";
     }
     look_for_hex_ = sett.get("look_for_hex", "1") == "1";
 }
Esempio n. 7
0
 private void init()
 {
     foreach (string name in sett_.names())
     {
         var value_str  = get_value_part(sett_.get(name));
         var used_value = string_to_info_type(value_str);
         if (used_value != info_type.max)
         {
             name_to_column_.set(name, used_value);
         }
     }
 }
Esempio n. 8
0
        internal override void load_syntax(settings_as_string sett, ref string error) {
            base.load_syntax(sett, ref error);
            show_multi_into_single_line_ = sett.get("multi", "0") != "0";
            separator_ = sett.get("separator", " ¶ ");

            var alternate = sett.get("alternate_format");
            var separator = sett.get("separator_format");
            if ( alternate != "")
                alternate_format_ = text_part.from_friendly_string(alternate);
            if ( separator != "")
                separator_format_ = text_part.from_friendly_string(separator);
        }
Esempio n. 9
0
        static public text_reader create_text_reader(settings_as_string settings) {
            Debug.Assert(settings.get("guid") != "");

            switch (settings.get("type", "file")) {
            case "file":        return new file_text_reader(settings);
            case "event_log":   return new event_log_reader(settings);
            case "debug_print": return new debug_text_reader(settings);
            default:
                Debug.Assert(false);
                return null;
            }

        }
Esempio n. 10
0
 internal override void load_syntax(settings_as_string sett, ref string error) {
     base.load_syntax(sett, ref error);
     color_ = sett.get("format");
     if (color_ != "" && !is_color_str_valid(color_))
         error = "Invalid color: " + color_;
     expr_ = sett.get("expr");
     try {
         regex_ = new Regex(expr_);
     } catch {
         error = "Invalid regex: " + expr_;
         regex_ = null;
     }
 }
Esempio n. 11
0
 internal override void load_syntax(settings_as_string sett, ref string error)
 {
     base.load_syntax(sett, ref error);
     color_ = sett.get("format");
     if (color_ != "" && !is_color_str_valid(color_))
     {
         error = "Invalid color: " + color_;
     }
     expr_ = sett.get("expr");
     try {
         regex_ = new Regex(expr_);
     } catch {
         error  = "Invalid regex: " + expr_;
         regex_ = null;
     }
 }
Esempio n. 12
0
        internal override void load_syntax(settings_as_string sett, ref string error) {
            base.load_syntax(sett, ref error);

            for (int idx = 0;; ++idx) {
                string sett_name = "pic" + (idx > 0 ? "" +(idx+1) : "");
                var pic = sett.get(sett_name);
                if (pic != "") {
                    var sep = pic.IndexOf("->");
                    if (sep >= 0) {
                        Image bmp = null;
                        string prefix = pic.Substring(0, sep).Trim().ToLower();
                        string file = pic.Substring(sep + 2).Trim();
                        if (prefix == "" || file == "")
                            continue;
                        file = util.absolute_logwizard_filename(file);
                        try {
                            if (file != "") 
                                bmp = Image.FromFile(file);                            
                        } catch(Exception e) {                            
                            logger.Error("bad picture " + e.Message);
                        }
                        if (bmp != null)
                            name_to_picture_.Add(prefix, bmp);
                        else {
                            error = "Invalid file: " + file;
                            logger.Error("could not load file " + file);
                        }
                    } else
                        error = "Invalid line: " + pic;
                } else
                    break;
            }
        }
Esempio n. 13
0
        internal override void load_syntax(settings_as_string sett, ref string error) {
            base.load_syntax(sett, ref error);

            var where = sett.get("where");
            if (where != "") {
                int delim = where.IndexOf("*");
                if (delim >= 0) {
                    before_ = where.Substring(0, delim);
                    after_ = where.Substring(delim + 1);
                } else
                    before_ = where;
            }
            var value_type = sett.get("value", "int");
            is_int_ = value_type != "double";

            for (int idx = 0;; ++idx) {
                var compare_str = sett.get("compare" + (idx > 0 ? "" + (idx + 1) : ""));
                if (compare_str == "")
                    break;
                var compare_parts = compare_str.Split(',');
                if (compare_parts.Length != 4) {
                    error = "Invalid compare string: " + compare_str;
                    break;
                }
                compare comp = new compare();
                // read the number
                bool ok1 = double.TryParse(compare_parts[0], out comp.compare_double);
                bool ok2 = long.TryParse(compare_parts[0], out comp.compare_int);
                if (!ok1 && !ok2) {
                    error = "Invalid compare string: " + compare_str;
                    break;                    
                }
                if (ok1 && !ok2)
                    try {
                        comp.compare_int = (long) comp.compare_double;
                    } catch {}

                if ( compare_parts[1] != "-")
                    comp.less = text_part.from_friendly_string(compare_parts[1]);
                if ( compare_parts[2] != "-")
                    comp.equal = text_part.from_friendly_string(compare_parts[2]);
                if ( compare_parts[3] != "-")
                    comp.greater = text_part.from_friendly_string(compare_parts[3]);
                compare_.Add(comp);
            }
        }
Esempio n. 14
0
        static public text_reader create_text_reader(settings_as_string settings)
        {
            Debug.Assert(settings.get("guid") != "");

            switch (settings.get("type", "file"))
            {
            case "file":        return(new file_text_reader(settings));

            case "event_log":   return(new event_log_reader(settings));

            case "debug_print": return(new debug_text_reader(settings));

            default:
                Debug.Assert(false);
                return(null);
            }
        }
Esempio n. 15
0
        internal override void load_syntax(settings_as_string sett, ref string error)
        {
            base.load_syntax(sett, ref error);
            var format = sett.get("format");

            if (format != "")
            {
                formatting_ = text_part.from_friendly_string(format);
            }

            var sel      = sett.get("selection");
            var bookmark = sett.get("bookmark");

            if (sel != "")
            {
                sel = util.absolute_logwizard_filename(sel);
            }
            if (bookmark != "")
            {
                bookmark = util.absolute_logwizard_filename(bookmark);
            }

            if (sel != "")
            {
                try {
                    selection_image_ = Image.FromFile(sel);
                } catch (Exception e) {
                    logger.Error("bad picture " + e.Message);
                    error = "Bad image file: " + sel;
                }
            }
            if (bookmark != "")
            {
                try {
                    bookmark_image_ = Image.FromFile(bookmark);
                } catch (Exception e) {
                    logger.Error("bad picture " + e.Message);
                    error = "Bad image file: " + bookmark;
                }
            }

            if (selection_image_ != null && bookmark_image_ != null)
            {
                selection_and_bookmark_image_ = util.merge_images_horizontally(selection_image_, bookmark_image_);
            }
        }
Esempio n. 16
0
        private void load_sub_syntax(settings_as_string sett, column_formatter_base sub, string prefix, ref string error) {
            prefix += ".";
            settings_as_string sub_sett = new settings_as_string("");
            foreach ( var name in sett.names())
                if ( name.StartsWith(prefix)) 
                    sub_sett.set(name.Substring(prefix.Length), sett.get(name));

            sub.load_syntax(sub_sett, ref error);
        }
Esempio n. 17
0
        internal override void load_syntax(settings_as_string sett, ref string error)
        {
            base.load_syntax(sett, ref error);
            show_multi_into_single_line_ = sett.get("multi", "0") != "0";
            separator_ = sett.get("separator", " ¶ ");

            var alternate = sett.get("alternate_format");
            var separator = sett.get("separator_format");

            if (alternate != "")
            {
                alternate_format_ = text_part.from_friendly_string(alternate);
            }
            if (separator != "")
            {
                separator_format_ = text_part.from_friendly_string(separator);
            }
        }
Esempio n. 18
0
 internal override void load_syntax(settings_as_string sett, ref string error) {
     base.load_syntax(sett, ref error);
     find_ = sett.get("find");
     original_replace_string_ = sett.get("replace");
     try {
         new Regex(find_);
     } catch {
         error = "Invalid Find regex: " + find_;
         is_on_ = false;
     }
     try {
         Regex.Replace("blablabla", find_, original_replace_string_);
     } catch {
         error = "Invalid Replace regex: " + original_replace_string_;
         is_on_ = false;
     }
     if ( error == "")
         parse_replace_format();
 }
Esempio n. 19
0
        internal override void load_syntax(settings_as_string sett, ref string error) {
            base.load_syntax(sett, ref error);
            light_color_ = sett.get("light");
            if (light_color_ != "" && !is_color_str_valid(light_color_))
                error = "Invalid color: " + light_color_;

            show_diff_ = sett.get("show_diff", "1") == "1";
            var format = sett.get("format");
            if ( format != "")
                formatting_ = text_part.from_friendly_string(format);

            format_time_ = sett.get("format_time");
            try {
                if (format_time_ != "")
                    DateTime.Now.ToString(format_time_);
            } catch {
                error = "Invalid time format: " + format_time_;
                format_time_ = "";
            }
        }
Esempio n. 20
0
 internal override void load_syntax(settings_as_string sett, ref string error)
 {
     base.load_syntax(sett, ref error);
     find_ = sett.get("find");
     original_replace_string_ = sett.get("replace");
     try {
         new Regex(find_);
     } catch {
         error  = "Invalid Find regex: " + find_;
         is_on_ = false;
     }
     try {
         Regex.Replace("blablabla", find_, original_replace_string_);
     } catch {
         error  = "Invalid Replace regex: " + original_replace_string_;
         is_on_ = false;
     }
     if (error == "")
     {
         parse_replace_format();
     }
 }
Esempio n. 21
0
        internal override void load_syntax(settings_as_string sett, ref string error)
        {
            base.load_syntax(sett, ref error);

            for (int idx = 0;; ++idx)
            {
                string sett_name = "pic" + (idx > 0 ? "" + (idx + 1) : "");
                var    pic       = sett.get(sett_name);
                if (pic != "")
                {
                    var sep = pic.IndexOf("->");
                    if (sep >= 0)
                    {
                        Image  bmp    = null;
                        string prefix = pic.Substring(0, sep).Trim().ToLower();
                        string file   = pic.Substring(sep + 2).Trim();
                        if (prefix == "" || file == "")
                        {
                            continue;
                        }
                        file = util.absolute_logwizard_filename(file);
                        if (file == "")
                        {
                            continue;
                        }
                        try {
                            bmp = Image.FromFile(file);
                        } catch (Exception e) {
                            logger.Error("bad picture " + e.Message);
                        }
                        if (bmp != null)
                        {
                            name_to_picture_.Add(prefix, bmp);
                        }
                        else
                        {
                            error = "Invalid file: " + file;
                            logger.Error("could not load file " + file);
                        }
                    }
                    else
                    {
                        error = "Invalid line: " + pic;
                    }
                }
                else
                {
                    break;
                }
            }
        }
Esempio n. 22
0
        private static parts_layout_template from_string(string s)
        {
            settings_as_string    sett = new settings_as_string(s);
            string                rows = sett.get("rows"), parts = sett.get("parts");
            parts_layout_template layout = new parts_layout_template();

            foreach (var row_data in rows.Split(';'))
            {
                var cur_row = row_data.Split(',');
                Debug.Assert(cur_row.Length == 3);
                row r = new row();
                r.label_width_ = int.Parse(cur_row[0]);
                r.row_width_   = int.Parse(cur_row[1]);
                int count = int.Parse(cur_row[2]);
                layout.rows_.Add(r);
            }

            foreach (var part_data in parts.Split(';'))
            {
                if (part_data == "")
                {
                    continue;
                }
                var cur_part = part_data.Split(',');
                Debug.Assert(cur_part.Length == 6);
                row  r = layout.rows_[int.Parse(cur_part[0])];
                part p = new part();
                p.type        = (info_type)int.Parse(cur_part[1]);
                p.visible     = cur_part[2] == "1";
                p.multi_line  = cur_part[3] == "1";
                p.auto_resize = cur_part[4] == "1";
                p.line_count  = int.Parse(cur_part[5]);
                r.parts_.Add(p);
            }
            layout.name_ = sett.get("name");
            return(layout);
        }
Esempio n. 23
0
        internal virtual void load_syntax(settings_as_string sett, ref string error)
        {
            var align = sett.get("align");

            switch (align)
            {
            case "left":
                align_ = align_type.left;
                break;

            case "center":
                align_ = align_type.center;
                break;

            case "right":
                align_ = align_type.right;
                break;
            }
        }
Esempio n. 24
0
        public static bool is_file_line_by_line(string file_name, string sett)
        {
            file_name = file_name.ToLower();
            var all       = new settings_as_string(sett);
            var file_type = all.get("file_type");

            switch (file_type)
            {
            case "line-by-line":
                return(true);

            case "":
                // best guess
                return(guess_file_type(file_name) == "line-by-line");

            default:
                return(false);
            }
        }
Esempio n. 25
0
        public List <category_colors> get_colors(info_type type, List <string> possible_values)
        {
            List <category_colors> existing = new List <category_colors>();
            var colors_now = sett_.get(type.ToString()).Split(new [] { color_delim }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var str in colors_now)
            {
                var cur_col = str.Split(new[] { inside_color_delim }, StringSplitOptions.None);
                Debug.Assert(cur_col.Length == 4);
                category_colors cur_colors = new category_colors {
                    name = cur_col[0], bg_color = util.str_to_color(cur_col[1])
                };
                if (cur_col[2] != "")
                {
                    cur_colors.raw_same_category_bg = util.str_to_color(cur_col[2]);
                }
                if (cur_col[3] != "")
                {
                    cur_colors.raw_this_category_bg = util.str_to_color((cur_col[3]));
                }
                existing.Add(cur_colors);
            }


            List <category_colors> result = new List <category_colors>();

            foreach (var value in possible_values)
            {
                var found = existing.FirstOrDefault(x => x.name == value);
                if (found != null)
                {
                    result.Add(found);
                }
                else
                {
                    result.Add(new category_colors {
                        name = value
                    });
                }
            }
            return(result);
        }
Esempio n. 26
0
 internal virtual void load_syntax(settings_as_string sett, ref string error) {
     var align = sett.get("align");
     switch (align) {
     case "left":
         align_ = align_type.left;
         break;
     case "center": 
         align_ = align_type.center;
         break;
     case "right":
         align_ = align_type.right;
         break;
     }
 }
        // file name is set only if it's a file
        public edit_log_settings_form(string settings, edit_type edit = edit_type.edit) {
            old_settings_ = new settings_as_string(settings);
            settings_ = new settings_as_string(settings);
            file_name_ =  settings_.get("type") == "file" ? settings_.get("name") : "" ;

            edit_ = edit;
            InitializeComponent();
            type.Enabled = edit == edit_type.add;

            if (edit == edit_type.add) {
                settings_.set("event.log_type", "Application|System");
            }

            hide_tabs(typeTab);
            hide_tabs(fileTypeTab);
            cancel.Left = -100;
            friendlyName.Text = settings_.get("friendly_name");

            fileType.SelectedIndex = file_type_to_index( settings_.get("file_type") );

            syntax.Text = settings_.get("syntax");
            syntax.ForeColor = syntax.Text == find_log_syntax.UNKNOWN_SYNTAX ? Color.Red : Color.Black;
            ifLine.Checked = settings_.get("line.if_line", "0") != "0";
            
            partSeparator.Text = settings_.get("part.separator");

            xmlDelimeter.Text = settings_.get("xml.delimeter");

            csvHasHeader.Checked = settings_.get("csv.has_header", "1") != "0";
            csvSeparator.Text = settings_.get("csv.separator", ",");

            remoteMachineName.Text = settings_.get("event.remote_machine_name");
            remoteDomain.Text = settings_.get("event.remote_domain");
            remoteUserName.Text = settings_.get("event.remote_user_name");
            remotePassword.Text = settings_.get("event.remote_password");
            selectedEventLogs.Text = settings_.get("event.log_type").Replace("|", "\r\n");

            type.SelectedIndex = type_to_index();
            if (edit == edit_type.add) {
                Text = "Open Log";
                settings_.set("guid", Guid.NewGuid().ToString());
                util.postpone(() => type.Focus(), 1);
                util.postpone(() => type.DroppedDown = true, 200);
            }
            if (edit == edit_type.edit && typeTab.SelectedIndex == 1 && remoteMachineName.Text.Trim() != "")
                util.postpone(() => remotePassword.Focus(), 1);

            new Thread(check_event_log_thread) {IsBackground = true}.Start();
        }
Esempio n. 28
0
        private static parts_layout_template from_string(string s) {
            settings_as_string sett = new settings_as_string(s);
            string rows = sett.get("rows"), parts = sett.get("parts");
            parts_layout_template layout = new parts_layout_template();
            foreach (var row_data in rows.Split(';')) {
                var cur_row = row_data.Split(',');
                Debug.Assert(cur_row.Length == 3);
                row r = new row();
                r.label_width_ = int.Parse(cur_row[0]);
                r.row_width_ = int.Parse(cur_row[1]);
                int count = int.Parse(cur_row[2]);
                layout.rows_.Add(r);
            }

            foreach (var part_data in parts.Split(';')) {
                if (part_data == "")
                    continue;
                var cur_part = part_data.Split(',');
                Debug.Assert(cur_part.Length == 6);
                row r = layout.rows_[int.Parse(cur_part[0]) ];
                part p = new part();
                p.type = (info_type) int.Parse(cur_part[1]);
                p.visible = cur_part[2] == "1";
                p.multi_line = cur_part[3] == "1";
                p.auto_resize = cur_part[4] == "1";
                p.line_count = int.Parse(cur_part[5]);
                r.parts_.Add(p);
            }
            layout.name_ = sett.get("name");
            return layout;
        }
Esempio n. 29
0
        public static bool is_file_line_by_line(string file_name, string sett) {
            file_name = file_name.ToLower();
            var all = new settings_as_string(sett);
            var file_type = all.get("file_type");

            switch (file_type) {
            case "line-by-line":
                return true;
            case "":
                // best guess
                return guess_file_type(file_name) == "line-by-line";
            default:
                return false;
            }
            
        }
Esempio n. 30
0
        // file name is set only if it's a file
        public edit_log_settings_form(string settings, edit_type edit = edit_type.edit)
        {
            old_settings_ = new settings_as_string(settings);
            settings_     = new settings_as_string(settings);
            edit_         = edit;
            InitializeComponent();
            fileName.Text       = settings_.get("type") == "file" ? settings_.get("name") : "";
            type.Enabled        = edit == edit_type.add;
            browserFile.Enabled = edit == edit_type.add;

            if (edit == edit_type.add)
            {
                settings_.set("event.log_type", "Application|System");
            }

            hide_tabs(typeTab);
            hide_tabs(fileTypeTab);
            cancel.Left       = -100;
            friendlyName.Text = settings_.get("friendly_name");

            fileType.SelectedIndex = file_type_to_index(settings_.get("file_type"));

            update_syntax();
            ifLine.Checked = settings_.get("line.if_line", "0") != "0";

            partSeparator.Text = settings_.get("part.separator");

            xmlDelimeter.Text = settings_.get("xml.delimeter");

            csvHasHeader.Checked = settings_.get("csv.has_header", "1") != "0";
            csvSeparator.Text    = settings_.get("csv.separator", ",");

            remoteMachineName.Text = settings_.get("event.remote_machine_name");
            remoteDomain.Text      = settings_.get("event.remote_domain");
            remoteUserName.Text    = settings_.get("event.remote_user_name");
            remotePassword.Text    = settings_.get("event.remote_password");
            selectedEventLogs.Text = settings_.get("event.log_type").Replace("|", "\r\n");
            eventsReversed.Checked = settings_.get("event.reversed", "0") != "0";

            type.SelectedIndex = type_to_index();
            if (edit == edit_type.add)
            {
                Text = "Open Log";
                settings_.set("guid", Guid.NewGuid().ToString());
                util.postpone(() => type.Focus(), 1);
                util.postpone(() => type.DroppedDown = true, 200);
            }
            if (edit == edit_type.edit && typeTab.SelectedIndex == 1 && remoteMachineName.Text.Trim() != "")
            {
                util.postpone(() => remotePassword.Focus(), 1);
            }

            new Thread(check_event_log_thread)
            {
                IsBackground = true
            }.Start();
        }
Esempio n. 31
0
        internal override void load_syntax(settings_as_string sett, ref string error)
        {
            base.load_syntax(sett, ref error);

            var where = sett.get("where");
            if (where != "")
            {
                int delim = where.IndexOf("*");
                if (delim >= 0)
                {
                    before_ = where.Substring(0, delim);
                    after_  = where.Substring(delim + 1);
                }
                else
                {
                    before_ = where;
                }
            }
            var value_type = sett.get("value", "int");

            is_int_ = value_type != "double";

            for (int idx = 0;; ++idx)
            {
                var compare_str = sett.get("compare" + (idx > 0 ? "" + (idx + 1) : ""));
                if (compare_str == "")
                {
                    break;
                }
                var compare_parts = compare_str.Split(',');
                if (compare_parts.Length != 4)
                {
                    error = "Invalid compare string: " + compare_str;
                    break;
                }
                compare comp = new compare();
                // read the number
                bool ok1 = double.TryParse(compare_parts[0], out comp.compare_double);
                bool ok2 = long.TryParse(compare_parts[0], out comp.compare_int);
                if (!ok1 && !ok2)
                {
                    error = "Invalid compare string: " + compare_str;
                    break;
                }
                if (ok1 && !ok2)
                {
                    try {
                        comp.compare_int = (long)comp.compare_double;
                    } catch {}
                }

                if (compare_parts[1] != "-")
                {
                    comp.less = text_part.from_friendly_string(compare_parts[1]);
                }
                if (compare_parts[2] != "-")
                {
                    comp.equal = text_part.from_friendly_string(compare_parts[2]);
                }
                if (compare_parts[3] != "-")
                {
                    comp.greater = text_part.from_friendly_string(compare_parts[3]);
                }
                compare_.Add(comp);
            }
        }
Esempio n. 32
0
 private int type_to_index()
 {
     return(type_to_index_.key_to_value(settings_.get("type", "file")));
 }
Esempio n. 33
0
 internal override void load_syntax(settings_as_string sett, ref string error)
 {
     base.load_syntax(sett, ref error);
     int.TryParse(sett.get("row_count"), out row_count_);
     alternate_color_ = sett.get("color", "darker");
 }
Esempio n. 34
0
 internal override void load_syntax(settings_as_string sett, ref string error) {
     base.load_syntax(sett, ref error);
     int.TryParse(sett.get("row_count"), out row_count_);
     alternate_color_ = sett.get("color", "darker");
 }