diff options
author | sr55 <[email protected]> | 2007-08-25 20:34:42 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2007-08-25 20:34:42 +0000 |
commit | 370ca4bd5162411684a524fdceba9a6967b8c64e (patch) | |
tree | f13b0f85e60be2a958318472f37f03c8dcef85dd | |
parent | 2548077aee301044b45aca605f6949fec78903a9 (diff) |
WinGui:
- PSP Preset Fix
- Cleaned up Exception handling a bit.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@866 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | win/C#/HandBrakeCS.csproj | 8 | ||||
-rw-r--r-- | win/C#/Parsing/DVD.cs | 22 | ||||
-rw-r--r-- | win/C#/Parsing/Parser.cs | 65 | ||||
-rw-r--r-- | win/C#/Parsing/Title.cs | 28 | ||||
-rw-r--r-- | win/C#/Properties/AssemblyInfo.cs | 10 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 2 | ||||
-rw-r--r-- | win/C#/frmReadDVD.cs | 6 |
7 files changed, 90 insertions, 51 deletions
diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj index 1c5a64b15..33ad098d7 100644 --- a/win/C#/HandBrakeCS.csproj +++ b/win/C#/HandBrakeCS.csproj @@ -11,15 +11,20 @@ <AssemblyName>Handbrake</AssemblyName>
<ApplicationIcon>handbrakepineapple.ico</ApplicationIcon>
<StartupObject>Handbrake.Program</StartupObject>
+ <TargetZone>LocalIntranet</TargetZone>
+ <GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
- <Optimize>false</Optimize>
+ <Optimize>true</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <LangVersion>default</LangVersion>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <NoStdLib>false</NoStdLib>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -170,6 +175,7 @@ </ItemGroup>
<ItemGroup>
<Content Include="handbrakepineapple.ico" />
+ <BaseApplicationManifest Include="Properties\app.manifest" />
<None Include="Resources\Remove.png" />
<None Include="Resources\Movies.png" />
<None Include="Resources\info.png" />
diff --git a/win/C#/Parsing/DVD.cs b/win/C#/Parsing/DVD.cs index d2d211538..62a40d81b 100644 --- a/win/C#/Parsing/DVD.cs +++ b/win/C#/Parsing/DVD.cs @@ -42,18 +42,24 @@ namespace Handbrake.Parsing public static DVD Parse(StreamReader output)
{
DVD thisDVD = new DVD();
- while (!output.EndOfStream)
+ try
{
- if ((char)output.Peek() == '+')
+ while (!output.EndOfStream)
{
- string testb = output.ReadToEnd();
- thisDVD.m_titles.AddRange(Title.ParseList(testb));
- }
- else
- {
- output.ReadLine();
+ if ((char)output.Peek() == '+')
+ {
+ thisDVD.m_titles.AddRange(Title.ParseList(output.ReadToEnd()));
+ }
+ else
+ {
+ output.ReadLine();
+ }
}
}
+ catch (Exception exc)
+ {
+ MessageBox.Show("DVD.CS - Parse" + exc.ToString());
+ }
return thisDVD;
}
}
diff --git a/win/C#/Parsing/Parser.cs b/win/C#/Parsing/Parser.cs index f56999a0d..ea2ae57fd 100644 --- a/win/C#/Parsing/Parser.cs +++ b/win/C#/Parsing/Parser.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text;
using System.IO;
using System.Text.RegularExpressions;
+using System.Windows.Forms;
namespace Handbrake.Parsing
{
@@ -79,30 +80,38 @@ namespace Handbrake.Parsing public override string ReadLine()
{
string tmp = base.ReadLine();
- this.m_buffer += tmp;
- Match m = Regex.Match(tmp, "^Scanning title ([0-9]*) of ([0-9]*)");
- if (OnReadLine != null)
+ try
{
- OnReadLine(this, tmp);
- }
- if (m.Success && OnScanProgress != null)
- {
- OnScanProgress(this, int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));
- }
- m = Regex.Match(tmp, @"^Encoding: task ([0-9]*) of ([0-9]*), ([0-9]*\.[0-9]*) %( \(([0-9]*\.[0-9]*) fps, avg ([0-9]*\.[0-9]*) fps, ETA ([0-9]{2})h([0-9]{2})m([0-9]{2})s\))?");
- if (m.Success && OnEncodeProgress != null)
- {
- int currentTask = int.Parse(m.Groups[1].Value);
- int totalTasks = int.Parse(m.Groups[2].Value);
- float percent = float.Parse(m.Groups[3].Value);
- float currentFps = m.Groups[5].Value == string.Empty ? 0.0F : float.Parse(m.Groups[5].Value);
- float avgFps = m.Groups[6].Value == string.Empty ? 0.0F : float.Parse(m.Groups[6].Value);
- TimeSpan remaining = TimeSpan.Zero;
- if (m.Groups[7].Value != string.Empty)
+
+ this.m_buffer += tmp;
+ Match m = Regex.Match(tmp, "^Scanning title ([0-9]*) of ([0-9]*)");
+ if (OnReadLine != null)
+ {
+ OnReadLine(this, tmp);
+ }
+ if (m.Success && OnScanProgress != null)
+ {
+ OnScanProgress(this, int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));
+ }
+ m = Regex.Match(tmp, @"^Encoding: task ([0-9]*) of ([0-9]*), ([0-9]*\.[0-9]*) %( \(([0-9]*\.[0-9]*) fps, avg ([0-9]*\.[0-9]*) fps, ETA ([0-9]{2})h([0-9]{2})m([0-9]{2})s\))?");
+ if (m.Success && OnEncodeProgress != null)
{
- remaining = TimeSpan.Parse(m.Groups[7].Value + ":" + m.Groups[8].Value + ":" + m.Groups[9].Value);
+ int currentTask = int.Parse(m.Groups[1].Value);
+ int totalTasks = int.Parse(m.Groups[2].Value);
+ float percent = float.Parse(m.Groups[3].Value);
+ float currentFps = m.Groups[5].Value == string.Empty ? 0.0F : float.Parse(m.Groups[5].Value);
+ float avgFps = m.Groups[6].Value == string.Empty ? 0.0F : float.Parse(m.Groups[6].Value);
+ TimeSpan remaining = TimeSpan.Zero;
+ if (m.Groups[7].Value != string.Empty)
+ {
+ remaining = TimeSpan.Parse(m.Groups[7].Value + ":" + m.Groups[8].Value + ":" + m.Groups[9].Value);
+ }
+ OnEncodeProgress(this, currentTask, totalTasks, percent, currentFps, avgFps, remaining);
}
- OnEncodeProgress(this, currentTask, totalTasks, percent, currentFps, avgFps, remaining);
+ }
+ catch (Exception exc)
+ {
+ MessageBox.Show("Parser.cs - ReadLine " + exc.ToString());
}
return tmp;
}
@@ -110,10 +119,18 @@ namespace Handbrake.Parsing public override string ReadToEnd()
{
string tmp = base.ReadToEnd();
- this.m_buffer += tmp;
- if (OnReadToEnd != null)
+ try
+ {
+
+ this.m_buffer += tmp;
+ if (OnReadToEnd != null)
+ {
+ OnReadToEnd(this, tmp);
+ }
+ }
+ catch (Exception exc)
{
- OnReadToEnd(this, tmp);
+ MessageBox.Show("Parser.cs - ReadToEnd " + exc.ToString());
}
return tmp;
}
diff --git a/win/C#/Parsing/Title.cs b/win/C#/Parsing/Title.cs index a78fef78a..3c3aaca74 100644 --- a/win/C#/Parsing/Title.cs +++ b/win/C#/Parsing/Title.cs @@ -137,11 +137,9 @@ namespace Handbrake.Parsing public static Title Parse(StringReader output)
{
Title thisTitle = new Title();
-
- // Match track number for this title
try
{
-
+ // Match track number for this title
Match m = Regex.Match(output.ReadLine(), @"^\+ title ([0-9]*):");
if (m.Success)
{
@@ -150,20 +148,21 @@ namespace Handbrake.Parsing output.ReadLine();
// Get duration for this title
+
m = Regex.Match(output.ReadLine(), @"^ \+ duration: ([0-9]{2}:[0-9]{2}:[0-9]{2})");
if (m.Success)
{
thisTitle.m_duration = TimeSpan.Parse(m.Groups[1].Value);
}
+
// Get resolution, aspect ratio and FPS for this title
m = Regex.Match(output.ReadLine(), @"^ \+ size: ([0-9]*)x([0-9]*), aspect: ([0-9]*\.[0-9]*), ([0-9]*\.[0-9]*) fps");
if (m.Success)
{
thisTitle.m_resolution = new Size(int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));
- thisTitle.m_aspectRatio = m.Groups[3].ToString(); // Converted to a String for French Lanuage based systems. Some weird exception thrown
- // when trying to parse it as a float
- // we don't need FPS right now
+ thisTitle.m_aspectRatio = m.Groups[3].ToString(); // Converted to a String from float. Caused issue on french systems
+ // French system floats are 1,78 not 1.78 and the CLI always outputs a .
}
// Get autocrop region for this title
@@ -179,18 +178,27 @@ namespace Handbrake.Parsing }
catch (Exception exc)
{
- MessageBox.Show(exc.ToString());
+ MessageBox.Show("Title.cs - Parse " + exc.ToString());
}
+
+
return thisTitle;
}
public static Title[] ParseList(string output)
{
List<Title> titles = new List<Title>();
- StringReader sr = new StringReader(output);
- while ((char)sr.Peek() == '+')
+ try
+ {
+ StringReader sr = new StringReader(output);
+ while ((char)sr.Peek() == '+')
+ {
+ titles.Add(Title.Parse(sr));
+ }
+ }
+ catch (Exception exc)
{
- titles.Add(Title.Parse(sr));
+ MessageBox.Show("Title.cs - ParseList " + exc.ToString());
}
return titles.ToArray();
}
diff --git a/win/C#/Properties/AssemblyInfo.cs b/win/C#/Properties/AssemblyInfo.cs index a375c642e..6af0e190d 100644 --- a/win/C#/Properties/AssemblyInfo.cs +++ b/win/C#/Properties/AssemblyInfo.cs @@ -1,14 +1,15 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Handbrake")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyDescription("DVD to MPEG-4 converter")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
+[assembly: AssemblyCompany("Handbrake")]
[assembly: AssemblyProduct("Handbrake")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
@@ -29,5 +30,6 @@ using System.Runtime.InteropServices; // Build Number
// Revision
//
-[assembly: AssemblyVersion("2.4.0.0")]
-[assembly: AssemblyFileVersion("20.4.0.0")]
+[assembly: AssemblyVersion("2.4.0.1")]
+[assembly: AssemblyFileVersion("2.4.0.1")]
+[assembly: NeutralResourcesLanguageAttribute("en-GB")]
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 30360a66d..e84ccc647 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -752,7 +752,7 @@ namespace Handbrake CheckPixelRatio.CheckState = CheckState.Unchecked;
text_width.Text = "368";
text_height.Text = "208";
- drp_videoEncoder.Text = "H.264";
+ drp_videoEncoder.Text = "Mpeg 4";
text_bitrate.Text = "1024";
text_filesize.Text = "";
slider_videoQuality.Value = 0;
diff --git a/win/C#/frmReadDVD.cs b/win/C#/frmReadDVD.cs index caef654cd..526e9bd28 100644 --- a/win/C#/frmReadDVD.cs +++ b/win/C#/frmReadDVD.cs @@ -46,7 +46,7 @@ namespace Handbrake }
catch(Exception exc)
{
- MessageBox.Show(exc.ToString());
+ MessageBox.Show("frmReadDVD.cs - btn_ok_Click " + exc.ToString());
}
}
@@ -69,7 +69,7 @@ namespace Handbrake }
catch(Exception exc)
{
- MessageBox.Show(exc.ToString());
+ MessageBox.Show("frmReadDVD.cs - updateUIElements " + exc.ToString());
}
}
@@ -103,7 +103,7 @@ namespace Handbrake }
catch (Exception exc)
{
- MessageBox.Show(exc.ToString());
+ MessageBox.Show("frmReadDVD.cs - startProc " + exc.ToString());
}
}
|