예제 #1
0
        public static bool IsConditionTrue(string displayCondition, ini ini)
        {
            var parsed = new DisplayConditionParse(displayCondition);
            var opt    = ini.FindIniOption(parsed.category, parsed.name);

            if (opt != null)
            {
                if (parsed.op == ">" && int.Parse(opt.inidata) <= int.Parse(parsed.val))
                {
                    return(false);
                }
                if (parsed.op == "<" && int.Parse(opt.inidata) >= int.Parse(parsed.val))
                {
                    return(false);
                }
                if (parsed.op == "==" && int.Parse(opt.inidata) != int.Parse(parsed.val))
                {
                    return(false);
                }
                if (parsed.op == "!=" && int.Parse(opt.inidata) == int.Parse(parsed.val))
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
        public int Render(Control parent, int y)
        {
            if (!string.IsNullOrEmpty(displayCondition))
            {
                if (!DisplayConditionParse.IsConditionTrue(displayCondition, ini))
                {
                    return(y);
                }
            }

            var spl  = iniOptions.Split(',');
            var wOpt = ini.FindIniOption(category, spl[0]);
            var hOpt = ini.FindIniOption(category, spl[1]);

            var width  = int.Parse(wOpt.inidata);
            var height = int.Parse(hOpt.inidata);

            var grp = new GroupBox();

            grp.Text     = name;
            grp.Parent   = parent;
            grp.Location = new Point(10, y);
            grp.AutoSize = true;

            int grpY = 25;
            int x    = 10;

            var lblw = new Label();

            lblw.Text     = "W:";
            lblw.Parent   = grp;
            lblw.Location = new Point(x, grpY + 3);
            lblw.AutoSize = true;

            x += 23;

            var num1 = new NumericUpDown();

            num1.Width         = 50;
            num1.Location      = new Point(x, grpY);
            num1.Maximum       = 10000;
            num1.Value         = width;
            num1.Parent        = grp;
            num1.ValueChanged += (object sender, EventArgs e) => wOpt.inidata = num1.Value.ToString();

            x += 55;

            var lblh = new Label();

            lblh.Text     = "H:";
            lblh.Parent   = grp;
            lblh.Location = new Point(x, grpY + 3);
            lblh.AutoSize = true;

            x += 23;

            var num2 = new NumericUpDown();

            num2.Width         = 50;
            num2.Location      = new Point(x, grpY);
            num2.Maximum       = 10000;
            num2.Value         = height;
            num2.Parent        = grp;
            num2.ValueChanged += (object sender, EventArgs e) => wOpt.inidata = num1.Value.ToString();

            if (!string.IsNullOrEmpty(description))
            {
                x     = 10;
                grpY += 25;
                var dsc = new Label();
                dsc.AutoSize = true;
                dsc.Text     = description;
                dsc.Location = new Point(x, grpY);
                dsc.Parent   = grp;
            }

            grp.Height = grpY;

            y += grp.Height + 20;

            return(y);
        }