<Compile Include="frmOptions.Designer.cs">\r
<DependentUpon>frmOptions.cs</DependentUpon>\r
</Compile>\r
+ <Compile Include="Functions\CLI.cs" />\r
+ <Compile Include="Functions\Update.cs" />\r
<Compile Include="Parsing\AudioTrack.cs" />\r
<Compile Include="Parsing\Chapter.cs" />\r
<Compile Include="Parsing\DVD.cs" />\r
}\r
}\r
\r
- /*private int[] m_cellRange;\r
- public int[] CellRange\r
- {\r
- get\r
- {\r
- return this.m_cellRange;\r
- }\r
- }\r
-\r
- private int m_blocks;\r
- public int BlockCount\r
- {\r
- get\r
- {\r
- return this.m_blocks;\r
- }\r
- }*/\r
-\r
private TimeSpan m_duration;\r
public TimeSpan Duration\r
{\r
Chapter thisChapter = new Chapter();\r
string[] splitter = curLine.Split(new string[] { " + ", ": cells ", ", ", " blocks, duration ", "->" }, StringSplitOptions.RemoveEmptyEntries);\r
thisChapter.m_chapterNumber = int.Parse(splitter[0]);\r
- //thisChapter.m_cellRange = new int[2] { int.Parse(splitter[1]), int.Parse(splitter[2]) };\r
- //thisChapter.m_blocks = int.Parse(splitter[3]);\r
thisChapter.m_duration = TimeSpan.Parse(splitter[4]);\r
return thisChapter;\r
}\r
while (!curLine.Contains(" + audio tracks:"))\r
{\r
Chapter thisChapter = Chapter.Parse(output);\r
+ \r
if (thisChapter != null)\r
{\r
chapters.Add(thisChapter);\r
using System.Collections.Generic;\r
using System.Text;\r
using System.IO;\r
+using System.Windows.Forms;\r
+\r
\r
namespace Handbrake.Parsing\r
{\r
while ((char)output.Peek() != '+') // oh glorious hack, serve me well\r
{\r
Subtitle thisSubtitle = Subtitle.Parse(output);\r
+\r
if (thisSubtitle != null)\r
{\r
subtitles.Add(thisSubtitle);\r
using System.Text;\r
using System.Drawing;\r
using System.IO;\r
+using System.Windows.Forms;\r
\r
namespace Handbrake.Parsing\r
{\r
}\r
}\r
\r
- /*private int m_vts;\r
- public int Vts\r
- {\r
- get\r
- {\r
- return this.m_vts;\r
- }\r
- }\r
-\r
- private int m_ttn;\r
- public int Ttn\r
- {\r
- get\r
- {\r
- return this.m_ttn;\r
- }\r
- }\r
-\r
- private int[] m_cellRange;\r
- public int[] CellRange\r
- {\r
- get\r
- {\r
- return this.m_cellRange;\r
- }\r
- }\r
-\r
- private int m_blockCount;\r
- public int BlockCount\r
- {\r
- get\r
- {\r
- return this.m_blockCount;\r
- }\r
- }*/\r
-\r
private int m_titleNumber;\r
public int TitleNumber\r
{\r
}\r
}\r
\r
- /*private float m_fps;\r
- public float Fps\r
- {\r
- get\r
- {\r
- return this.m_fps;\r
- }\r
- }*/\r
\r
private int[] m_autoCrop;\r
public int[] AutoCropDimensions\r
this.m_audioTracks = new List<AudioTrack>();\r
this.m_chapters = new List<Chapter>();\r
this.m_subtitles = new List<Subtitle>();\r
- //this.m_cellRange = new int[2];\r
}\r
\r
public override string ToString()\r
* This will be converted to use Regex soon, I promise ;)\r
* brianmario - 7/9/07\r
*/\r
- try\r
- {\r
+ \r
string curLine = output.ReadLine();\r
thisTitle.m_titleNumber = int.Parse(curLine.Substring(curLine.Length - 2, 1));\r
curLine = output.ReadLine();\r
string[] splitter = curLine.Split(',');\r
- //thisTitle.m_vts = int.Parse(splitter[0].Substring(8));\r
- //thisTitle.m_ttn = int.Parse(splitter[1].Substring(5));\r
+ \r
splitter = splitter[2].Trim().Split(' ', '(', ')');\r
- //thisTitle.m_blockCount = int.Parse(splitter[3]);\r
+\r
splitter = splitter[1].Split('-', '>');\r
- //thisTitle.m_cellRange[0] = int.Parse(splitter[0]);\r
- //thisTitle.m_cellRange[1] = int.Parse(splitter[2]);\r
+\r
curLine = output.ReadLine();\r
splitter = curLine.Split(new string[] { " + duration: " }, StringSplitOptions.RemoveEmptyEntries);\r
thisTitle.m_duration = TimeSpan.Parse(splitter[0]);\r
splitter = curLine.Split(new string[] { " + size: ", "aspect: ", ", ", " fps", "x" }, StringSplitOptions.RemoveEmptyEntries);\r
thisTitle.m_resolution = new Size(int.Parse(splitter[0]), int.Parse(splitter[1]));\r
thisTitle.m_aspectRatio = float.Parse(splitter[2].ToString());\r
- //thisTitle.m_fps = float.Parse(splitter[3].ToString());\r
+ \r
curLine = output.ReadLine();\r
splitter = curLine.Split(new string[] { " + autocrop: ", "/" }, StringSplitOptions.RemoveEmptyEntries);\r
thisTitle.m_autoCrop = new int[4] { int.Parse(splitter[0]), int.Parse(splitter[1]), int.Parse(splitter[2]), int.Parse(splitter[3]) };\r
thisTitle.m_chapters.AddRange(Chapter.ParseList(output));\r
thisTitle.m_audioTracks.AddRange(AudioTrack.ParseList(output));\r
thisTitle.m_subtitles.AddRange(Subtitle.ParseList(output));\r
- }\r
- catch (Exception)\r
- {\r
- // hbcli crashed caused an exception here. Just threw this in to prevent a program error.\r
- // Can be debuged later.\r
- }\r
-\r
+ \r
return thisTitle;\r
}\r
\r
query = QueryEditorText.Text;\r
}\r
\r
- hbProc = new System.Diagnostics.Process();\r
- hbProc.StartInfo.FileName = "hbcli.exe";\r
- hbProc.StartInfo.Arguments = query;\r
- hbProc.StartInfo.UseShellExecute = false;\r
- hbProc.Start();\r
-\r
- // Set the process Priority\r
- string priority = Properties.Settings.Default.processPriority;\r
- switch (priority)\r
- {\r
- case "Realtime":\r
- hbProc.PriorityClass = ProcessPriorityClass.RealTime;\r
- break;\r
- case "High":\r
- hbProc.PriorityClass = ProcessPriorityClass.High;\r
- break;\r
- case "Above Normal":\r
- hbProc.PriorityClass = ProcessPriorityClass.AboveNormal;\r
- break;\r
- case "Normal":\r
- hbProc.PriorityClass = ProcessPriorityClass.Normal;\r
- break;\r
- case "Low":\r
- hbProc.PriorityClass = ProcessPriorityClass.Idle;\r
- break;\r
- default:\r
- hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;\r
- break;\r
- }\r
+ Functions.CLI process = new Functions.CLI();\r
+ Process hbProc = process.runCli(this, query, false, false, false, false);\r
\r
ThreadPool.QueueUserWorkItem(procMonitor);\r
- // TODO: Need to write a bit of code here to do process monitoring.\r
}\r
\r
private void procMonitor(object state)\r
text_width.BackColor = Color.LightGreen;\r
}\r
}\r
-\r
+ \r
// There is a bug here *******************************************************************\r
- if (!lbl_Aspect.Text.Equals("Select a Title")){\r
+ if (lbl_Aspect.Text != "Select a Title")\r
+ {\r
int height = int.Parse(text_width.Text) / int.Parse(lbl_Aspect.Text);\r
MessageBox.Show("test");\r
int mod16 = height % 16;\r
for (int i = 0; i < initialListCount; i++)\r
{\r
string query = list_queue.Items[0].ToString();\r
- Process hbProc = new Process();\r
- hbProc.StartInfo.FileName = "hbcli.exe";\r
- hbProc.StartInfo.Arguments = query;\r
- hbProc.StartInfo.UseShellExecute = false;\r
- hbProc.Start();\r
-\r
- // Set the process Priority\r
-\r
- switch (Properties.Settings.Default.processPriority)\r
- {\r
- case "Realtime":\r
- hbProc.PriorityClass = ProcessPriorityClass.RealTime;\r
- break;\r
- case "High":\r
- hbProc.PriorityClass = ProcessPriorityClass.High;\r
- break;\r
- case "Above Normal":\r
- hbProc.PriorityClass = ProcessPriorityClass.AboveNormal;\r
- break;\r
- case "Normal":\r
- hbProc.PriorityClass = ProcessPriorityClass.Normal;\r
- break;\r
- case "Low":\r
- hbProc.PriorityClass = ProcessPriorityClass.Idle;\r
- break;\r
- default:\r
- hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;\r
- break;\r
- }\r
\r
+ Functions.CLI process = new Functions.CLI();\r
+ Process hbProc = process.runCli(this, query, false, false, false, false);\r
+ \r
hbProc.WaitForExit();\r
hbProc.Close();\r
hbProc.Dispose();\r
\r
-\r
updateUIElements();\r
}\r
}\r
using System.Windows.Forms;\r
using System.IO;\r
using System.Threading;\r
+using System.Diagnostics;\r
\r
\r
namespace Handbrake\r
private void startProc(object state)\r
{\r
string query = "-i " + '"' + inputFile + '"' + " -t0";\r
- System.Diagnostics.Process hbProc = new System.Diagnostics.Process();\r
- hbProc.StartInfo.FileName = "hbcli.exe";\r
- hbProc.StartInfo.RedirectStandardOutput = true;\r
- hbProc.StartInfo.RedirectStandardError = true;\r
- hbProc.StartInfo.Arguments = query;\r
- hbProc.StartInfo.UseShellExecute = false;\r
- hbProc.StartInfo.CreateNoWindow = true;\r
+ \r
+ Functions.CLI process = new Functions.CLI();\r
+ Process hbProc = process.runCli(this, query, true, true, false, true);\r
\r
- hbProc.Start();\r
Parsing.Parser readData = new Parsing.Parser(hbProc.StandardError.BaseStream);\r
hbProc.WaitForExit();\r
hbProc.Close();\r