OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / frmReadDVD.cs
1 using System;\r
2 using System.Collections.Generic;\r
3 using System.ComponentModel;\r
4 using System.Data;\r
5 using System.Drawing;\r
6 using System.Text;\r
7 using System.Windows.Forms;\r
8 \r
9 namespace Handbrake\r
10 {\r
11     public partial class frmReadDVD : Form\r
12     {\r
13 \r
14         string inputFile;\r
15 \r
16         public frmReadDVD(string inputFile)\r
17         {\r
18             InitializeComponent();\r
19             this.inputFile = inputFile;\r
20         }\r
21 \r
22         private void frmReadDVD_Load(object sender, EventArgs e)\r
23         {\r
24             //start(inputFile);\r
25         }\r
26 \r
27         public void start(string filename)\r
28         {\r
29             MessageBox.Show(filename);\r
30             string query = "-i " + '"' + filename + '"' + " -t0";\r
31             System.Diagnostics.Process hbProc = new System.Diagnostics.Process();\r
32             hbProc.StartInfo.FileName = "hbcli.exe";\r
33             hbProc.StartInfo.RedirectStandardOutput = true;\r
34             hbProc.StartInfo.RedirectStandardError = true;\r
35             //hbProc.StartInfo.StandardOutputEncoding = System.Text.Encoding.UTF8;\r
36             //hbProc.StartInfo.StandardErrorEncoding = System.Text.Encoding.UTF8;\r
37             hbProc.StartInfo.Arguments = query;\r
38             hbProc.StartInfo.UseShellExecute = false;\r
39             hbProc.Start();\r
40 \r
41             rtf_dvdInfo.Text = "-- Start --";\r
42             while (hbProc.StandardOutput.BaseStream.CanRead && !hbProc.HasExited)\r
43             {\r
44                 rtf_dvdInfo.Text = rtf_dvdInfo.Text + "\n" + hbProc.StandardOutput.ReadLine();\r
45                 rtf_dvdInfo.Text = rtf_dvdInfo.Text + "\n" + hbProc.StandardError.ReadLine();\r
46                 MessageBox.Show("Test");\r
47             }\r
48 \r
49             rtf_dvdInfo.Text = rtf_dvdInfo.Text + "\n" + "-- End --";\r
50         }\r
51 \r
52         private void btn_ok_Click(object sender, EventArgs e)\r
53         {\r
54             start(inputFile);\r
55         }\r
56 \r
57        \r
58     }\r
59 }