コード例 #1
0
        private void frmMain_DragDrop(object sender, DragEventArgs e)
        {
            if ((_statusThread != null) && _statusThread.IsAlive)
            {
                return;
            }

            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] paths = (string[])e.Data.GetData(DataFormats.FileDrop);
                _statusThread = new Thread(delegate() {
                    Invoke((MethodInvoker) delegate() {
                        using (frmStatus statusForm = new frmStatus(paths,
                                                                    chkVideo.Checked, chkAudio.Checked, chkTimeCodes.Checked))
                        {
                            bool topMost = TopMost;
                            TopMost      = false;
                            statusForm.ShowDialog(this);
                            TopMost = topMost;
                        }
                    });
                });
                _statusThread.Start();
            }
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: shariqazz/flv-extraxct
        private void btnStart_Click(object sender, EventArgs e)
        {
            Fps = cbFps.Text;
            Ratio = cbRatio.Text;
            Remove = chkRemove.Checked;

            try
            {
                if (rbtFLV.Checked)
                {
                    Mode = "FLV";
                }
                else if (rbtMp4.Checked)
                {
                    Mode = "MP4";
                    Mp4BoxPath = string.Format("{0}\\MP4Box.exe", Application.StartupPath);
                    if (!File.Exists(Mp4BoxPath))
                    {
                        MessageBox.Show(
                            string.Format("{0} is not found, copy it to the same folder of FLVExtract, please.", Mp4BoxPath), "Error");
                        return;
                    }
                    if (!File.Exists(Application.StartupPath + "\\js32.dll"))
                    {
                        MessageBox.Show("js32.dll is missing, this might cause some problem for MP4 muxing process.",
                                        "Warrning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else if (rbtMkv.Checked)
                {
                    Mode = "MKV";
                    Ratio = cbRatio.Text;
                    MkvmergePath = string.Format("{0}\\mkvmerge.exe", Application.StartupPath);
                    if (!File.Exists(MkvmergePath))
                    {
                        MessageBox.Show(
                            string.Format("{0} is not found, copy it to the same folder of FLVExtract, please.", MkvmergePath), "Error");
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }

            try
            {
                if (lvInput.CheckedItems.Count > 0)
                {
                    Paths.Clear();
                    foreach (ListViewItem checkedItem in lvInput.CheckedItems)
                    {
                        // All these ListViewItems are checked, do something...
                        Paths.Add(checkedItem.SubItems[1].Text);
                    }

                    string[] inputName = Paths.ToArray();

                    var statusForm = new frmStatus(inputName,
                                                   chkVideo.Checked, chkAudio.Checked, chkTimeCodes.Checked);
                    _statusThread = new Thread(() => Invoke((MethodInvoker) delegate
                                                                                {
                                                                                    bool topMost = TopMost;
                                                                                    TopMost = false;
                                                                                    statusForm.ShowDialog();
                                                                                    TopMost = topMost;
                                                                                }));
                    _statusThread.Start();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
コード例 #3
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            Fps    = cbFps.Text;
            Ratio  = cbRatio.Text;
            Remove = chkRemove.Checked;

            try
            {
                if (rbtFLV.Checked)
                {
                    Mode = "FLV";
                }
                else if (rbtMp4.Checked)
                {
                    Mode       = "MP4";
                    Mp4BoxPath = string.Format("{0}" + Slash + "MP4Box.exe", Application.StartupPath);
                    if (!File.Exists(Mp4BoxPath))
                    {
                        MessageBox.Show(
                            string.Format("{0} is not found, copy it to the same folder of FLVExtract, please.", Mp4BoxPath), "Error");
                        return;
                    }
                }
                else if (rbtMkv.Checked)
                {
                    Mode         = "MKV";
                    Ratio        = cbRatio.Text;
                    MkvmergePath = string.Format("{0}" + Slash + "mkvmerge.exe", Application.StartupPath);
                    if (!File.Exists(MkvmergePath))
                    {
                        MessageBox.Show(
                            string.Format("{0} is not found, copy it to the same folder of FLVExtract, please.", MkvmergePath), "Error");
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }

            try
            {
                if (lvInput.CheckedItems.Count > 0)
                {
                    Paths.Clear();
                    foreach (ListViewItem checkedItem in lvInput.CheckedItems)
                    {
                        // All these ListViewItems are checked, do something...
                        Paths.Add(checkedItem.SubItems[1].Text);
                    }

                    string[] inputName = Paths.ToArray();

                    var statusForm = new frmStatus(inputName,
                                                   chkVideo.Checked, chkAudio.Checked, chkTimeCodes.Checked);
                    _statusThread = new Thread(() => Invoke((MethodInvoker) delegate
                    {
                        bool topMost = TopMost;
                        TopMost      = false;
                        statusForm.ShowDialog();
                        TopMost = topMost;
                    }));
                    _statusThread.Start();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }