Exemplo n.º 1
0
        public FormMain(List <string> inputVideos)
        {
            inputVideos_ = inputVideos;

            InitializeComponent();

            HashIni ini = Profile.ReadAll(IniPath);

            AmbLib.LoadFormXYWH(this, SECTION_OPTION, ini);

            ColumnHeader ch = null;

            ch       = new ColumnHeader();
            ch.Name  = COLUMN_FILE;
            ch.Text  = Properties.Resources.COLUMN_FILE;
            ch.Width = 100;
            lvMain.Columns.Add(ch);

            ch       = new ColumnHeader();
            ch.Name  = COLUMN_DATE;
            ch.Text  = Properties.Resources.COLUMN_DATE;
            ch.Width = 100;
            lvMain.Columns.Add(ch);

            ch       = new ColumnHeader();
            ch.Name  = COLUMN_EXTENTION;
            ch.Text  = Properties.Resources.COLUMN_EXTENTION;
            ch.Width = 100;
            lvMain.Columns.Add(ch);

            ch       = new ColumnHeader();
            ch.Name  = COLUMN_DURATION;
            ch.Text  = Properties.Resources.COLUMN_DURATION;
            ch.Width = 100;
            lvMain.Columns.Add(ch);



            Profile.GetString("option", "ffmpeg", "", out ffmpeg_, ini);
            AmbLib.LoadListViewColumnWidth(lvMain, SECTION_OPTION, KEY_COLUMN_WIDTH, ini);
        }
Exemplo n.º 2
0
        public FormMain()
        {
            InitializeComponent();

            this.panelClick.MouseWheel += panelClick_MouseWheel;
            // Load from ini file
            bool bval;

            try
            {
                ini_ = Profile.ReadAll(IniPath, true);

                Profile.GetBool(SECTION_OPTION, KEY_CHECK_SINGLECLICK, true, out bval, ini_);
                chkShowSingleClick.Checked = bval;
                Profile.GetBool(SECTION_OPTION, KEY_CHECK_DOUBLECLICK, false, out bval, ini_);
                chkShowDoubleClick.Checked = bval;
                Profile.GetBool(SECTION_OPTION, KEY_CHECK_UP, false, out bval, ini_);
                chkShowUp.Checked = bval;
                Profile.GetBool(SECTION_OPTION, KEY_CHECK_DOWN, true, out bval, ini_);
                chkShowDown.Checked = bval;
                Profile.GetBool(SECTION_OPTION, KEY_CHECK_WHEEL, true, out bval, ini_);
                chkShowWheel.Checked = bval;
                Profile.GetBool(SECTION_OPTION, KEY_CHECK_MOVE, true, out bval, ini_);
                chkShowMove.Checked = bval;

                AmbLib.LoadFormXYWH(this, SECTION_LOCATION, ini_);
            }
            catch (FileNotFoundException)
            {
            }
            catch (Exception ex)
            {
                CppUtils.Alert(ex);
                Environment.Exit(1);
            }

            // Set Title
            this.Text = Application.ProductName;
        }
Exemplo n.º 3
0
        public FormMain(string[] args)
        {
            args_ = args;

            InitializeComponent();

            lblCombo1TopLeft.Visible     = false;
            lblCombo1BottomRight.Visible = false;
            lblCombo2TopLeft.Visible     = false;
            lblCombo2BottomRight.Visible = false;

            // LoadFromIni
            HashIni ini = Profile.ReadAll(IniPath);

            AmbLib.LoadFormXYWH(this, SECTION_LOCATION, ini);
            AmbLib.LoadListViewColumnWidth(listMain, SECTION_OPTION, KEY_COLUMN_WIDTH, ini);
            AmbLib.LoadComboBox(cmbApplication, SECTION_APP_COMBO, MAX_COMBO_SAVE, ini);
            AmbLib.LoadComboBox(cmbArguments, SECTION_ARG_COMBO, MAX_COMBO_SAVE, ini);


            OptionSet p = new OptionSet()
                          .Add("v|version", dummy => { ShowHelp(); Environment.Exit(0); })
                          .Add("?|h|help", dummy => { ShowHelp(); Environment.Exit(0); })
                          .Add("@=", reportFile => { ImportFromReport(reportFile); })
                          .Add("dir=", dir => { ImportDirectory(dir); })
            ;


            // Parse CommandLine
            List <string> defaultArgs = p.Parse(args);

            foreach (string file in defaultArgs)
            {
                AddToList(file);
            }

            UpdateTitle();
        }
Exemplo n.º 4
0
        public FormMain(string[] args)
        {
            InitializeComponent();

            this.Text = Application.ProductName;

            // read ini
            HashIni ini = Profile.ReadAll(IniPath);

            AmbLib.LoadFormXYWH(this, SECTION_LOCATION, ini);

            int intval;

            if (Profile.GetInt(SECTION_OPTION, KEY_CHECKDURATION, 0, out intval, ini))
            {
                _checkDuration = intval;
            }
            float fval;

            if (Profile.GetFloat(SECTION_OPTION, KEY_MIN_CPUUSAGE, 0, out fval, ini))
            {
                _minCPUUsage = fval;
            }
            if (Profile.GetFloat(SECTION_OPTION, KEY_MAX_CPUUSAGE, 0, out fval, ini))
            {
                _maxCPUUsage = fval;
            }

            bool bval;

            if (Profile.GetBool(SECTION_OPTION, KEY_IS_AVERAGE, false, out bval, ini))
            {
                _isAverage = bval;
            }

            try
            {
                bool start = false;
                var  p     = new OptionSet();
                p.Add("v|version", "Show Version", dummy =>
                {
                    MessageBox.Show("ver");
                    Environment.Exit(0);
                });
                p.Add("max=", "Max cpu usage", max =>
                {
                    _maxCPUUsage = float.Parse(max);
                });
                p.Add("min=", "Min cpu usage", max =>
                {
                    _minCPUUsage = float.Parse(max);
                });
                p.Add("d=|duration=", "Duration of checking", duration =>
                {
                    _checkDuration = int.Parse(duration);
                });
                p.Add("a|average", "Use average", dummy =>
                {
                    _isAverage = true;
                });
                p.Add("h|H|help|?", "Show Help", dummy =>
                {
                    var stream = new MemoryStream();
                    var to     = new StreamWriter(stream);
                    p.WriteOptionDescriptions(to);
                    to.Flush();
                    stream.Position = 0;
                    var reader      = new StreamReader(stream);
                    string message  = reader.ReadToEnd();

                    MessageBox.Show(message,
                                    Application.ProductName + " v" + AmbLib.getAssemblyVersion(Assembly.GetExecutingAssembly(), 3),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                    Environment.Exit(0);
                });
                p.Add("start", "Start without showing the dialog", dummy =>
                {
                    start = true;
                });

                List <string> mainArgs = p.Parse(args);
                _start = start;
                if (mainArgs.Count != 0)
                {
                    FatalExit("Uknown Option:" + string.Join(" ", mainArgs.ToArray()));
                }
            }
            catch (Exception ex)
            {
                FatalExit(ex.Message);
            }
        }