}\r
}\r
\r
- private int[] m_cellRange;\r
+ /*private int[] m_cellRange;\r
public int[] CellRange\r
{\r
get\r
{\r
return this.m_blocks;\r
}\r
- }\r
+ }*/\r
\r
private TimeSpan m_duration;\r
public TimeSpan Duration\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_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
}\r
}\r
\r
- private int m_vts;\r
+ /*private int m_vts;\r
public int Vts\r
{\r
get\r
{\r
return this.m_blockCount;\r
}\r
- }\r
+ }*/\r
\r
private int m_titleNumber;\r
public int TitleNumber\r
}\r
}\r
\r
- private float m_fps;\r
+ /*private float m_fps;\r
public float Fps\r
{\r
get\r
{\r
return this.m_fps;\r
}\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
+ //this.m_cellRange = new int[2];\r
}\r
\r
public override string ToString()\r
{\r
- return string.Format("{0} - {1}h{2}m{3}s", this.m_titleNumber, this.m_duration.Hours, \r
+ return string.Format("{0} ({1}:{2}:{3})", this.m_titleNumber, this.m_duration.Hours, \r
this.m_duration.Minutes, this.m_duration.Seconds);\r
}\r
\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
+ //thisTitle.m_vts = int.Parse(splitter[0].Substring(8));\r
+ //thisTitle.m_ttn = int.Parse(splitter[1].Substring(5));\r
splitter = splitter[2].Trim().Split(' ', '(', ')');\r
- thisTitle.m_blockCount = int.Parse(splitter[3]);\r
+ //thisTitle.m_blockCount = int.Parse(splitter[3]);\r
splitter = splitter[1].Split('-', '>');\r
- thisTitle.m_cellRange[0] = int.Parse(splitter[0]);\r
- thisTitle.m_cellRange[1] = int.Parse(splitter[2]);\r
+ //thisTitle.m_cellRange[0] = int.Parse(splitter[0]);\r
+ //thisTitle.m_cellRange[1] = int.Parse(splitter[2]);\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
+ //thisTitle.m_fps = float.Parse(splitter[3].ToString());\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
}\r
\r
\r
-\r
// --------------------------------------------------------------\r
// The Menu Bar\r
// --------------------------------------------------------------\r
// TOOLS MENU --------------------------------------------------------------\r
private void mnu_encode_Click(object sender, EventArgs e)\r
{\r
- string query = ""; // temp fix for bug here.\r
- Form Queue = new frmQueue(query);\r
- Queue.ShowDialog();\r
+ //Queue.ShowDialog();\r
}\r
\r
private void mnu_viewDVDdata_Click(object sender, EventArgs e)\r
Form frmReadDVD = new frmReadDVD(filename, this);\r
frmReadDVD.ShowDialog();\r
}\r
-\r
}\r
else\r
{\r
Form frmReadDVD = new frmReadDVD(filename, this);\r
frmReadDVD.ShowDialog();\r
}\r
-\r
- }\r
-\r
- \r
+ } \r
}\r
\r
private void btn_destBrowse_Click(object sender, EventArgs e)\r
QueryEditorText.Text = "";\r
}\r
\r
+\r
+ \r
+ \r
+ private frmQueue queueWindow = (frmQueue)new frmQueue();\r
private void btn_queue_Click(object sender, EventArgs e)\r
{\r
String query = GenerateTheQuery();\r
- MessageBox.Show(query);\r
- Form Queue = new frmQueue(query);\r
- Queue.Show();\r
+ queueWindow.list_queue.Items.Add(query);\r
+ queueWindow.Show();\r
}\r
\r
private void btn_encode_Click(object sender, EventArgs e)\r
this.btn_q_encoder = new System.Windows.Forms.Button();\r
this.list_queue = new System.Windows.Forms.ListBox();\r
this.btn_Close = new System.Windows.Forms.Button();\r
+ this.progressBar = new System.Windows.Forms.ProgressBar();\r
+ this.label2 = new System.Windows.Forms.Label();\r
+ this.lbl_progressValue = new System.Windows.Forms.Label();\r
this.SuspendLayout();\r
// \r
// btn_down\r
this.btn_down.TabStop = false;\r
this.btn_down.Text = "Move Down";\r
this.btn_down.UseVisualStyleBackColor = false;\r
+ this.btn_down.Click += new System.EventHandler(this.btn_down_Click);\r
// \r
// btn_up\r
// \r
this.btn_up.TabStop = false;\r
this.btn_up.Text = "Move Up";\r
this.btn_up.UseVisualStyleBackColor = false;\r
+ this.btn_up.Click += new System.EventHandler(this.btn_up_Click);\r
// \r
// btn_delete\r
// \r
this.btn_delete.TabStop = false;\r
this.btn_delete.Text = "Delete Item";\r
this.btn_delete.UseVisualStyleBackColor = false;\r
+ this.btn_delete.Click += new System.EventHandler(this.btn_delete_Click);\r
// \r
// Label1\r
// \r
this.btn_q_encoder.TabStop = false;\r
this.btn_q_encoder.Text = "Encode Video(s)";\r
this.btn_q_encoder.UseVisualStyleBackColor = false;\r
+ this.btn_q_encoder.Click += new System.EventHandler(this.btn_q_encoder_Click);\r
// \r
// list_queue\r
// \r
this.list_queue.FormattingEnabled = true;\r
this.list_queue.Location = new System.Drawing.Point(10, 37);\r
this.list_queue.Name = "list_queue";\r
- this.list_queue.Size = new System.Drawing.Size(630, 327);\r
+ this.list_queue.Size = new System.Drawing.Size(630, 288);\r
this.list_queue.TabIndex = 28;\r
// \r
// btn_Close\r
this.btn_Close.UseVisualStyleBackColor = false;\r
this.btn_Close.Click += new System.EventHandler(this.btn_Close_Click);\r
// \r
+ // progressBar\r
+ // \r
+ this.progressBar.Location = new System.Drawing.Point(74, 331);\r
+ this.progressBar.Name = "progressBar";\r
+ this.progressBar.Size = new System.Drawing.Size(513, 23);\r
+ this.progressBar.TabIndex = 34;\r
+ // \r
+ // label2\r
+ // \r
+ this.label2.AutoSize = true;\r
+ this.label2.Location = new System.Drawing.Point(12, 336);\r
+ this.label2.Name = "label2";\r
+ this.label2.Size = new System.Drawing.Size(51, 13);\r
+ this.label2.TabIndex = 35;\r
+ this.label2.Text = "Progress:";\r
+ // \r
+ // lbl_progressValue\r
+ // \r
+ this.lbl_progressValue.AutoSize = true;\r
+ this.lbl_progressValue.Location = new System.Drawing.Point(593, 337);\r
+ this.lbl_progressValue.Name = "lbl_progressValue";\r
+ this.lbl_progressValue.Size = new System.Drawing.Size(24, 13);\r
+ this.lbl_progressValue.TabIndex = 36;\r
+ this.lbl_progressValue.Text = "0 %";\r
+ // \r
// frmQueue\r
// \r
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
this.ClientSize = new System.Drawing.Size(651, 404);\r
+ this.ControlBox = false;\r
+ this.Controls.Add(this.lbl_progressValue);\r
+ this.Controls.Add(this.label2);\r
+ this.Controls.Add(this.progressBar);\r
this.Controls.Add(this.btn_down);\r
this.Controls.Add(this.btn_up);\r
this.Controls.Add(this.btn_delete);\r
this.Name = "frmQueue";\r
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;\r
this.Text = "Queue";\r
- this.Load += new System.EventHandler(this.frmQueue_Load);\r
this.ResumeLayout(false);\r
this.PerformLayout();\r
\r
internal System.Windows.Forms.Button btn_q_encoder;\r
internal System.Windows.Forms.ListBox list_queue;\r
internal System.Windows.Forms.Button btn_Close;\r
+ private System.Windows.Forms.ProgressBar progressBar;\r
+ private System.Windows.Forms.Label label2;\r
+ private System.Windows.Forms.Label lbl_progressValue;\r
}\r
}
\ No newline at end of file
using System.Drawing;\r
using System.Text;\r
using System.Windows.Forms;\r
+using System.Threading;\r
+using System.Diagnostics;\r
\r
namespace Handbrake\r
{\r
public partial class frmQueue : Form\r
{\r
- private string query = "";\r
+ private frmQueue thisWindow;\r
\r
- public frmQueue(string query)\r
+ public frmQueue()\r
{\r
InitializeComponent();\r
- this.query = query;\r
}\r
\r
- public void addItem(String item)\r
+ private void btn_Close_Click(object sender, EventArgs e)\r
{\r
- list_queue.Items.Add(item);\r
- MessageBox.Show("test");\r
+ this.Hide();\r
}\r
\r
- private void btn_Close_Click(object sender, EventArgs e)\r
+ private void btn_delete_Click(object sender, EventArgs e)\r
+ {\r
+ list_queue.Items.Remove(list_queue.SelectedItem);\r
+ }\r
+\r
+ private void btn_up_Click(object sender, EventArgs e)\r
+ {\r
+ int count = list_queue.Items.Count;\r
+ int itemToMove = list_queue.SelectedIndex;\r
+ int previousItemint = 0; \r
+ String previousItem = "";\r
+\r
+ if (itemToMove > 0){\r
+ previousItemint = itemToMove - 1;\r
+ previousItem = list_queue.Items[previousItemint].ToString();\r
+ list_queue.Items[previousItemint] = list_queue.Items[itemToMove];\r
+ list_queue.Items[itemToMove] = previousItem;\r
+ list_queue.SelectedIndex = list_queue.SelectedIndex - 1;\r
+ }\r
+ }\r
+\r
+ private void btn_down_Click(object sender, EventArgs e)\r
{\r
- this.Close();\r
+ int count = list_queue.Items.Count;\r
+ int itemToMove = list_queue.SelectedIndex;\r
+ int itemAfterInt = 0; \r
+ String itemAfter = "";\r
+\r
+ if (itemToMove < (count - 1))\r
+ {\r
+ itemAfterInt = itemToMove + 1;\r
+ itemAfter = list_queue.Items[itemAfterInt].ToString();\r
+ list_queue.Items[itemAfterInt] = list_queue.Items[itemToMove];\r
+ list_queue.Items[itemToMove] = itemAfter;\r
+ list_queue.SelectedIndex = list_queue.SelectedIndex + 1;\r
+ }\r
}\r
\r
- private void frmQueue_Load(object sender, EventArgs e)\r
+ private void btn_q_encoder_Click(object sender, EventArgs e)\r
{\r
- addItem(query);\r
- MessageBox.Show("test");\r
+ progressBar.Value = 0;\r
+ lbl_progressValue.Text = "0 %";\r
+ progressBar.Update();\r
+ ThreadPool.QueueUserWorkItem(startProc);\r
}\r
\r
+ private void startProc(object state)\r
+ {\r
+ int listSize = list_queue.Items.Count;\r
+ listSize--;\r
+ int counter = 0;\r
+ int progressSplit = listSize / 100;\r
+\r
+ while (counter <= listSize)\r
+ {\r
+ String query = list_queue.Items[0].ToString();\r
\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
+ hbProc.WaitForExit();\r
+ hbProc.Close();\r
+ counter++;\r
+ //updateUIElements(progressSplit);\r
+ }\r
+ }\r
+\r
+ private void updateUIElements(int progressSplit)\r
+ {\r
+ // This needs to be written so there is no cross-thread problems\r
+ thisWindow.list_queue.Items.Remove(0);\r
+ progressBar.Value = progressBar.Value + progressSplit;\r
+ progressBar.Update();\r
+ }\r
}\r
}
\ No newline at end of file
// throw cli call and parsing on it's own thread\r
ThreadPool.QueueUserWorkItem(startProc);\r
}\r
-\r
+ \r
private void updateUIElements()\r
{\r
if (this.InvokeRequired)\r