summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/C#/Parsing/Parser.cs4
-rw-r--r--win/C#/Properties/Settings.Designer.cs16
-rw-r--r--win/C#/Properties/Settings.settings3
-rw-r--r--win/C#/Services/Encode.cs69
-rw-r--r--win/C#/Services/Scan.cs131
-rw-r--r--win/C#/app.config3
-rw-r--r--win/C#/frmActivityWindow.cs134
-rw-r--r--win/C#/frmMain.cs40
8 files changed, 248 insertions, 152 deletions
diff --git a/win/C#/Parsing/Parser.cs b/win/C#/Parsing/Parser.cs
index 0fb08f9a5..5eb79520b 100644
--- a/win/C#/Parsing/Parser.cs
+++ b/win/C#/Parsing/Parser.cs
@@ -82,9 +82,9 @@ namespace Handbrake.Parsing
/// <summary>
/// Gets the buffer of data that came from the CLI standard input/error
/// </summary>
- public string Buffer
+ public StringBuilder Buffer
{
- get { return buffer.ToString(); }
+ get { return buffer; }
}
/// <summary>
diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs
index ef0389f9e..2833adc56 100644
--- a/win/C#/Properties/Settings.Designer.cs
+++ b/win/C#/Properties/Settings.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.1
+// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -12,7 +12,7 @@ namespace Handbrake.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -548,5 +548,17 @@ namespace Handbrake.Properties {
this["UpdateRequired"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("0")]
+ public int ActivityWindowLastMode {
+ get {
+ return ((int)(this["ActivityWindowLastMode"]));
+ }
+ set {
+ this["ActivityWindowLastMode"] = value;
+ }
+ }
}
}
diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings
index fe32569a6..7fa5698e2 100644
--- a/win/C#/Properties/Settings.settings
+++ b/win/C#/Properties/Settings.settings
@@ -134,5 +134,8 @@
<Setting Name="UpdateRequired" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
+ <Setting Name="ActivityWindowLastMode" Type="System.Int32" Scope="User">
+ <Value Profile="(Default)">0</Value>
+ </Setting>
</Settings>
</SettingsFile> \ No newline at end of file
diff --git a/win/C#/Services/Encode.cs b/win/C#/Services/Encode.cs
index e4b9e6532..677c62c62 100644
--- a/win/C#/Services/Encode.cs
+++ b/win/C#/Services/Encode.cs
@@ -3,8 +3,6 @@
Homepage: <http://handbrake.fr/>.
It may be used under the terms of the GNU General Public License. */
-using System.Diagnostics.CodeAnalysis;
-
namespace Handbrake.Services
{
using System;
@@ -23,6 +21,8 @@ namespace Handbrake.Services
/// </summary>
public class Encode
{
+ /* Private Variables */
+
/// <summary>
/// An Encode Job
/// </summary>
@@ -44,6 +44,18 @@ namespace Handbrake.Services
private Timer windowTimer;
/// <summary>
+ /// Gets The Process Handle
+ /// </summary>
+ private IntPtr processHandle;
+
+ /// <summary>
+ /// Gets the Process ID
+ /// </summary>
+ private int processID;
+
+ /* Event Handlers */
+
+ /// <summary>
/// Fires when a new CLI Job starts
/// </summary>
public event EventHandler EncodeStarted;
@@ -53,29 +65,19 @@ namespace Handbrake.Services
/// </summary>
public event EventHandler EncodeEnded;
+ /* Properties */
+
/// <summary>
/// Gets or sets The HB Process
/// </summary>
public Process HbProcess { get; set; }
/// <summary>
- /// Gets or sets The Process Handle
- /// </summary>
- public IntPtr ProcessHandle { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether IsEncoding.
+ /// Gets a value indicating whether IsEncoding.
/// </summary>
- public bool IsEncoding
- {
- get;
- set;
- }
+ public bool IsEncoding { get; private set; }
- /// <summary>
- /// Gets or sets the Process ID
- /// </summary>
- public int ProcessID { get; set; }
+ /* Public Methods */
/// <summary>
/// Gets ActivityLog.
@@ -84,10 +86,13 @@ namespace Handbrake.Services
{
get
{
- if (logBuffer != null)
- return logBuffer.ToString();
+ if (logBuffer == null)
+ {
+ ResetLogReader();
+ ReadFile(null);
+ }
- return string.Empty;
+ return logBuffer != null ? logBuffer.ToString() : string.Empty;
}
}
@@ -125,11 +130,11 @@ namespace Handbrake.Services
/// </summary>
public void SafelyClose()
{
- if ((int)this.ProcessHandle == 0)
+ if ((int)this.processHandle == 0)
return;
// Allow the CLI to exit cleanly
- Win32.SetForegroundWindow((int)this.ProcessHandle);
+ Win32.SetForegroundWindow((int)this.processHandle);
SendKeys.Send("^C");
SendKeys.Flush();
@@ -177,22 +182,22 @@ namespace Handbrake.Services
Process[] before = Process.GetProcesses(); // Get a list of running processes before starting.
Process startProcess = Process.Start(cliStart);
- this.ProcessID = Main.GetCliProcess(before);
+ this.processID = Main.GetCliProcess(before);
// Fire the Encode Started Event
if (this.EncodeStarted != null)
this.EncodeStarted(this, new EventArgs());
if (startProcess != null)
- this.ProcessHandle = startProcess.MainWindowHandle; // Set the process Handle
+ this.processHandle = startProcess.MainWindowHandle; // Set the process Handle
// Start the Log Monitor
windowTimer = new Timer(new TimerCallback(ReadFile), null, 1000, 1000);
// Set the process Priority
- if (this.ProcessID != -1)
+ if (this.processID != -1)
{
- HbProcess = Process.GetProcessById(this.ProcessID);
+ HbProcess = Process.GetProcessById(this.processID);
HbProcess.EnableRaisingEvents = true;
HbProcess.Exited += new EventHandler(HbProcess_Exited);
}
@@ -316,8 +321,8 @@ namespace Handbrake.Services
}
// Set the class items
- this.ProcessID = HbProcess.Id;
- this.ProcessHandle = HbProcess.Handle;
+ this.processID = HbProcess.Id;
+ this.processHandle = HbProcess.Handle;
}
catch (Exception exc)
{
@@ -330,15 +335,15 @@ namespace Handbrake.Services
/// </summary>
protected void Finish()
{
- if (this.EncodeEnded != null)
- this.EncodeEnded(this, new EventArgs());
-
if (!IsEncoding)
{
windowTimer.Dispose();
ReadFile(null);
}
+ if (this.EncodeEnded != null)
+ this.EncodeEnded(this, new EventArgs());
+
// Growl
if (Settings.Default.growlQueue)
GrowlCommunicator.Notify("Queue Completed", "Put down that cocktail...\nyour Handbrake queue is done.");
@@ -481,7 +486,7 @@ namespace Handbrake.Services
}
// Put the Query and User Generated Query Flag on the log.
- if (logFilePosition == 0)
+ if (logFilePosition == 0 && job.Query != null)
{
logBuffer.AppendLine("### CLI Query: " + job.Query);
logBuffer.AppendLine("### User Query: " + job.CustomQuery);
diff --git a/win/C#/Services/Scan.cs b/win/C#/Services/Scan.cs
index 6fd00a34f..3c62ec96b 100644
--- a/win/C#/Services/Scan.cs
+++ b/win/C#/Services/Scan.cs
@@ -16,12 +16,14 @@ namespace Handbrake.Services
/// <summary>
/// Scan a Source
/// </summary>
- public class Scan
+ public class ScanService
{
+ /* Private Variables */
+
/// <summary>
- /// The information for this source
+ /// A Lock object
/// </summary>
- private DVD thisDvd;
+ private static readonly object locker = new object();
/// <summary>
/// The CLI data parser
@@ -34,11 +36,6 @@ namespace Handbrake.Services
private StringBuilder logBuffer;
/// <summary>
- /// A Lock object
- /// </summary>
- private static object locker = new object();
-
- /// <summary>
/// The line number thats been read to in the log file
/// </summary>
private int logFilePosition;
@@ -48,10 +45,7 @@ namespace Handbrake.Services
/// </summary>
private Process hbProc;
- /// <summary>
- /// The Progress of the scan
- /// </summary>
- private string scanProgress;
+ /* Event Handlers */
/// <summary>
/// Scan has Started
@@ -68,10 +62,22 @@ namespace Handbrake.Services
/// </summary>
public event EventHandler ScanStatusChanged;
+ /* Properties */
+
/// <summary>
- /// Gets or sets a value indicating whether IsScanning.
+ /// Gets a value indicating whether IsScanning.
/// </summary>
- public bool IsScanning { get; set; }
+ public bool IsScanning { get; private set; }
+
+ /// <summary>
+ /// Gets the Scan Status.
+ /// </summary>
+ public string ScanStatus { get; private set; }
+
+ /// <summary>
+ /// Gets the Souce Data.
+ /// </summary>
+ public DVD SouceData { get; private set; }
/// <summary>
/// Gets ActivityLog.
@@ -81,56 +87,36 @@ namespace Handbrake.Services
get
{
if (IsScanning)
- return readData.Buffer;
+ return readData.Buffer.ToString();
+
+ if (logBuffer == null)
+ {
+ ResetLogReader();
+ ReadLastScanFile();
+ }
- ReadFile();
- return logBuffer.ToString();
+ return logBuffer != null ? logBuffer.ToString() : string.Empty;
}
}
+ /* Public Methods */
+
/// <summary>
/// Scan a Source Path.
/// Title 0: scan all
/// </summary>
/// <param name="sourcePath">Path to the file to scan</param>
/// <param name="title">int title number. 0 for scan all</param>
- public void ScanSource(string sourcePath, int title)
+ public void Scan(string sourcePath, int title)
{
- Thread t = new Thread(unused => this.RunScan(sourcePath, title));
+ Thread t = new Thread(unused => this.ScanSource(sourcePath, title));
t.Start();
}
/// <summary>
- /// Object containing the information parsed in the scan.
- /// </summary>
- /// <returns>The DVD object containing the scan information</returns>
- public DVD SouceData()
- {
- return this.thisDvd;
- }
-
- /// <summary>
- /// Progress of the scan.
- /// </summary>
- /// <returns>The progress of the scan</returns>
- public string ScanStatus()
- {
- return this.scanProgress;
- }
-
- /// <summary>
- /// The Scan Process
- /// </summary>
- /// <returns>The CLI process</returns>
- public Process ScanProcess()
- {
- return this.hbProc;
- }
-
- /// <summary>
/// Kill the scan
/// </summary>
- public void KillScan()
+ public void Stop()
{
try
{
@@ -145,12 +131,14 @@ namespace Handbrake.Services
}
}
+ /* Private Methods */
+
/// <summary>
/// Start a scan for a given source path and title
/// </summary>
/// <param name="sourcePath">Path to the source file</param>
/// <param name="title">the title number to look at</param>
- private void RunScan(object sourcePath, int title)
+ private void ScanSource(object sourcePath, int title)
{
try
{
@@ -177,52 +165,58 @@ namespace Handbrake.Services
extraArguments += " --scan ";
this.hbProc = new Process
- {
- StartInfo =
- {
- FileName = handbrakeCLIPath,
- Arguments =
- String.Format(@" -i ""{0}"" -t{1} {2} -v ", sourcePath, title, extraArguments),
- RedirectStandardOutput = true,
- RedirectStandardError = true,
- UseShellExecute = false,
- CreateNoWindow = true
- }
- };
+ {
+ StartInfo =
+ {
+ FileName = handbrakeCLIPath,
+ Arguments =
+ String.Format(@" -i ""{0}"" -t{1} {2} -v ", sourcePath, title,
+ extraArguments),
+ RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ UseShellExecute = false,
+ CreateNoWindow = true
+ }
+ };
// Start the Scan
this.hbProc.Start();
this.readData = new Parser(this.hbProc.StandardError.BaseStream);
this.readData.OnScanProgress += new ScanProgressEventHandler(this.OnScanProgress);
- this.thisDvd = DVD.Parse(this.readData);
+ this.SouceData = DVD.Parse(this.readData);
// Write the Buffer out to file.
StreamWriter scanLog = new StreamWriter(dvdInfoPath);
scanLog.Write(this.readData.Buffer);
scanLog.Flush();
scanLog.Close();
+ logBuffer = readData.Buffer;
+
+ IsScanning = false;
if (this.ScanCompleted != null)
this.ScanCompleted(this, new EventArgs());
- IsScanning = false;
}
catch (Exception exc)
{
- Console.WriteLine("frmMain.cs - scanProcess() " + exc);
+ frmExceptionWindow exceptionWindow = new frmExceptionWindow();
+ exceptionWindow.Setup("frmMain.cs - scanProcess() Error", exc.ToString());
+ exceptionWindow.ShowDialog();
}
- }
+ }
/// <summary>
/// Read the log file
/// </summary>
- private void ReadFile()
+ private void ReadLastScanFile()
{
lock (locker)
{
// last_encode_log.txt is the primary log file. Since .NET can't read this file whilst the CLI is outputing to it (Not even in read only mode),
// we'll need to make a copy of it.
- string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
+ string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
+ "\\HandBrake\\logs";
string logFile = Path.Combine(logDir, "last_scan_log.txt");
string logFile2 = Path.Combine(logDir, "tmp_appReadable_log.txt");
@@ -258,8 +252,9 @@ namespace Handbrake.Services
sr.Close();
sr.Dispose();
}
- catch (Exception)
+ catch (Exception exc)
{
+ Console.WriteLine(exc.ToString());
ResetLogReader();
}
}
@@ -282,7 +277,7 @@ namespace Handbrake.Services
/// <param name="titleCount">the total number of titles</param>
private void OnScanProgress(object sender, int currentTitle, int titleCount)
{
- this.scanProgress = string.Format("Processing Title: {0} of {1}", currentTitle, titleCount);
+ this.ScanStatus = string.Format("Processing Title: {0} of {1}", currentTitle, titleCount);
if (this.ScanStatusChanged != null)
this.ScanStatusChanged(this, new EventArgs());
}
diff --git a/win/C#/app.config b/win/C#/app.config
index 525247e52..66908a1b5 100644
--- a/win/C#/app.config
+++ b/win/C#/app.config
@@ -140,6 +140,9 @@
<setting name="UpdateRequired" serializeAs="String">
<value>True</value>
</setting>
+ <setting name="ActivityWindowLastMode" serializeAs="String">
+ <value>0</value>
+ </setting>
</Handbrake.Properties.Settings>
</userSettings>
<startup />
diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs
index e3468927e..7686a0d1d 100644
--- a/win/C#/frmActivityWindow.cs
+++ b/win/C#/frmActivityWindow.cs
@@ -22,6 +22,8 @@ namespace Handbrake
/// </summary>
public partial class frmActivityWindow : Form
{
+ /* Private Variables */
+
/// <summary>
/// The current position in the log file
/// </summary>
@@ -40,35 +42,39 @@ namespace Handbrake
/// <summary>
/// The Scan Object
/// </summary>
- private Scan scan;
+ private ScanService scan;
/// <summary>
/// The Type of log that the window is currently dealing with
/// </summary>
private ActivityLogMode mode;
+ /* Constructor */
+
/// <summary>
/// Initializes a new instance of the <see cref="frmActivityWindow"/> class.
/// </summary>
- /// <param name="mode">
- /// The mode.
- /// </param>
/// <param name="encode">
/// The encode.
/// </param>
/// <param name="scan">
/// The scan.
/// </param>
- public frmActivityWindow(ActivityLogMode mode, Encode encode, Scan scan)
+ public frmActivityWindow(Encode encode, ScanService scan)
{
InitializeComponent();
this.encode = encode;
this.scan = scan;
- this.mode = mode;
this.position = 0;
+
+ // Listen for Scan and Encode Starting Events
+ scan.ScanStared += scan_ScanStared;
+ encode.EncodeStarted += encode_EncodeStarted;
}
+ /* Delegates */
+
/// <summary>
/// A callback function for updating the ui
/// </summary>
@@ -82,7 +88,15 @@ namespace Handbrake
/// </summary>
private delegate void SetTextClearCallback();
- // Public
+ /// <summary>
+ /// Set mode callback
+ /// </summary>
+ /// <param name="setMode">
+ /// The set mode.
+ /// </param>
+ private delegate void SetModeCallback(ActivityLogMode setMode);
+
+ /* Public Methods */
/// <summary>
/// Set the window to scan mode
@@ -90,14 +104,46 @@ namespace Handbrake
/// <param name="setMode">
/// The set Mode.
/// </param>
- public void SetMode(ActivityLogMode setMode)
+ private void SetMode(ActivityLogMode setMode)
{
- Reset();
- this.mode = setMode;
- this.Text = mode == ActivityLogMode.Scan ? "Activity Window (Scan Log)" : "Activity Window (Enocde Log)";
+ if (IsHandleCreated)
+ {
+ if (rtf_actLog.InvokeRequired)
+ {
+ IAsyncResult invoked = BeginInvoke(new SetModeCallback(SetMode), new object[] {setMode});
+ EndInvoke(invoked);
+ }
+ else
+ {
+ Reset();
+ this.mode = setMode;
+
+ Array values = Enum.GetValues(typeof(ActivityLogMode));
+ Properties.Settings.Default.ActivityWindowLastMode = (int) values.GetValue(Convert.ToInt32(setMode));
+ Properties.Settings.Default.Save();
+
+ this.Text = mode == ActivityLogMode.Scan
+ ? "Activity Window (Scan Log)"
+ : "Activity Window (Encode Log)";
+
+ if (mode == ActivityLogMode.Scan)
+ {
+ scan.ScanCompleted += stopWindowRefresh;
+ encode.EncodeEnded -= stopWindowRefresh;
+ }
+ else
+ {
+ scan.ScanCompleted -= stopWindowRefresh;
+ encode.EncodeEnded += stopWindowRefresh;
+ }
+
+ // Start a fresh window timer
+ windowTimer = new Timer(new TimerCallback(LogMonitor), null, 1000, 1000);
+ }
+ }
}
- // Logging
+ /* Private Methods */
/// <summary>
/// On Window load, start a new timer
@@ -110,7 +156,51 @@ namespace Handbrake
/// </param>
private void NewActivityWindow_Load(object sender, EventArgs e)
{
- windowTimer = new Timer(new TimerCallback(LogMonitor), null, 1000, 1000);
+ ActivityLogMode activitLogMode = (ActivityLogMode) Enum.ToObject(typeof(ActivityLogMode), Properties.Settings.Default.ActivityWindowLastMode);
+ SetMode(activitLogMode);
+ }
+
+ /// <summary>
+ /// Set the Log window to encode mode when an encode starts.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ private void encode_EncodeStarted(object sender, EventArgs e)
+ {
+ SetMode(ActivityLogMode.Encode);
+ }
+
+ /// <summary>
+ /// Set the log widow to scan mode when a scan starts
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ private void scan_ScanStared(object sender, EventArgs e)
+ {
+ SetMode(ActivityLogMode.Scan);
+ }
+
+ /// <summary>
+ /// Stop refreshing the window when no scanning or encoding is happening.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ private void stopWindowRefresh(object sender, EventArgs e)
+ {
+ windowTimer.Dispose();
+ LogMonitor(null);
}
/// <summary>
@@ -133,7 +223,7 @@ namespace Handbrake
private StringBuilder GetLog()
{
StringBuilder appendText = new StringBuilder();
-
+
if (this.mode == ActivityLogMode.Scan)
{
if (scan == null || scan.ActivityLog == string.Empty)
@@ -213,6 +303,12 @@ namespace Handbrake
else
lock (rtf_actLog)
rtf_actLog.AppendText(text.ToString());
+
+ // Stop the refresh process if log has finished.
+ if (text.ToString().Contains("HandBrake has Exited"))
+ {
+ windowTimer.Dispose();
+ }
}
}
catch (Exception)
@@ -301,7 +397,7 @@ namespace Handbrake
windowTimer = new Timer(new TimerCallback(LogMonitor), null, 1000, 1000);
}
- // Menus and Buttons
+ /* Menus and Buttons */
/// <summary>
/// Copy log to clipboard
@@ -383,7 +479,7 @@ namespace Handbrake
SetMode(ActivityLogMode.Encode);
}
- // Overrides
+ /* Overrides */
/// <summary>
/// override onclosing
@@ -393,6 +489,12 @@ namespace Handbrake
/// </param>
protected override void OnClosing(CancelEventArgs e)
{
+ scan.ScanStared -= scan_ScanStared;
+ encode.EncodeStarted -= encode_EncodeStarted;
+
+ scan.ScanCompleted -= stopWindowRefresh;
+ encode.EncodeEnded -= stopWindowRefresh;
+
windowTimer.Dispose();
e.Cancel = true;
this.Dispose();
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index cd804087c..229c25516 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -35,13 +35,12 @@ namespace Handbrake
private frmActivityWindow ActivityWindow;
private Form splash;
public string sourcePath;
- private ActivityLogMode lastAction;
private SourceType selectedSourceType;
private string dvdDrivePath;
private string dvdDriveLabel;
private Preset CurrentlySelectedPreset;
private DVD currentSource;
- private Scan SourceScan = new Scan();
+ private ScanService SourceScan = new ScanService();
private List<DriveInformation> drives;
// Delegates **********************************************************
@@ -347,7 +346,6 @@ namespace Handbrake
private void encodeStarted(object sender, EventArgs e)
{
- lastAction = ActivityLogMode.Encode;
SetEncodeStarted();
// Experimental HBProc Process Monitoring.
@@ -395,7 +393,7 @@ namespace Handbrake
private void mnu_encodeLog_Click(object sender, EventArgs e)
{
- frmActivityWindow dvdInfoWindow = new frmActivityWindow(lastAction, encodeQueue, SourceScan);
+ frmActivityWindow dvdInfoWindow = new frmActivityWindow(encodeQueue, SourceScan);
dvdInfoWindow.Show();
}
@@ -872,10 +870,7 @@ namespace Handbrake
SetEncodeStarted(); // Encode is running, so setup the GUI appropriately
encodeQueue.Start(); // Start The Queue Encoding Process
- lastAction = ActivityLogMode.Encode; // Set the last action to encode - Used for activity window.
}
- if (ActivityWindow != null)
- ActivityWindow.SetMode(ActivityLogMode.Encode);
this.Focus();
}
@@ -946,20 +941,7 @@ namespace Handbrake
private void btn_ActivityWindow_Click(object sender, EventArgs e)
{
if (ActivityWindow == null || !ActivityWindow.IsHandleCreated)
- ActivityWindow = new frmActivityWindow(lastAction, encodeQueue, SourceScan);
- else
- switch (lastAction)
- {
- case ActivityLogMode.Scan:
- ActivityWindow.SetMode(ActivityLogMode.Scan);
- break;
- case ActivityLogMode.Encode:
- ActivityWindow.SetMode(ActivityLogMode.Encode);
- break;
- default:
- ActivityWindow.SetMode(ActivityLogMode.Encode);
- break;
- }
+ ActivityWindow = new frmActivityWindow(encodeQueue, SourceScan);
ActivityWindow.Show();
ActivityWindow.Activate();
@@ -1046,7 +1028,6 @@ namespace Handbrake
private void SelectSource(string file)
{
Check_ChapterMarkers.Enabled = true;
- lastAction = ActivityLogMode.Scan;
sourcePath = string.Empty;
if (file == string.Empty) // Must have a file or path
@@ -1652,15 +1633,11 @@ namespace Handbrake
this.DisableGUI();
- if (ActivityWindow != null)
- ActivityWindow.SetMode(ActivityLogMode.Scan);
-
// Start the Scan
try
{
isScanning = true;
- SourceScan = new Scan();
- SourceScan.ScanSource(sourcePath, title);
+ SourceScan.Scan(sourcePath, title);
SourceScan.ScanStatusChanged += new EventHandler(SourceScan_ScanStatusChanged);
SourceScan.ScanCompleted += new EventHandler(SourceScan_ScanCompleted);
}
@@ -1687,7 +1664,7 @@ namespace Handbrake
BeginInvoke(new UpdateWindowHandler(UpdateScanStatusLabel));
return;
}
- lbl_encode.Text = SourceScan.ScanStatus();
+ lbl_encode.Text = SourceScan.ScanStatus;
}
private void UpdateGuiAfterScan()
@@ -1700,7 +1677,7 @@ namespace Handbrake
try
{
- currentSource = SourceScan.SouceData();
+ currentSource = SourceScan.SouceData;
// Setup some GUI components
drp_dvdtitle.Items.Clear();
@@ -1798,7 +1775,7 @@ namespace Handbrake
EnableGUI();
ResetGUI();
- SourceScan.KillScan();
+ SourceScan.Stop();
lbl_encode.Text = "Scan Cancelled!";
}
@@ -2034,7 +2011,7 @@ namespace Handbrake
if (SourceScan.IsScanning)
{
SourceScan.ScanCompleted -= new EventHandler(SourceScan_ScanCompleted);
- SourceScan.KillScan();
+ SourceScan.Stop();
}
base.OnFormClosing(e);
}
@@ -2086,7 +2063,6 @@ namespace Handbrake
#endregion
-
// This is the END of the road ****************************************
}
} \ No newline at end of file