summaryrefslogtreecommitdiffstats
path: root/win/C#/frmReadDVD.cs
blob: d861e8eadfc2dd069c26ffa03dd90112ee2f04ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Handbrake
{
    public partial class frmReadDVD : Form
    {

        string inputFile;

        public frmReadDVD(string inputFile)
        {
            InitializeComponent();
            this.inputFile = inputFile;
        }

        private void frmReadDVD_Load(object sender, EventArgs e)
        {
            //start(inputFile);
        }

        public void start(string filename)
        {
            MessageBox.Show(filename);
            string query = "-i " + '"' + filename + '"' + " -t0";
            System.Diagnostics.Process hbProc = new System.Diagnostics.Process();
            hbProc.StartInfo.FileName = "hbcli.exe";
            hbProc.StartInfo.RedirectStandardOutput = true;
            hbProc.StartInfo.RedirectStandardError = true;
            hbProc.StartInfo.StandardOutputEncoding = System.Text.Encoding.UTF8;
            hbProc.StartInfo.StandardErrorEncoding = System.Text.Encoding.UTF8;
            hbProc.StartInfo.Arguments = query;
            hbProc.StartInfo.UseShellExecute = false;
            hbProc.Start();

            while (hbProc.StandardOutput.BaseStream.CanRead && !hbProc.HasExited)
            {
                MessageBox.Show(hbProc.StandardOutput.ReadLine());
                MessageBox.Show(hbProc.StandardError.ReadLine());
                Console.Read();
            }
        }

        private void btn_ok_Click(object sender, EventArgs e)
        {
            start(inputFile);
        }

       
    }
}